# prefer-literal-enum-member

Rule `typescript/prefer-literal-enum-member`. Require all enum members to be literal values

- Source: typescript
- Technologies: TypeScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 77.4M weekly downloads of presets that enable it
- Trend: +53.2% last quarter
- Rank: #225 by reach, #747 by growth

## Linters

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

## Code examples

### Incorrect: the rule reports this

```ts
const str = 'Test';
const string1 = 'string1';
const string2 = 'string2';

enum Invalid {
  A = str, // Variable assignment
  B = `Interpolates ${string1} and ${string2}`, // Template literal with interpolation
  C = 2 + 2, // Expression assignment
  D = C, // Assignment to another enum member
}
```

### Correct: the rule accepts this

```ts
enum Valid {
  A, // No initializer; initialized with ascending integers starting from 0
  B = 'TestStr', // A regular string
  C = `A template literal string`, // A template literal without interpolation
  D = 4, // A number
}
```

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-literal-enum-member": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

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

### Biome: `biome.json`

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [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% |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [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% |
| [Nuxt](https://lintradar.dev/presets/nuxt.md) | ESLint | `@nuxt/eslint-config` | 188 | 1.5M | +72.8% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [typescript/no-extraneous-class](https://lintradar.dev/rules/typescript/no-extraneous-class.md): Disallow classes used as namespaces
- [typescript/no-invalid-void-type](https://lintradar.dev/rules/typescript/no-invalid-void-type.md): Disallow `void` type outside of generic or return types
- [typescript/adjacent-overload-signatures](https://lintradar.dev/rules/typescript/adjacent-overload-signatures.md): Require that function overload signatures be consecutive
- [typescript/prefer-function-type](https://lintradar.dev/rules/typescript/prefer-function-type.md): Enforce using function types instead of interfaces with call signatures
- [typescript/no-misused-promises](https://lintradar.dev/rules/typescript/no-misused-promises.md): Disallow Promises in places not designed to handle them
- [typescript/no-unnecessary-type-assertion](https://lintradar.dev/rules/typescript/no-unnecessary-type-assertion.md): Disallow type assertions that do not change the type of an expression

---

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