deprecated
Disallow using code marked as @deprecated.
✅ This rule is included in the ts logical preset.
The JSDoc @deprecated tag documents code that should no longer be used.
TypeScript already visually indicates deprecated code with strikethrough styling, but does not produce errors for using it.
Using deprecated code often leads to maintenance issues when that code is eventually removed.
This rule reports references to code marked with @deprecated.
Examples
Section titled “Examples”/** @deprecated Use newFunction instead */function oldFunction() { return "old";}
oldFunction();class Example { /** @deprecated Use newMethod instead */ oldMethod() {}
test() { this.oldMethod(); }}/** @deprecated Use NewClass instead */class OldClass {}
const instance = new OldClass();function newFunction() { return "new";}
newFunction();class Example { newMethod() {}
test() { this.newMethod(); }}/** @deprecated This is deprecated but not used */function unused() {}
function active() {}active();Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If portions of your project heavily use deprecated APIs and have no plan for migrating to non-deprecated alternatives, you may disable this rule in those portions. Some legacy code may need to continue using deprecated APIs until a migration can be planned.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
@typescript-eslint/no-deprecated
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.