lint-diff

raw JSON →
1.2.1 verified Fri May 01 auth: no javascript maintenance

lint-diff is a CLI tool that runs ESLint only on lines changed within a specified Git commit range, filtering out pre-existing lint errors. Version 1.2.1 is the latest stable release; the project appears to be in maintenance mode with no recent updates. It differs from lint-staged by working on committed changes, making it suitable for CI environments like Travis. Requires eslint 4.x as a peer dependency.

error Cannot find module 'eslint'
cause eslint is not installed.
fix
Run: npm install eslint@4.x --save-dev
error Error: Cannot find module './lib/cli'
cause Missing or broken installation of eslint.
fix
Reinstall eslint and ensure it's in node_modules.
gotcha ESLint must be installed separately and configured via .eslintrc.
fix Install eslint: npm install eslint --save-dev and ensure .eslintrc exists.
breaking Only eslint 4.x is supported as a peer dependency.
fix Use eslint@4.x.
gotcha lint-diff fails silently if the git commit range is invalid or no changes are detected.
fix Verify the commit range is correct and contains changes.
npm install lint-diff
yarn add lint-diff
pnpm add lint-diff

Shows how to run lint-diff on the last 3 commits using npx.

npx lint-diff HEAD~3..HEAD