# no-unused-private-class-members

Rule `typescript/no-unused-private-class-members`. Disallow unused private class members

- Source: typescript
- Technologies: TypeScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 584.7K weekly downloads of presets that enable it
- Trend: +4.8% last quarter
- Rank: #1613 by reach, #1522 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/no-unused-private-class-members` | no | no | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/no-unused-private-class-members) |

## Code examples

### Incorrect: the rule reports this

```ts
class A {
  private foo = 123;
}
```

```ts
    const prop = a.prop;
  }
}
```

```ts
console.log(foo['prop']);
```

### Correct: the rule accepts this

```tsx
class A {
  private foo = 123;

  constructor() {
    console.log(this.foo);
  }
}
```

```ts
const prop = this.prop;
```

```ts
  const otherProp = a.prop;
}

method2(a: T) {
```

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-unused-private-class-members": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [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

- [eslint/no-unused-private-class-members](https://lintradar.dev/rules/eslint/no-unused-private-class-members.md): Disallow unused private class members
- [typescript/explicit-function-return-type](https://lintradar.dev/rules/typescript/explicit-function-return-type.md): Require explicit return types on functions and class methods
- [typescript/max-params](https://lintradar.dev/rules/typescript/max-params.md): Enforce a maximum number of parameters in function definitions
- [typescript/no-magic-numbers](https://lintradar.dev/rules/typescript/no-magic-numbers.md): Disallow magic numbers
- [typescript/prefer-destructuring](https://lintradar.dev/rules/typescript/prefer-destructuring.md): Require destructuring from arrays and/or objects
- [typescript/class-methods-use-this](https://lintradar.dev/rules/typescript/class-methods-use-this.md): Enforce that class methods utilize `this`

---

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