0.3.0 • Published 8 years ago

lint-git-changes v0.3.0

Weekly downloads
26
License
-
Repository
github
Last release
8 years ago

lint-git-changes

version npm

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.
0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago