useNodeAssertStrict (JavaScript)
Language JavaScript (and super languages)
Summary
Section titled “Summary”- Rule available since:
v1.6.0 - Diagnostic Category:
lint/style/useNodeAssertStrict - This rule isn’t recommended, so you need to enable it.
- This rule has a safe fix.
- The default severity of this rule is warning.
How to configure
Section titled “How to configure”{ "linter": { "rules": { "style": { "useNodeAssertStrict": "error" } } }}Description
Section titled “Description”Prefer node:assert/strict over node:assert.
The strict module exposes the same assertion API, but legacy methods such as equal() and
deepEqual() use strict comparison behavior. This avoids surprising results caused by
automatic type conversion.
Examples
Section titled “Examples”Invalid
Section titled “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"
│ +++++++
import * as assert from "node:assert/strict"Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.