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): replace auto-fix of class literal property style rule with suggestion #7054

Conversation

Melandra
Copy link
Contributor

@Melandra Melandra commented May 23, 2023

PR Checklist

Overview

This PR changes the fixer for the class literal property style rule in the eslint-plugin package from an autofixer to a suggestion fixer.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Melandra!

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 May 23, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 8fdefa1
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/64ab0bfc771b4e000877943b
😎 Deploy Preview https://deploy-preview-7054--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Merging #7054 (ba8be5b) into main (5166a00) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head ba8be5b differs from pull request most recent head 8fdefa1. Consider uploading reports for the commit 8fdefa1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7054      +/-   ##
==========================================
+ Coverage   87.38%   87.41%   +0.02%     
==========================================
  Files         386      386              
  Lines       13193    13216      +23     
  Branches     3867     3879      +12     
==========================================
+ Hits        11529    11553      +24     
+ Misses       1298     1296       -2     
- Partials      366      367       +1     
Flag Coverage Δ
unittest 87.41% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...t-plugin/src/rules/class-literal-property-style.ts 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

@Melandra Melandra marked this pull request as ready for review May 23, 2023 18:52
messages: {
preferFieldStyle: 'Literals should be exposed using readonly fields.',
preferFieldStyleSuggestion:
'Try replacing the literals with readonly fields.',
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 wasn't sure what messaging to use here, I'm open for other suggestions 🙂

Copy link
Member

Choose a reason for hiding this comment

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

Ah yeah these can be tricky. Searching around other rules that have hasSuggestions: true, we normally go with language like "Do X with Y". Here I think that'd be:

- 'Try replacing the literals with readonly fields.'
+ 'Replace the literals with readonly fields.'

What do you think about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that sounds good, I've updated both suggestion messages.

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.

🙌 The code looks great - love a clean swap like this one!

Just requesting changes to suggest a change to the text, as you brought up. Thoughts?

If you're happy with the suggestion or have one of your own then ✅ we can merge!

(sorry for the delay in reviewing - we've been focusing on v6...)

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Jul 8, 2023
@Melandra
Copy link
Contributor Author

Melandra commented Jul 9, 2023

No worries 🙂
I've update the messages as you proposed.

@JoshuaKGoldberg JoshuaKGoldberg removed the awaiting response Issues waiting for a reply from the OP or another party label Jul 9, 2023
JoshuaKGoldberg
JoshuaKGoldberg previously approved these changes Jul 9, 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.

🙌 Super, thanks @Melandra!

Yay balloon with confetti

@JoshuaKGoldberg JoshuaKGoldberg merged commit a8c824a into typescript-eslint:main Jul 9, 2023
37 of 39 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: [class-literal-property-style] The overridden literal getter does not pass lint and incorrectly auto-fix
2 participants