Aller au contenu

noDeprecatedImports

Ce contenu n’est pas encore disponible dans votre langue.

biome.json
{
"linter": {
"rules": {
"nursery": {
"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.

foo.js
import { oldUtility } from "./utils.js";
/foo.js:1:10 lint/nursery/noDeprecatedImports ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Deprecated import.

> 1 │ import { oldUtility } from “./utils.js”;
^^^^^^^^^^
2 │

An @deprecated annotation indicates the author doesn’t want you to rely on this import anymore.

You should probably import a different symbol instead.

utils.js
/**
* @deprecated
*/
export function oldUtility() {}
foo.js
import { newUtility, oldUtility } from "./utils.js";
utils.js
export function newUtility() {}
// @deprecated (this is not a JSDoc comment)
export function oldUtility() {}