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
New: add rule default-param-last (fixes #11361) #12188
Conversation
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 rule already LGTM! There are two small typos, and it would be good to have a few more tests.
Good catch! |
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.
Thank you! An additional note for one test case, everything else LGTM!
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!
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 in general, just a couple of suggestions.
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.
One request: can we add some tests with default values and destructured parameters?
const f = ({ a } = {}, b) => {};
const f = ({ a, b } = { a: 1, b: 2 }, c) => {};
const f = ([a] = [], b) => {};
const f = ([a, b] = [1, 2], c) => {};
Otherwise, this LGTM!
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!
Thanks for the suggestions! |
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!
hey @golopot I am looking to use this rule.. can we merge this pls? |
Hi @nitinsh99, I've gone ahead and merged this since multiple team members have reviewed and all questions were addressed. That said, this will be available with our next release, currently scheduled for next weekend. Thanks for your patience! |
closes #11361.
What is the purpose of this pull request? (put an "X" next to item)
X [ ] New rule (template)
Please describe what the rule should do:
Enforce default params to be last. Only es6 default params are dealt with.
What category of rule is this? (place an "X" next to just one item)
[ ] Enforces code style
[ ] Warns about a potential error
X [ ] Suggests an alternate way of doing something
[ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
Why should this rule be included in ESLint (instead of a plugin)?
See the accepted proposal #11361.
What changes did you make? (Give an overview)
Add a new rule.
Is there anything you'd like reviewers to focus on?
Yes.