eslint/no-obj-calls Correctness ​
What it does ​
Disallow calling some global objects as functions
Why is this bad? ​
Some global objects are not intended to be called as functions. Calling them as functions will usually result in a TypeError being thrown.
Example ​
Examples of incorrect code for this rule:
javascript
let math = Math();
let newMath = new Math();
let json = JSON();
let newJson = new JSON();
let atomics = Atomics();
let newAtomics = new Atomics();
let intl = Intl();
let newIntl = new Intl();
let reflect = Reflect();
let newReflect = new Reflect();
Examples of correct code for this rule:
javascript
let area = (r) => 2 * Math.PI * r * r;
let object = JSON.parse("{}");
let first = Atomics.load(sharedArray, 0);
let segmenterFrom = Intl.Segmenter("fr", { granularity: "word" });