# no-extraneous-class

Rule `typescript/no-extraneous-class`. Disallow classes used as namespaces

- Source: typescript
- Technologies: TypeScript
- Kind: suspicious
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 76.6M weekly downloads of presets that enable it
- Trend: +53.3% last quarter
- Rank: #226 by reach, #746 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/no-extraneous-class` | no | no | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/no-extraneous-class) |
| Oxlint | `typescript/no-extraneous-class` | no | unsafe | plugin `typescript`, category suspicious | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-extraneous-class.html) |
| Biome | `complexity/noStaticOnlyClass` | yes | no | group complexity, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-static-only-class/) |

## Code examples

### Incorrect: the rule reports this

```ts
class StaticConstants {
  static readonly version = 42;

  static isProduction() {
    return process.env.NODE_ENV === 'production';
  }
}

class HelloWorldLogger {
  constructor() {
    console.log('Hello, world!');
  }
}

abstract class Foo {}
```

```ts
export class Utilities {
  static util1() {
    return Utilities.util3();
  }

  static util2() {
    /* ... */
  }

  static util3() {
    /* ... */
  }
}
```

```ts
// utilities.ts
export class Utilities {
  static sayHello() {
    console.log('Hello, world!');
  }
}

// consumers.ts
import { Utilities } from './utilities';

Utilities.sayHello();
```

### Correct: the rule accepts this

```ts
export const version = 42;

export function isProduction() {
  return process.env.NODE_ENV === 'production';
}

function logHelloWorld() {
  console.log('Hello, world!');
}

abstract class Foo {
  abstract prop: string;
}
```

```ts
export function util1() {
  return util3();
}

export function util2() {
  /* ... */
}

export function util3() {
  /* ... */
}
```

```ts
// utilities.ts
export function sayHello() {
  console.log('Hello, world!');
}

// consumers.ts
import { sayHello } from './utilities';

sayHello();
```

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/no-extraneous-class": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/no-extraneous-class": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "complexity": {
        "noStaticOnlyClass": "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% |
| [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/prefer-literal-enum-member](https://lintradar.dev/rules/typescript/prefer-literal-enum-member.md): Require all enum members to be literal values
- [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/no-extraneous-class. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
