# no-eval

Rule `eslint/no-eval`. Disallow the use of `eval()`

- Source: eslint
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 101.4M weekly downloads of presets that enable it
- Trend: +97.5% last quarter
- Rank: #158 by reach, #265 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-eval` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-eval) |
| Oxlint | `no-eval` | yes | no | plugin `eslint`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-eval.html) |
| Biome | `security/noGlobalEval` | yes | no | group security, since 1.5.0 | [docs](https://biomejs.dev/linter/rules/no-global-eval/) |

## Code examples

### Incorrect: the rule reports this

```js
const obj = { x: "foo" },
    key = "x",
    value = eval("obj." + key);

(0, eval)("const a = 0");

const foo = eval;
foo("const a = 0");

// This `this` is the global object.
this.eval("const a = 0");
```

```js
/*global window*/

window.eval("const a = 0");
```

```js
/*global global*/

global.eval("const a = 0");
```

### Correct: the rule accepts this

```js
const obj = { x: "foo" },
    key = "x",
    value = obj[key];

class A {
    foo() {
        // This is a user-defined method.
        this.eval("const a = 0");
    }

    eval() {
    }

    static {
        // This is a user-defined static method.
        this.eval("const a = 0");
    }

    static eval() {
    }
}
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "no-eval": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "no-eval": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "security": {
        "noGlobalEval": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Oxlint default](https://lintradar.dev/presets/oxlint-default.md) | Oxlint | `oxlint` | 111 | 50.8M | +183.6% |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Create React App](https://lintradar.dev/presets/react-app.md) | ESLint | `eslint-config-react-app` | 109 | 4.1M | +4.3% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [JavaScript Standard Style](https://lintradar.dev/presets/standard.md) | ESLint | `eslint-config-standard` | 161 | 3.1M | +12.9% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [React Native](https://lintradar.dev/presets/react-native.md) | ESLint | `@react-native/eslint-config` | 79 | 1.2M | +5.8% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [neostandard](https://lintradar.dev/presets/neostandard.md) | ESLint | `neostandard` | 95 | 317.6K | +50.2% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [eslint/no-useless-rename](https://lintradar.dev/rules/eslint/no-useless-rename.md): Disallow renaming import, export, and destructured assignments to the same name
- [eslint/no-caller](https://lintradar.dev/rules/eslint/no-caller.md): Disallow the use of `arguments.caller` or `arguments.callee`
- [eslint/preserve-caught-error](https://lintradar.dev/rules/eslint/preserve-caught-error.md): Disallow losing originally caught error when re-throwing custom errors
- [eslint/no-iterator](https://lintradar.dev/rules/eslint/no-iterator.md): Disallow the use of the `__iterator__` property
- [eslint/prefer-spread](https://lintradar.dev/rules/eslint/prefer-spread.md): Require spread operators instead of `.apply()`
- [eslint/no-undef](https://lintradar.dev/rules/eslint/no-undef.md): Disallow the use of undeclared variables unless mentioned in `/*global */` comments

---

Web page: https://lintradar.dev/rules/eslint/no-eval. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
