Skip to content

deprecated

Disallow using code marked as @deprecated.

✅ This rule is included in the ts logical and logicalStrict presets.

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
function oldFunction(): string

@deprecatedUse newFunction instead

oldFunction
() {
return "old";
}
function oldFunction(): string

@deprecatedUse newFunction instead

oldFunction
();
class
class Example
Example
{
/** @deprecated Use newMethod instead */
Example.oldMethod(): void

@deprecatedUse newMethod instead

oldMethod
() {}
Example.test(): void
test
() {
this.
Example.oldMethod(): void

@deprecatedUse newMethod instead

oldMethod
();
}
}
/** @deprecated Use NewClass instead */
class
class OldClass

@deprecatedUse NewClass instead

OldClass
{}
const
const instance: OldClass
instance
= new
constructor OldClass(): OldClass

@deprecatedUse NewClass instead

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 ❤️‍🔥 around the world by the Flint team and contributors.