# prefer-enum-initializers

Rule `typescript/prefer-enum-initializers`. Require each enum member value to be explicitly initialized

- Source: typescript
- Technologies: TypeScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 2.1M weekly downloads of presets that enable it
- Trend: +151.7% last quarter
- Rank: #1503 by reach, #7 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/prefer-enum-initializers` | no | suggestion | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/prefer-enum-initializers) |
| Oxlint | `typescript/prefer-enum-initializers` | no | safe | plugin `typescript`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/prefer-enum-initializers.html) |
| Biome | `style/useEnumInitializers` | no | safe | group style, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/use-enum-initializers/) |

## Code examples

### Incorrect: the rule reports this

```ts
enum Status {
  Open = 1,
  Close,
}

enum Direction {
  Up,
  Down,
}

enum Color {
  Red,
  Green = 'Green',
  Blue = 'Blue',
}
```

### Correct: the rule accepts this

```ts
enum Status {
  Open = 'Open',
  Close = 'Close',
}

enum Direction {
  Up = 1,
  Down = 2,
}

enum Color {
  Red = 'Red',
  Green = 'Green',
  Blue = 'Blue',
}
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { "@typescript-eslint": tseslint.plugin },
    rules: {
      "@typescript-eslint/prefer-enum-initializers": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/prefer-enum-initializers": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "useEnumInitializers": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |

## Related rules

- [typescript/parameter-properties](https://lintradar.dev/rules/typescript/parameter-properties.md): Require or disallow parameter properties in class constructors
- [typescript/consistent-return](https://lintradar.dev/rules/typescript/consistent-return.md): Require `return` statements to either always or never specify values
- [typescript/explicit-member-accessibility](https://lintradar.dev/rules/typescript/explicit-member-accessibility.md): Require explicit accessibility modifiers on class properties and methods
- [typescript/no-unsafe-type-assertion](https://lintradar.dev/rules/typescript/no-unsafe-type-assertion.md): Disallow type assertions that narrow a type
- [typescript/prefer-regexp-exec](https://lintradar.dev/rules/typescript/prefer-regexp-exec.md): Enforce `RegExp#exec` over `String#match` if no global flag is provided
- [typescript/default-param-last](https://lintradar.dev/rules/typescript/default-param-last.md): Enforce default parameters to be last

---

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