globalObjectCalls
Reports calling global objects like Math, JSON, or Reflect as functions.
✅ This rule is included in the ts untyped preset.
The global objects Math, JSON, Reflect, and Atomics are not constructors or functions.
They are built-in objects that provide utility methods and properties as namespaces.
Attempting to call them as functions or instantiate them with new will result in a TypeError at runtime.
Examples
Section titled “Examples”const result = Math();
const data = JSON();
const reflected = Reflect();
const instance = new Atomics();const value = Math.abs(-5);
const parsed = JSON.parse("{}");
const keys = Reflect.ownKeys({});
const result = Atomics.add(buffer, 0, 1);Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If your codebase redefines these objects and is guaranteed to run in an environment that allows that, you might not want to enable this rule. For example, if you target a legacy runtime with legacy non-standard JavaScript semantics, modern standard practices may not apply to you.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noGlobalObjectCalls - Deno:
no-obj-calls - ESLint:
no-obj-calls - Oxlint:
eslint/no-obj-calls
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.