Skip to content

useNodeAssertStrict

诊断类别:lint/style/useNodeAssertStrict

¥Diagnostic Category: lint/style/useNodeAssertStrict

自从:v1.6.0

¥Since: v1.6.0

提倡使用 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