-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): [member-ordering] add support for getters and setters #3611
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
Conversation
Thanks for the PR, @gultyaev! 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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
Nx Cloud ReportCI ran the following commands for commit 32f0474. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
Sent with 💌 from NxCloud. |
{ | ||
code: ` | ||
class Foo { | ||
@Bar | ||
get a() {} | ||
|
||
get b() {} | ||
|
||
@Bar | ||
set c() {} | ||
|
||
set d() {} | ||
} | ||
`, | ||
options: [ | ||
{ | ||
default: { | ||
memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], | ||
order: 'alphabetically', | ||
}, | ||
}, | ||
], | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't correct, right?
your config has specified that the ordering should be get
and then decorated-get
, but the code itself has a decorated get followed by a normal get.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Don't know how I overlooked that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify - the problem was less that the test was wrong and yet it was passing fine.
Which means you haven't changed the rule correctly to handle the feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you check the code the actual test was wrong. Or at least its placement because it is in the valid section.
And checking my PR you can see updated code.
P.S. As soon as I updated the code the test started to fail which proves it right. So it was updated as well. Again because it's in the valid section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bottom line is that now it's working correctly and if I were to leave the test unchanged I'd have to move it to the invalid section and add the expected errors so to have it passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added another test exactly like it was when you commented. This time to the invalid section to prove the code works correct
Maybe we could move it to a patch rather than major version by leaving an old config which should work the same but in the meantime enable users to adopt this new option? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm - thanks for this!
…tters (#3611) * Getters/setters * Fix decorated ordering * Add test
…tters (#3611) * Getters/setters * Fix decorated ordering * Add test
Fixes #929