n/prefer-process-get-builtin-module
eslint-plugin-n
No autofix
eslint.config.js
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/prefer-process-get-builtin-module": "error",
},
},
];Enforce using process.getBuiltinModule() to load Node.js built-in modules
const fs = require("node:fs")
const promises = await import("node:fs/promises")const fs = process.getBuiltinModule("node:fs")
const eslint = require("eslint")
const lazyFs = import("node:fs")Examples from the ESLint documentation.
n/prefer-process-get-builtin-module
eslint-plugin-n
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/prefer-process-get-builtin-module": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce the style of file extensions in import declarations