Skip to main content

no-deprecated

Disallow usage of symbols tagged with @deprecated.

Targeted pattern scope

⚠️ This rule requires type information to run. Configure type-aware linting (parserOptions.project or projectService) before enabling it.

This rule inspects identifier usages and resolves each identifier to a TypeScript symbol.

If the resolved symbol has one or more @deprecated JSDoc tags, usage is reported (unless ignored by configuration).

What this rule reports

Deprecated APIs are still callable in TypeScript unless you add explicit checks. Using them silently accumulates technical debt and can cause breakage when those APIs are removed.

This rule reports identifier usages whose resolved TypeScript symbol includes one or more @deprecated tags.

Why this rule exists

It helps enforce deprecation cleanup and prevents new usage of APIs scheduled for removal.

❌ Incorrect

/** @deprecated Use `newMethod` instead. */
declare function oldMethod(): void;

oldMethod();
interface Api {
/** @deprecated Use `nextValue` instead. */
oldValue: string;
}

declare const api: Api;
console.log(api.oldValue);

✅ Correct

declare function newMethod(): void;

newMethod();
/** @deprecated Legacy API retained for compatibility. */
declare function legacyMethod(): void;

// Declaration is allowed. Usage is reported.

Deprecated

Behavior and migration notes

This rule is deprecated in favor of @typescript-eslint/no-deprecated.

It reports only and does not provide an autofix.

Options

type Options = [
{
ignored?: Record<string, "name" | "path">;
}?,
];

Default:

[{}];

Use ignored to suppress some deprecated symbols by regular-expression pattern:

  • "name": Match against the symbol name.
  • "path": Match against the symbol's fully-qualified declaration path.

If an ignored key is not a valid regular expression, the rule reports a configuration error (invalidIgnorePattern) instead of silently ignoring it.

Example:

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/no-deprecated": [
"warn",
{
ignored: {
"^LegacyMethod$": "name",
"modules/legacy": "path",
},
},
],
},
},
];

Status

Use the Deprecated section above for lifecycle details.

Additional examples

/** @deprecated Internal migration shim */
declare const legacyApi: () => void;

legacyApi();
// ❌ reported

// config: { ignored: { "^legacyApi$": "name" } }
legacyApi();
// ✅ ignored by option

ESLint flat config example

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/no-deprecated": "error",
},
},
];

When not to use it

Disable this rule if your project intentionally relies on deprecated APIs during a planned migration window and you want to manage those usages manually.

Package documentation

Rule catalog ID: R022

Further reading

Adoption resources

  • Start at warning level in CI, then move to error after cleanup.
  • Use focused codemods/autofix batches per package or directory.