Skip to content

Rule proposal: require node:assert/strict #2420

Closed as not planned
Closed as not planned
@electrovir

Description

@electrovir

Description

The built-in Node.js node:assert module is considered "legacy" and node:assert/strict is the non-legacy module. See the docs here: https://nodejs.org/api/assert.html#legacy-assertion-mode.

In particular, those docs note that the legacy node:assert module may produce unexpected, rather absurd, results.

Fail

import assert from 'node:assert'
import assert from 'assert'

Pass

import assert from 'node:assert/strict'
import assert from 'assert/strict'

Proposed rule name

prefer-node-assert-strict, prefer-strict-node-assert, prefer-strict-node-assert-module, prefer-strict-node-import

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions