0.3.0 • Published 8 years ago
lint-git-changes v0.3.0
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-devor
$ yarn add lint-git-changes --devUsage
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
eslintwas considered as a peer dependency.