# no-static-only-class

Rule `unicorn/no-static-only-class`. Disallow classes that only have static members.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 12M weekly downloads of presets that enable it
- Trend: +40.1% last quarter
- Rank: #765 by reach, #961 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/no-static-only-class` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/no-static-only-class.md) |
| Oxlint | `unicorn/no-static-only-class` | no | unsafe | plugin `unicorn`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-static-only-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

```js
class X {
  static foo = false;
  static bar() {};
}
```

### Correct: the rule accepts this

```js
const X = {
  foo: false,
  bar() {},
};
```

```js
class X {
  static foo = false;
  static bar() {}

  constructor() {}
}
```

```js
class X {
  static foo = false;
  static bar() {}

  unicorn() {}
}
```

Examples from the ESLint documentation.

## Enable it

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

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/no-static-only-class": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "unicorn/no-static-only-class": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "complexity": {
        "noStaticOnlyClass": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Unicorn unopinionated](https://lintradar.dev/presets/unicorn-unopinionated.md) | ESLint | `eslint-plugin-unicorn` | 236 | 9.5M | +30.3% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/no-negation-in-equality-check](https://lintradar.dev/rules/unicorn/no-negation-in-equality-check.md): Disallow negated expression in equality check.
- [unicorn/no-unreadable-iife](https://lintradar.dev/rules/unicorn/no-unreadable-iife.md): Disallow unreadable IIFEs.
- [unicorn/no-negated-condition](https://lintradar.dev/rules/unicorn/no-negated-condition.md): Disallow negated conditions.
- [unicorn/no-zero-fractions](https://lintradar.dev/rules/unicorn/no-zero-fractions.md): Require consistent decimal numbers without redundant zeros.
- [unicorn/filename-case](https://lintradar.dev/rules/unicorn/filename-case.md): Enforce a case style for filenames and directory names.
- [unicorn/prefer-negative-index](https://lintradar.dev/rules/unicorn/prefer-negative-index.md): Prefer negative index over `.length - index` when possible.

---

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