noDeprecatedImports
此内容尚不支持你的语言。
Summary
Section titled “Summary”- Rule available since:
v2.2.5
- Diagnostic Category:
lint/nursery/noDeprecatedImports
- This rule doesn’t have a fix.
- The default severity of this rule is warning.
- This rule belongs to the following domains:
- Sources:
- Inspired from
@typescript-eslint/no-deprecated
- Inspired from
import/no-deprecated
- Inspired from
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noDeprecatedImports": "error" } } }}
Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”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.
/** * @deprecated */export function oldUtility() {}
import { newUtility, oldUtility } from "./utils.js";
export function newUtility() {}
// @deprecated (this is not a JSDoc comment)export function oldUtility() {}
Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.