ESLint plugin that filters lint output to only show errors on changed lines of code. Version 2.1.7 actively maintained, semver releases. Differentiators: works with both flat config (ESLint 9+) and legacy config, supports multiple modes (diff, ci, staged), includes CI autodetection with provider-based target branch detection. Ships TypeScript types. Requires eslint >=6.7.0 and node >=14.0.0. Does not provide custom rules, only processors and config presets.
npm install eslint-plugin-diffVerified import paths — ran on the pinned version, not inferred.
Flat config example with eslint-plugin-diff in diff mode, filtering lint output to changed lines.
Stage or revert unstaged changes before running ESLint in staged mode.
Use ESM import instead of require; update config to use configs['flat/*'] if on ESLint 9.
Explicitly set ESLINT_PLUGIN_DIFF_COMMIT to a commit you have locally, or ensure full git history.
Upgrade eslint to >=6.7.0.
Run lint only in a git repository with git installed.
Run 'npm install --save-dev eslint-plugin-diff'.
Add 'plugins: [diff]' or use 'plugin:diff/diff' extends preset.
Initialize a git repository with 'git init' or run ESLint on a git repo.