# noUndeclaredEnvVars

Rule `biome/noUndeclaredEnvVars`. Disallow the use of undeclared environment variables.

- Source: biome
- Technologies: JavaScript
- Kind: suspicious
- Needs type information: no
- Autofix: no
- Reach: 28.5M weekly downloads of presets that enable it
- Trend: +106.8% last quarter
- Rank: #621 by reach, #258 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `suspicious/noUndeclaredEnvVars` | yes | no | group suspicious, since 2.3.10 | [docs](https://biomejs.dev/linter/rules/no-undeclared-env-vars/) |

## Code examples

### Incorrect: the rule reports this

```js
const value = process.env.MY_VAR;
```

### Correct: the rule accepts this

```js
// NODE_ENV is always allowed
const value = process.env.NODE_ENV;
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "suspicious": {
        "noUndeclaredEnvVars": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |

## Related rules

- [biome/noPrivateImports](https://lintradar.dev/rules/biome/noPrivateImports.md): Restrict imports of private exports.
- [biome/noImportantStyles](https://lintradar.dev/rules/biome/noImportantStyles.md): Disallow `!important` declarations.
- [biome/useTanstackQueryStableQueryClient](https://lintradar.dev/rules/biome/useTanstackQueryStableQueryClient.md): Require the TanStack Query `QueryClient` to be created once, not on every render.
- [biome/useTanstackQueryQueryOptions](https://lintradar.dev/rules/biome/useTanstackQueryQueryOptions.md): Require TanStack Query options to be created with `queryOptions()`.
- [biome/useTanstackQueryMutationPropertyOrder](https://lintradar.dev/rules/biome/useTanstackQueryMutationPropertyOrder.md): Enforce that `onMutate` comes before `onError` and `onSettled` in the options of TanStack Query mutations.
- [biome/useTanstackQueryInfiniteQueryPropertyOrder](https://lintradar.dev/rules/biome/useTanstackQueryInfiniteQueryPropertyOrder.md): Enforce a consistent property order in the options of TanStack Query infinite query functions.

---

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