0.4.0 • Published 6 years ago

difflint v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

difflint

Build Status

:nail_care: Run eslint only in the changed parts of the code

Why

ESLint is a great tool to enforce code style in your code, but it has some limitations: it can only lint entire files. When working with legacy code, we often have to make changes to very large files (which would be too troublesome to fix all lint errors)and thus it would be good to lint only the lines changed and not the entire file.

difflint receives a commit range and uses ESLint to lint the changed files and filter only the errors introduced in the commit range (and nothing more).

State of the art

  • lint-staged is a similar tool that lints only the staged changes. It's very helpful for adding a precommit hook, but it cannot be used to enforce the styleguide on a Continuous Integration service like Travis, because the changes are already commited.

Usage

  1. Install it:

    npm install difflint
  2. Install eslint and add your eslint configuration file.

  3. Use it:

    # This will lint the last commit
    difflint lint HEAD^..HEAD

Examples

  1. Lint the last 3 commits:

    difflint lint HEAD~3..HEAD
  2. Lint local changes that are not yet commited (similar to what lint-staged do):

    difflint lint HEAD
  3. Lint all commits from a build in Travis:

    # This environment variable will be available in any Travis build
    difflint lint $TRAVIS_COMMIT_RANGE
0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago