useNodeAssertStrict
¥Summary
-
规则生效日期:
v1.6.0¥Rule available since:
v1.6.0 -
诊断类别:
lint/style/useNodeAssertStrict¥Diagnostic Category:
lint/style/useNodeAssertStrict -
此规则包含 safe 修复程序。
¥This rule has a safe fix.
-
此规则的默认严重级别为 warning。
¥The default severity of this rule is warning.
¥How to configure
{ "linter": { "rules": { "style": { "useNodeAssertStrict": "error" } } }}¥Description
提倡使用 node:assert/strict 而不是 node:assert。
¥Promotes the usage of node:assert/strict over node:assert.
如果你在使用 Node.js 断言模块时更喜欢更严格的断言,则 node:assert/strict 包会公开一组更严格断言的别名。
¥If you prefer stricter assertions when using the Node.js assertion module, the package node:assert/strict exposes a set of alias for stricter assertions.
¥Examples
¥Invalid
import * as assert from "node:assert"code-block.js:1:25 lint/style/useNodeAssertStrict FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Use node:assert/strict instead.
> 1 │ import * as assert from “node:assert”
│ ^^^^^^^^^^^^^
2 │
ℹ The use of stricter assertion is preferred.
ℹ Safe fix: Replace with node:assert/strict.
1 │ import·*·as·assert·from·“node:assert/strict”
│ +++++++
¥Valid
import * as assert from "node:assert/strict"¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号