Skip to content

Latest commit

History

History
38 lines (25 loc) 路 1.11 KB

File metadata and controls

38 lines (25 loc) 路 1.11 KB

n/prefer-import/assert-strict

馃摑 Enforce using node:assert/strict instead of node:assert.

馃摉 Rule Details

The node:assert module exposes legacy, non-strict assertion methods. The node:assert/strict module changes the legacy methods to use strict equality.

馃憤 Examples of correct code for this rule:

/*eslint n/prefer-import/assert-strict: error */

import assert from "node:assert/strict"
import("node:assert/strict")
const assert = require("node:assert/strict")

// These forms already select strict assertion mode.
import { strict as strictAssert } from "node:assert"
const requiredAssert = require("node:assert").strict

馃憥 Examples of incorrect code for this rule:

/*eslint n/prefer-import/assert-strict: error */

import assert from "node:assert"
import("node:assert")
const assert = require("node:assert")

馃攷 Implementation