src/content/docs/linter/rules/no-deprecated-imports.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> :::note This rule belongs to the project domain. This means that its activation will activate the Biome Scanner to scan the files of your project. Read more about it in the [documentation page](/linter/domains#project) ::: ## Summary - Rule available since: `v2.2.5` - Diagnostic Category: [`lint/suspicious/noDeprecatedImports`](/reference/diagnostics#diagnostic-category) - This rule isn't recommended, so you need to enable it. - This rule doesn't have a fix. - The default severity of this rule is [**warning**](/reference/diagnostics#warning). - This rule belongs to the following domains: - [`project`](/linter/domains#project) - Sources: - Inspired from [`@typescript-eslint/no-deprecated`](https://typescript-eslint.io/rules/no-deprecated) - Inspired from [`import/no-deprecated`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md){
"linter": {
"rules": {
"suspicious": {
"noDeprecatedImports": "error"
}
}
}
}
Restrict imports of deprecated exports.
This rule flags any imports for symbols (such as types, functions, or anything else that can be imported), that are documented with a JSDoc comment that contains an "@deprecated" annotation.
import { oldUtility } from "./utils.js";
/**
* @deprecated
*/
export function oldUtility() {}
import { newUtility, oldUtility } from "./utils.js";
export function newUtility() {}
// @deprecated (this is not a JSDoc comment)
export function oldUtility() {}