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

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

| Preset                   | Configured Value |
| ------------------------ | ---------------- |
| ✅ js.configs.recommended | `"error"`        |


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

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

## Rule Details

Disallow `with` statements.

The `with` statement is potentially problematic because it adds members of an object to the current scope, making it impossible to tell what a variable inside the block actually refers to. In strict mode, `with` statements are not allowed at all.

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

```javascript
with (point) {
  r = Math.sqrt(x * x + y * y); // is r a member of point?
}
```

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

```javascript
const r = Math.sqrt(point.x * point.x + point.y * point.y);
```

## Original Documentation

- [ESLint: no-with](https://eslint.org/docs/latest/rules/no-with)
- [Source code](https://github.com/eslint/eslint/blob/v9.39.1/lib/rules/no-with.js)
