no-obj-calls
eslint
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"no-obj-calls": "error",
},
},
];const math = Math();
const newMath = new Math();
const json = JSON();
const newJSON = new JSON();
const reflect = Reflect();
const newReflect = new Reflect();
const atomics = Atomics();
const newAtomics = new Atomics();
const intl = Intl();
const newIntl = new Intl();
const temporal = Temporal();
const newTemporal = new Temporal();
const globalObject = globalThis();
const newGlobalObject = new globalThis();function area(r) {
return Math.PI * r * r;
}
const object = JSON.parse("{}");
const value = Reflect.get({ x: 1, y: 2 }, "x");
const first = Atomics.load(foo, 0);
const segmenterFr = new Intl.Segmenter("fr", { granularity: "word" });
const instant = Temporal.Now.instant();
const parsed = globalThis.parseInt("42", 10);Examples from the ESLint documentation.
no-obj-calls
eslint
export default [
{
rules: {
"no-obj-calls": "error",
},
},
];no-obj-calls
eslint plugin · correctness
{
"rules": {
"no-obj-calls": "error"
}
}correctness/noGlobalObjectCalls
correctness · since 1.0.0
{
"linter": {
"rules": {
"correctness": {
"noGlobalObjectCalls": "error"
}
}
}
}Disallow reassigning function declarations
Disallow unreachable code after return, throw, continue, and break statements
Disallow duplicate keys in object literals
Disallow reassigning const, using, and await using variables
Disallow unnecessary boolean casts