An ESLint plugin that reports usage of deprecated code by leveraging TypeScript type checking. Version 3.0.0 supports ESLint v8+ and TypeScript 4.2+ / 5.x. It automatically detects any code annotated with the JSDoc `@deprecated` tag, including APIs from your own code, libraries, Node.js, and browsers. Key differentiators: unlike simple regex-based checks, it uses the TypeScript compiler to accurately resolve deprecated symbols, avoiding false positives. The plugin ships with a recommended config and is maintained with frequent releases following semver. It requires a TypeScript parser with type information enabled.
npm install eslint-plugin-deprecationVerified import paths — ran on the pinned version, not inferred.
Basic setup of ESLint with TypeScript parser and deprecation rule in .eslintrc.json, plus a TS file example showing the rule in action.
Upgrade to ESLint v8+ or downgrade eslint-plugin-deprecation to v2.0.0.
Upgrade ESLint to v7+ and TypeScript to v4.2+ or lock peer dependencies to v1.x.
Use import or switch to ESM: `import deprecation from 'eslint-plugin-deprecation'`
Set `'project': './tsconfig.json'` in parserOptions and ensure the tsconfig includes the files being linted.
Include declarations in tsconfig or use a declaration file that is part of the project.
Avoid dynamic access to deprecated APIs or use a separate lint rule for dynamic cases.
Ensure you have installed @typescript-eslint/utils >=6.0.0 (for v2+) or >=7.0.0 (for v3+). Run: npm install @typescript-eslint/utils --save-dev
Install the plugin: npm install eslint-plugin-deprecation --save-dev
Add in .eslintrc.json: "parserOptions": { "project": "./tsconfig.json" }Set parserOptions.project as described above.
Add "deprecation" to the "plugins" array in your ESLint config.