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
Update: Add never option for new-parens (refs #10034) #11379
Conversation
@eslint/eslint-team We completely lost track of this PR, does anyone else wants to support it/champion it? |
I'll champion. Just needs one more 👍 from the team. |
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.
It would be good to have some tests explicitly using the "always"
option (to make sure they behave the same as no option).
Also left a few other suggestions.
I added a few tests for explicitly using I also fixed the comment and changed the message id and message. |
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 ESLint team still needs to accept this before merging, but the implementation looks good to me. Thanks for contributing!
@eslint/eslint-team Need just one more +1 vote for this. It's time to either accept it, or close this issue. |
Thanks for contributing to ESLint! |
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[X] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
#10034 was closed automatically for a lack of interest, I'm not sure if this functionality is wanted.
What changes did you make? (Give an overview)
Added an argument to
new-parens
for always or never. The default with no arguments keeps the same functionality. Added tests for the never option and updated documentation.Is there anything you'd like reviewers to focus on?
The fixer will always put parenthesis even when they're not required.
What rule do you want to change?
new-parens
Does this change cause the rule to produce more or fewer warnings?
No
How will the change be implemented? (New option, new default behavior, etc.)?
Adds an option for enforcing or disallowing parenthesis on constructors with no arguments using
new
. Default behavior stays the same.Please provide some example code that this change will affect:
Examples of incorrect code for this rule with the
"never"
option:Examples of correct code for this rule with the
"never"
option:What does the rule currently do for this code?
Errors because the arguments are invalid.
What will the rule do after it's changed?
The argument will no longer be invalid.