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): [class-methods-use-this] detect a problematic case for private/protected members if ignoreClassesThatImplementAnInterface is set #7705

Conversation

tetsuharuohzeki
Copy link
Contributor

@tetsuharuohzeki tetsuharuohzeki commented Sep 30, 2023

PR Checklist

Overview

This fixes #7704.

TypeScript's interface feature does not have any private/protected member as a part of it.

So the rule class-methods-use-this enabling ignoreClassesThatImplementAnInterface=true should warn the case of that the implementation is not a part of interface.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @tetsuharuohzeki!

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

netlify bot commented Sep 30, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit be7c886
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/6557ebe495ba9600084d121a
😎 Deploy Preview https://deploy-preview-7705--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: 90 (🔴 down 8 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (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.

@tetsuharuohzeki tetsuharuohzeki marked this pull request as ready for review September 30, 2023 05:27
@JoshuaKGoldberg
Copy link
Member

Converting to draft since the linked issue hasn't been accepted yet. Let's continue conversation there.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft October 19, 2023 15:53
@tetsuharuohzeki tetsuharuohzeki force-pushed the fix-7704-class-methods-use-this branch 2 times, most recently from 80b3efe to 3625d70 Compare October 24, 2023 21:26
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review November 17, 2023 18:06
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.

OK! This looks great to me - just one docs suggestion from me. What do you think @tetsuharuohzeki?

Thanks for waiting btw - I'm excited about this option!

Comment on lines 55 to 56
| 'public-fields'
/** Ignore classes that specifically implement some interface */
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, this looks a little off... outside the scope of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to remove its comment but I seem nx run eslint-plugin:test generate it...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to add more descriptions but it cannot remove extra comments.
7390468

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think this is just something odd in the repository, separate from your changes. No worries. Thanks for trying though!

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready label Nov 17, 2023
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.

Swell, thanks!

@JoshuaKGoldberg
Copy link
Member

I introduced a merge conflict on main and can fix it :)

@tetsuharuohzeki tetsuharuohzeki changed the title fix(eslint-plugin): [class-methods-use-this] detect a problematic case for private/protected members if ignoreClassesThatImplementAnInterface is true fix(eslint-plugin): [class-methods-use-this] detect a problematic case for private/protected members if ignoreClassesThatImplementAnInterface is set Nov 17, 2023
@tetsuharuohzeki
Copy link
Contributor Author

@JoshuaKGoldberg

Thank you for your review! I rebase my change sets on the latest main!

@JoshuaKGoldberg
Copy link
Member

Amazing, thanks! Saved me a bit of time wrestling with it locally. 🙂

@JoshuaKGoldberg JoshuaKGoldberg merged commit 155aa1f into typescript-eslint:main Nov 17, 2023
43 of 45 checks passed
@tetsuharuohzeki tetsuharuohzeki deleted the fix-7704-class-methods-use-this branch November 17, 2023 23:02
@tetsuharuohzeki
Copy link
Contributor Author

@JoshuaKGoldberg Thank you for accepting my patch.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready
Projects
None yet
2 participants