# no-unused-vars

Rule `typescript/no-unused-vars`. Disallow unused variables

- Source: typescript
- Technologies: TypeScript
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 185.6M weekly downloads of presets that enable it
- Trend: +28.5% last quarter
- Rank: #83 by reach, #1153 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/no-unused-vars` | yes | safe | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/no-unused-vars) |
| Biome | `correctness/noUnusedVariables` | yes | unsafe | group correctness, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-unused-variables/) |

## Code examples

### Incorrect: the rule reports this

```js
let a = 4;
a++;
```

```js
function foo() {}
```

```js
function foo() {
    foo();
}
```

### Correct: the rule accepts this

```js
function foo(b) {
    console.log(b)
};
foo();
```

```js
export function foo(_unused) {}
```

```ts
function used_overloaded(): number;
function used_overloaded(s: string): string;
function used_overloaded(s?: string) {
    return s;
}
used_overloaded();
```

Examples from the Biome documentation.

## Enable it

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

```js
import tseslint from "typescript-eslint";

export default [
  {
    plugins: { "@typescript-eslint": tseslint.plugin },
    rules: {
      "@typescript-eslint/no-unused-vars": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "correctness": {
        "noUnusedVariables": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [typescript-eslint recommended](https://lintradar.dev/presets/typescript-eslint-recommended.md) | ESLint | `@typescript-eslint/eslint-plugin` | 24 | 175.9M | +29.5% |
| [typescript-eslint strict](https://lintradar.dev/presets/typescript-eslint-strict.md) | ESLint | `@typescript-eslint/eslint-plugin` | 32 | 175.9M | +29.5% |
| [typescript-eslint strict type-checked](https://lintradar.dev/presets/typescript-eslint-strict-type-checked.md) | ESLint | `@typescript-eslint/eslint-plugin` | 75 | 175.9M | +29.5% |
| [typescript-eslint recommended type-checked](https://lintradar.dev/presets/typescript-eslint-recommended-type-checked.md) | ESLint | `@typescript-eslint/eslint-plugin` | 47 | 175.9M | +29.5% |
| [Create React App](https://lintradar.dev/presets/react-app.md) | ESLint | `eslint-config-react-app` | 109 | 4.1M | +4.3% |
| [Airbnb TypeScript](https://lintradar.dev/presets/airbnb-typescript.md) | ESLint | `eslint-config-airbnb-typescript` | 19 | 1.8M | +1.2% |
| [Nuxt](https://lintradar.dev/presets/nuxt.md) | ESLint | `@nuxt/eslint-config` | 188 | 1.5M | +72.8% |
| [React Native](https://lintradar.dev/presets/react-native.md) | ESLint | `@react-native/eslint-config` | 79 | 1.2M | +5.8% |
| [Google TypeScript Style](https://lintradar.dev/presets/gts.md) | ESLint | `gts` | 71 | 553.3K | +10.3% |
| [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-unused-vars](https://lintradar.dev/rules/eslint/no-unused-vars.md): Disallow unused variables
- [vue/no-unused-vars](https://lintradar.dev/rules/vue/no-unused-vars.md): Disallow unused variable definitions of v-for directives or scope attributes
- [sonarjs/no-unused-vars](https://lintradar.dev/rules/sonarjs/no-unused-vars.md): Unused local variables and functions should be removed
- [typescript/no-array-constructor](https://lintradar.dev/rules/typescript/no-array-constructor.md): Disallow generic `Array` constructors
- [typescript/no-unused-expressions](https://lintradar.dev/rules/typescript/no-unused-expressions.md): Disallow unused expressions
- [typescript/no-unsafe-function-type](https://lintradar.dev/rules/typescript/no-unsafe-function-type.md): Disallow using the unsafe built-in Function type

---

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