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 fix for "no-confusing-arrow" rule #8347
Update: add fix for "no-confusing-arrow" rule #8347
Conversation
@tikotzky, thanks for your PR! By analyzing the history of the files in this pull request, we identified @vitorbal, @lukekarrys and @mysticatea to be potential reviewers. |
LGTM |
8a2a502
to
e77c0db
Compare
LGTM |
Hi @tikotzky, thanks for your PR! Returning undefined from a fixer function is okay. |
Thanks for the info. Also, I was not able to find how/where to add tests for the fixer functions. If you give a pointer i'd be glad to add some tests. |
@tikotzky We usually just use Thanks for the note about fixer tests. Here's what you need to know:
By the way, I wanted to mention that we have a process for accepting enhancements, so definitely feel free to wait until the issue is marked "accepted" if you want (to avoid possibly wasting your time if we don't accept the issue). That said, having an implementation and tests can also help persuade the team to accept an issue, so there's an incentive to finish up as well. Go figure! 😜 @eslint/eslint-team This seems like a pretty simple autofix enhancement request (only autofixing a very simple case under specific options). Anyone want to support this? I'll champion. |
It is documented here, but I think the documentation for |
e77c0db
to
606cad9
Compare
LGTM |
thanks @platinumazure, I am aware of the process. Adding tests looks easy (and fun 😄) so I gave it a shot. |
Awesome work @tikotzky. Just one thing-- as of ESLint 3.17.0, you can now use Thanks for augmenting the test cases! |
606cad9
to
d221dce
Compare
LGTM |
yup I agree 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.
LGTM, thanks for the PR! Sorry for not reviewing this sooner. Hopefully we can merge this as soon as the PR is accepted.
Adding "do not merge" until this accepted. PR looks good from an implementation standpoint, though! |
Now we have enough support to accept this, so I've labeled accordingly. @eslint/eslint-team I'd love a second set of eyes on this just to be sure all looks well, can someone else review? |
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.
Please update the docs for this rule for the fix functionality.
@gyandeeps It's not necessary to manually add the header line anymore because it's autogenerated from metadata. |
@gyandeeps @not-an-aardvark Do we still want a note about the limited nature of the auto-fix somewhere? |
Opps you right @not-an-aardvark . But i think its good to have a note for its limited nature. |
LGTM. 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)
[ ] Changes an existing rule (template)
[X] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Added a fix function to
no-confusing-arrow
which will auto wrap an arrow function body ifallowParens
is set to true.Is there anything you'd like reviewers to focus on?
I'm doing an early return from the
fix
ifallowParens
not enabled, can you please advise if it acceptable to returnundefined
from thefix
function in such a case.(my testing seems to indicate that its fine, just wanted to double check)