new-cap
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"new-cap": "error",
},
},
];function String(value) {
return value + "";
}
const foo = String(42);
const Date = { UTC() { return 0; } };
const time = Date.UTC(2000, 0);function foo(arg) {
return Boolean(arg);
}
function bar(arg) {
return globalThis.Boolean(arg);
}
const time = Date.UTC(2000, 0);
const otherTime = globalThis.Date.UTC(2000, 0);Examples from the ESLint documentation.
new-cap
eslint
export default [
{
rules: {
"new-cap": "error",
},
},
];new-cap
eslint plugin · style
{
"rules": {
"new-cap": "error"
}
}nursery/useCapitalizedConstructors
nursery · since 2.6.0
{
"linter": {
"rules": {
"nursery": {
"useCapitalizedConstructors": "error"
}
}
}
}Disallow labels that share a name with a variable
Disallow initializing variables to undefined
Enforce default clauses in switch statements to be last