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

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


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

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

Disallow variable declarations from shadowing variables declared in the outer scope.

Extends the ESLint core [`no-shadow`](https://eslint.org/docs/latest/rules/no-shadow) rule with TypeScript-aware behavior.

## Rule Details

Shadowing occurs when a local variable shares the same name as a variable in its containing scope. The TypeScript variant additionally understands type-only declarations and the related `typeof` interplay between values and types.

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

```ts
type Foo = number;
function b() {
  type Foo = string;
}
```

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

```ts
type Foo = number;
function b() {
  type Bar = string;
}
```

## Options

This rule accepts the same options as the ESLint core `no-shadow` rule with these additions and default differences:

### `hoist`

In addition to the core values (`"functions"`, `"all"`, `"never"`), this rule supports:

- `"types"`: report shadowing of an outer type or interface that appears later.
- `"functions-and-types"`: report shadowing of outer function or type declarations that appear later.

**Default**: `"functions-and-types"` (the core ESLint default is `"functions"`).

### `ignoreTypeValueShadow`

When `true`, a value declaration and a type declaration that share a name are not considered shadowing (the two live in different namespaces and a `typeof` is required to bridge them).

**Default**: `true`.

```json
{ "@typescript-eslint/no-shadow": ["error", { "ignoreTypeValueShadow": false }] }
```

```ts
type Foo = number;
function f() {
  const Foo = 1;
}
```

### `ignoreFunctionTypeParameterNameValueShadow`

When `true`, parameters declared inside a function type (for example `(x: string) => void`) do not report when they shadow an outer value binding.

**Default**: `true`.

```json
{ "@typescript-eslint/no-shadow": ["error", { "ignoreFunctionTypeParameterNameValueShadow": false }] }
```

```ts
const test = 1;
type Func = (test: string) => typeof test;
```

### `allow`, `builtinGlobals`, `ignoreOnInitialization`

Same semantics and defaults as the ESLint core rule.
When `builtinGlobals` is enabled, names from
[`languageOptions.globals`](https://rslint.rs/config/language-options.md#languageoptionsglobals) participate too;
the `globals` catalog exported by `@rslint/core` provides runtime environment
maps.

## Original Documentation

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