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

[Added in v0.7.0](https://github.com/web-infra-dev/rslint/releases/tag/v0.7.0)
## 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-redeclare': 'error',
    },
  },
]);
```

## Rule Details

This rule disallows declaring the same variable more than once in the same scope.

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

```javascript
var a = 3;
var a = 10;
```

```javascript
function a() {}
function a() {}
```

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

```javascript
var a = 3;
var b = function () {
  var a = 10;
};
```

```javascript
if (foo) {
  let a = 1;
} else {
  let a = 2;
}
```

## Options

### `builtinGlobals` (default: `true`)

When `true`, this rule reports redeclarations of ECMAScript built-in globals.
Configured [`languageOptions.globals`](https://rslint.rs/config/language-options.md#languageoptionsglobals) also
participate as built-ins. Select host environments with the `globals` catalog
exported by `@rslint/core`. Active `/* global */` directives participate as
declarations in either mode; a final `:off` setting removes that inline global.

```json
{ "no-redeclare": ["error", { "builtinGlobals": true }] }
```

```javascript
var Object = 0;
```

Set `builtinGlobals` to `false` to allow redeclaring built-in global names.

```json
{ "no-redeclare": ["error", { "builtinGlobals": false }] }
```

```javascript
var Object = 0;
```

## Original Documentation

- [ESLint: no-redeclare](https://eslint.org/docs/latest/rules/no-redeclare)
- [Source code](https://github.com/eslint/eslint/blob/v10.8.1/lib/rules/no-redeclare.js)
