no-new-native-nonconstructor
eslint
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"no-new-native-nonconstructor": "error",
},
},
];Disallow new operators with global non-constructor functions
const foo = new Symbol('foo');
const bar = new BigInt(9007199254740991);const foo = Symbol('foo');
const bar = BigInt(9007199254740991);
// Ignores shadowed Symbol.
function baz(Symbol) {
const qux = new Symbol("baz");
}
function quux(BigInt) {
const corge = new BigInt(9007199254740991);
}Examples from the ESLint documentation.
no-new-native-nonconstructor
eslint
export default [
{
rules: {
"no-new-native-nonconstructor": "error",
},
},
];no-new-native-nonconstructor
eslint plugin · correctness
{
"rules": {
"no-new-native-nonconstructor": "error"
}
}correctness/noInvalidBuiltinInstantiation
correctness · since 1.7.2
{
"linter": {
"rules": {
"correctness": {
"noInvalidBuiltinInstantiation": "error"
}
}
}
}Disallow multiple spaces in regular expressions
Disallow fallthrough of case statements
Disallow duplicate arguments in function definitions
Disallow let or var variables that are read but never assigned
Disallow lexical declarations in case clauses