For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt, and this page is available as Markdown at https://rslint.rs/rules/eslint/no-obj-calls.md.
close

no-obj-calls

Added in v0.4.0

Configuration

PresetConfigured Value
✅ js.configs.recommended"error"
rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-obj-calls': 'error',
    },
  },
]);

Rule Details

Disallows calling global objects (Math, JSON, Reflect, Atomics, Intl) as functions or constructors. These are namespace objects that provide properties and methods but are not themselves callable. Attempting to call them will throw a TypeError at runtime.

Examples of incorrect code for this rule:

var x = Math();
var y = JSON();
var z = Reflect();
var a = new Math();
var b = new JSON();

Examples of correct code for this rule:

var x = Math.random();
var y = JSON.parse('{}');
var z = Reflect.get(obj, 'key');
var a = new Intl.Segmenter();
var b = Math.PI;

Original Documentation