noDeprecatedImports
¥Summary
-
规则生效日期:
v2.2.5¥Rule available since:
v2.2.5 -
诊断类别:
lint/nursery/noDeprecatedImports¥Diagnostic Category:
lint/nursery/noDeprecatedImports -
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 warning。
¥The default severity of this rule is warning.
-
此规则属于以下域:
¥This rule belongs to the following domains:
-
来源:
¥Sources:
-
灵感来自
@typescript-eslint/no-deprecated¥Inspired from
@typescript-eslint/no-deprecated -
灵感来自
import/no-deprecated¥Inspired from
import/no-deprecated
-
¥How to configure
{ "linter": { "rules": { "nursery": { "noDeprecatedImports": "error" } } }}¥Description
限制导入已弃用的导出项。
¥Restrict imports of deprecated exports.
此规则标记所有使用包含 “@deprecated” 注解的 JSDoc 注释进行文档化的符号导入(例如类型、函数或任何其他可导入的内容)。
¥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
¥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() {}¥Valid
import { newUtility, oldUtility } from "./utils.js";export function newUtility() {}
// @deprecated (this is not a JSDoc comment)export function oldUtility() {}¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号