Skip to content

fix(eslint-plugin): [no-extraneous-class] handle index signatures#12142

Merged
JoshuaKGoldberg merged 1 commit intotypescript-eslint:mainfrom
SeolJaeHyeok:fix/12061
Mar 30, 2026
Merged

fix(eslint-plugin): [no-extraneous-class] handle index signatures#12142
JoshuaKGoldberg merged 1 commit intotypescript-eslint:mainfrom
SeolJaeHyeok:fix/12061

Conversation

@SeolJaeHyeok
Copy link
Copy Markdown
Contributor

PR Checklist

Overview

Fixes a false positive in @typescript-eslint/no-extraneous-class for classes that only declare an index
signature.

The rule previously treated TSIndexSignature as if it didn't count as an instance member, which left the class
categorized as "only static" and reported Unexpected class with only static properties.

This change treats TSIndexSignature as a non-static class member and adds a regression test covering:

class Foo {
  [key: string]: string;
}

@typescript-eslint
Copy link
Copy Markdown
Contributor

Thanks for the PR, @SeolJaeHyeok!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 18, 2026

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 23afe9a
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/69bab599ec6a6100086dcab0
😎 Deploy Preview https://deploy-preview-12142--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (🟢 up 6 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 90 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 18, 2026

View your CI Pipeline Execution ↗ for commit 23afe9a

Command Status Duration Result
nx run-many -t lint ✅ Succeeded 2m 22s View ↗
nx run integration-tests:test ✅ Succeeded 2s View ↗
nx run types:build ✅ Succeeded 1s View ↗
nx test typescript-estree --coverage=false ✅ Succeeded 1s View ↗
nx test eslint-plugin-internal --coverage=false ✅ Succeeded 4s View ↗
nx run-many -t typecheck ✅ Succeeded 42s View ↗
nx run generate-configs ✅ Succeeded 5s View ↗
nx run-many --target=build --parallel --exclude... ✅ Succeeded 14s View ↗
Additional runs (34) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-03-18 14:30:33 UTC

Copy link
Copy Markdown
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that was straightforward. Nice! 😄

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Mar 21, 2026
@SeolJaeHyeok
Copy link
Copy Markdown
Contributor Author

Well that was straightforward. Nice! 😄

Thanks for your review😃

@JoshuaKGoldberg JoshuaKGoldberg changed the title fix(eslint-plugin): handle index signatures in no-extraneous-class fix(eslint-plugin): [no-extraneous-class] handle index signatures Mar 30, 2026
@JoshuaKGoldberg JoshuaKGoldberg merged commit edb90eb into typescript-eslint:main Mar 30, 2026
62 of 63 checks passed
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Mar 31, 2026
| datasource | package                          | from   | to     |
| ---------- | -------------------------------- | ------ | ------ |
| npm        | @typescript-eslint/eslint-plugin | 8.56.0 | 8.58.0 |
| npm        | @typescript-eslint/parser        | 8.56.0 | 8.58.0 |


## [v8.58.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8580-2026-03-30)

##### 🚀 Features

- support TypeScript 6 ([#12124](typescript-eslint/typescript-eslint#12124))

##### 🩹 Fixes

- **eslint-plugin:** \[prefer-regexp-exec] avoid fixing unknown RegExp flags ([#12161](typescript-eslint/typescript-eslint#12161))
- **eslint-plugin:** \[no-extraneous-class] handle index signatures ([#12142](typescript-eslint/typescript-eslint#12142))
- **eslint-plugin:** crash in `no-unnecessary-type-arguments` ([#12163](typescript-eslint/typescript-eslint#12163))

##### ❤️ Thank You

- ej shafran [@ej-shafran](https://github.com/ej-shafran)
- Evyatar Daud [@StyleShit](https://github.com/StyleShit)
- GG ZIBLAKING
- milkboy2564 [@SeolJaeHyeok](https://github.com/SeolJaeHyeok)
- teee32 [@teee32](https://github.com/teee32)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.58.0) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.57.2](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8572-2026-03-23)

##### 🩹 Fixes

- **eslint-plugin:** \[prefer-readonly-parameter-types] preserve type alias infomation ([#11954](typescript-eslint/typescript-eslint#11954))
- **eslint-plugin:** \[no-useless-default-assignment] skip reporting false positives for unresolved type parameters ([#12127](typescript-eslint/typescript-eslint#12127))
- **eslint-plugin:** \[no-unsafe-return] false positive on unwrapping generic ([#12125](typescript-eslint/typescript-eslint#12125))
- **eslint-plugin:** \[no-restricted-types] flag banned generics in extends or implements ([#12120](typescript-eslint/typescript-eslint#12120))
- **eslint-plugin:** \[array-type] ignore Array and ReadonlyArray without type arguments ([#11971](typescript-eslint/typescript-eslint#11971))
- **eslint-plugin:** \[prefer-optional-chain] remove dangling closing parenthesis ([#11865](typescript-eslint/typescript-eslint#11865))

##### ❤️ Thank You

- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)
- Konv Suu
- mdm317
- Newton Yuan [@NewtonYuan](https://github.com/NewtonYuan)
- SungHyun627 [@SungHyun627](https://github.com/SungHyun627)
- Tamashoo [@Tamashoo](https://github.com/Tamashoo)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.57.2) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.57.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8571-2026-03-16)

##### 🩹 Fixes

- **eslint-plugin:** \[prefer-optional-chain] no report for property on intersection type ([#12126](typescript-eslint/typescript-eslint#12126))

##### ❤️ Thank You

- Newton Yuan [@NewtonYuan](https://github.com/NewtonYuan)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.57.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.57.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8570-2026-03-09)

##### 🚀 Features

- **eslint-plugin:** \[no-unnecessary-condition] allow literal loop conditions in for/do loops ([#12080](typescript-eslint/typescript-eslint#12080))

##### 🩹 Fixes

- **eslint-plugin:** \[no-base-to-string] fix false positive for toString with overloads ([#12089](typescript-eslint/typescript-eslint#12089))
- **eslint-plugin:** \[prefer-promise-reject-errors] add allow `TypeOrValueSpecifier` to prefer-promise-reject-errors ([#12094](typescript-eslint/typescript-eslint#12094))
- **typescript-estree:** if the template literal is tagged and the text has an invalid escape, `cooked` will be `null` ([#11355](typescript-eslint/typescript-eslint#11355))
- **eslint-plugin:** guard against negative paramIndex in no-useless-default-assignment ([#12077](typescript-eslint/typescript-eslint#12077))
- **eslint-plugin:** handle statically analyzable computed keys in prefer-readonly ([#12079](typescript-eslint/typescript-eslint#12079))
- **eslint-plugin:** \[strict-void-return] false positives with overloads ([#12055](typescript-eslint/typescript-eslint#12055))

##### ❤️ Thank You

- Brad Zacher [@bradzacher](https://github.com/bradzacher)
- Brian Schlenker [@bschlenk](https://github.com/bschlenk)
- Evyatar Daud [@StyleShit](https://github.com/StyleShit)
- James Henry [@JamesHenry](https://github.com/JamesHenry)
- Josh Goldberg
- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)
- Moses Odutusin [@thebolarin](https://github.com/thebolarin)
- Newton Yuan [@NewtonYuan](https://github.com/NewtonYuan)
- SungHyun627 [@SungHyun627](https://github.com/SungHyun627)
- Younsang Na [@nayounsang](https://github.com/nayounsang)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.57.0) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.56.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8561-2026-02-23)

This was a version bump only for eslint-plugin to align it with other projects, there were no code changes.

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.56.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: [no-extraneous-class] false positive on classes with only index signatures

2 participants