# no-obj-calls

> Disallow calling `Math`, `JSON`, `Reflect`, `Atomics`, `Intl` and `Temporal` as functions

`Math`, `JSON`, `Reflect`, `Atomics`, `Intl` and `Temporal` start with a capital letter, but they're plain objects that hold functions. `Math()` and `new JSON()` throw a `TypeError` when they run.

The rule follows the object through variables and through `globalThis`.

This rule is on by default in JavaScript files. It's off in TypeScript files, where TypeScript reports the same mistake.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

On by default as an error. To turn it off:

```toml bunfig.toml
[lint.rules]
"no-obj-calls" = "off" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```js
const random = Math();
```

{/* bad */}
```js
const parser = new JSON();
```

{/* bad {"count": 2} */}
```js
const format = Intl;
const text = format("en-US");

const now = globalThis.Reflect();
```

Not reported:

{/* good */}
```js
const random = Math.random();
const data = JSON.parse(body);
const text = new Intl.NumberFormat("en-US").format(total);
```
