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.