{"id":19729,"library":"eslint-plugin-diff","title":"eslint-plugin-diff","description":"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.","status":"active","version":"2.1.7","language":"javascript","source_language":"en","source_url":"https://github.com/paleite/eslint-plugin-diff","tags":["javascript","eslint","eslintplugin","eslint-plugin","diff","typescript"],"install":[{"cmd":"npm install eslint-plugin-diff","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-diff","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-diff","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for plugin integration","package":"eslint","optional":true}],"imports":[{"note":"ESM default import; package ships TypeScript types.","wrong":"const diff = require('eslint-plugin-diff')","symbol":"default export","correct":"import diff from 'eslint-plugin-diff'"},{"note":"Access via bracket notation with flat/ prefix; 'diff' key does not exist directly.","wrong":"diff.configs.diff","symbol":"flat config preset","correct":"diff.configs[\"flat/diff\"]"},{"note":"Must include 'plugin:' prefix for ESLint to resolve plugin scoped configs.","wrong":"\"extends\": [\"diff/diff\"]","symbol":"legacy config preset","correct":"\"extends\": [\"plugin:diff/diff\"]"}],"quickstart":{"code":"import diff from 'eslint-plugin-diff';\n\nexport default [\n  {\n    files: ['**/*.js', '**/*.ts'],\n    rules: { semi: 'error' }\n  },\n  ...diff.configs['flat/diff']\n];","lang":"typescript","description":"Flat config example with eslint-plugin-diff in diff mode, filtering lint output to changed lines."},"warnings":[{"fix":"Stage or revert unstaged changes before running ESLint in staged mode.","message":"For staged mode, files with unstaged changes will emit a fatal error and block linting.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use ESM import instead of require; update config to use configs['flat/*'] if on ESLint 9.","message":"v2.0.0 migrated from legacy config to flat config internally; old require() usage may break.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Explicitly set ESLINT_PLUGIN_DIFF_COMMIT to a commit you have locally, or ensure full git history.","message":"In CI mode, if ESLINT_PLUGIN_DIFF_COMMIT is not set, the plugin fetches from origin, which may fail in shallow clone environments.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Upgrade eslint to >=6.7.0.","message":"ESLint <6.7.0 is no longer supported as of v2.0.0.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Run lint only in a git repository with git installed.","message":"The plugin uses git diff internally; if git is not installed or the project is not a git repo, it throws an error.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev eslint-plugin-diff'.","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'eslint-plugin-diff'"},{"fix":"Add 'plugins: [diff]' or use 'plugin:diff/diff' extends preset.","cause":"Using the plugin name 'diff' in config but plugin not registered.","error":"Configuration for rule 'diff/diff' is invalid"},{"fix":"Initialize a git repository with 'git init' or run ESLint on a git repo.","cause":"eslint-plugin-diff requires a git repository to compute diff.","error":"fatal: not a git repository (or any of the parent directories): .git"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}