> 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.

# no-implied-eval

[Added in v0.1.4](https://github.com/web-infra-dev/rslint/releases/tag/v0.1.4)
## Configuration

| Preset                              | Configured Value |
| ----------------------------------- | ---------------- |
| ✅ ts.configs.recommendedTypeChecked | `"error"`        |
| ✅ ts.configs.strictTypeChecked      | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/no-implied-eval': 'error',
    },
  },
]);
```

## Rule Details

Disallows the use of `eval()`-like methods. Functions such as `setTimeout`, `setInterval`, `setImmediate`, and `execScript` can accept a string argument that is evaluated as code, similar to `eval()`. This is dangerous because it can execute arbitrary code and makes the application vulnerable to injection attacks. This rule also disallows using the `Function` constructor to dynamically create functions from strings.

Examples of **incorrect** code for this rule:

```typescript
setTimeout("alert('hello')", 100);

setInterval('doWork()', 1000);

const fn = new Function('a', 'b', 'return a + b');

window.setTimeout('doSomething()', 100);
```

Examples of **correct** code for this rule:

```typescript
setTimeout(() => alert('hello'), 100);

setInterval(doWork, 1000);

const fn = (a: number, b: number) => a + b;

window.setTimeout(() => doSomething(), 100);
```

## Original Documentation

- [typescript-eslint: no-implied-eval](https://typescript-eslint.io/rules/no-implied-eval)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.67.0/packages/eslint-plugin/src/rules/no-implied-eval.ts)
