n/no-restricted-require
eslint-plugin-n
No autofix
eslint.config.js
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/no-restricted-require": "error",
},
},
];const fs = require('fs');
const cluster = require('cluster');
const pick = require('lodash/pick');const crypto = require('crypto');
const _ = require('lodash');const pick = require('lodash/pick');Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
n/no-restricted-require
eslint-plugin-n
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/no-restricted-require": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow specified modules when loaded by import declarations
Disallow unsupported ECMAScript built-ins on the specified version
Disallow unsupported ECMAScript syntax on the specified version
Disallow unsupported Node.js built-in APIs on the specified version