Skip to content

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.

/** @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();

This rule is not configurable.

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.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.