Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eslint-plugin): [no-extraneous-class] handle abstract members #9367

Merged
merged 7 commits into from
Jun 22, 2024

Conversation

yoshi2no
Copy link
Contributor

PR Checklist

Overview

Description
This PR addresses an issue with the @typescript-eslint/no-extraneous-class rule where abstract fields and methods were not being counted as instance properties. The rule implementation was missing the handling of abstract members, which have different AST nodes compared to their concrete counterparts. This fix ensures that abstract fields and methods are correctly recognized as instance properties.

Changes

  • Updated the no-extraneous-class rule to account for TSAbstractMethodDefinition and TSAbstractPropertyDefinition nodes.
  • Added tests to cover scenarios with abstract classes containing abstract members.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @yoshi2no!

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.

Copy link

netlify bot commented Jun 16, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 66770d2
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/66731d9c0bbda10008c32e2a
😎 Deploy Preview https://deploy-preview-9367--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: 97 (🔴 down 1 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (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 site configuration.

Copy link

nx-cloud bot commented Jun 16, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 66770d2. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@yoshi2no yoshi2no changed the title fix(eslint-plugin): handle abstract members in no-extraneous-class rule fix(eslint-plugin): [no-extraneous-class] handle abstract members Jun 16, 2024
Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

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

@yoshi2no

Congrats on a great first PR to typescript-eslint!

AFAICT, everything that you have so far is perfect! The changes requested are just for a few finishing touches 🙂 Only blocker for me is the request around testing.

Thanks!

@kirkwaiblinger kirkwaiblinger added bug Something isn't working awaiting response Issues waiting for a reply from the OP or another party labels Jun 16, 2024
@Josh-Cena
Copy link
Member

Also, TIL that static abstract is not legal. Maybe we should have this as a comment.

@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Jun 19, 2024
Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

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

Great stuff! Just one nit remaining

@@ -44,6 +44,10 @@ class HelloWorldLogger {
}
```

```ts
Copy link
Member

Choose a reason for hiding this comment

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

nit - please include these in the preceeding tabs, rather than making a new one

@kirkwaiblinger
Copy link
Member

FYI - to fix the CI failure, you'll need to update the docs snapshots. See https://typescript-eslint.io/contributing/local-development#rule-development

@yoshi2no
Copy link
Contributor Author

FYI - to fix the CI failure, you'll need to update the docs snapshots. See https://typescript-eslint.io/contributing/local-development#rule-development

Oops, I missed that. Thanks!

Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

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

Great work! 🚀

tusken raider celebrates

Marking "1 approval" for now, for another team member to take a pass as well before merging

Copy link
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.

Yay!

@JoshuaKGoldberg JoshuaKGoldberg merged commit e47123d into typescript-eslint:main Jun 22, 2024
62 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: no-extraneous-class triggered on abstract class that does not contain any static methods
4 participants