lint-git-changes
v0.3.0
Published
Run eslint on changed files in your git repo, before git commit
Downloads
6
Readme
lint-git-changes
Run eslint on changed files in your git repo, before git commit. It output results colorfully.
Installation
$ npm install lint-git-changes --save-dev
or
$ yarn add lint-git-changes --dev
Usage
It should be used as a script with husky or pre-commit.
lint(options)
Options
ext
- {String | Array<String>}. Files which matched the configured extensions will be lint. Default:"js"
.fix
- {Boolean}. Whether fix the codes automatically. Default:false
.dir
- {String}. Choose the directory(relative path to project dir) to lint.
Example
./foo.js
const lint = require('lint-git-changes')
lint({
ext: 'js, jsx' // or ['js', 'jsx']
})
package.json
used with husky, please install it first.
{
"script": {
"precommit": "node ./foo.js"
}
}
Addition
eslint
was considered as a peer dependency.