New: add rule default-param-last (fixes #11361)#12188
New: add rule default-param-last (fixes #11361)#12188platinumazure merged 7 commits intoeslint:masterfrom chiawendt:default-param-last
Conversation
mdjermanovic
left a comment
There was a problem hiding this comment.
The rule already LGTM! There are two small typos, and it would be good to have a few more tests.
|
Good catch! |
mdjermanovic
left a comment
There was a problem hiding this comment.
Thank you! An additional note for one test case, everything else LGTM!
platinumazure
left a comment
There was a problem hiding this comment.
LGTM in general, just a couple of suggestions.
kaicataldo
left a comment
There was a problem hiding this comment.
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!
|
Thanks for the suggestions! |
|
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.