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
Fix: don't autofix with linter.verifyAndFix when fix: false
is used
#9098
Conversation
Due to a bug, `linter.verifyAndFix` previously applied all autofixes when the `fix` option was set to `false`, even though the documented behavior was to apply no autofixes. This commit fixes the bug.
LGTM |
@not-an-aardvark, thanks for your PR! By analyzing the history of the files in this pull request, we identified @gyandeeps, @nzakas and @mysticatea to be potential reviewers. |
After thinking about his a little bit, I think it should always fix if you call the function |
This basically makes sense to me, but what should we do if someone passes in |
I see where you're coming from, but we already allow a filter function to be provided, so we will still end up not fixing anything if the filter is That said, I notice |
@gyandeeps @platinumazure Are you okay with this being merged as-is for now? Since the function is documented to accept a boolean, I think the current behavior is a bug. |
@not-an-aardvark I definitely agree we currently have a bug and have no real objection with merging this in. |
What is the purpose of this pull request? (put an "X" next to item)
[x] Bug fix
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
N/A
Please show your full configuration:
N/A
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
I expected no autofixes to be applied. The
fix
property specifies a filter function for fixes, and can also be set to a boolean (wheretrue
implies that all problems are fixed, andfalse
implies that no problems are fixed). However,false
currently behaves the same astrue
.What actually happened? Please include the actual, raw output from ESLint.
What changes did you make? (Give an overview)
Due to a bug,
linter.verifyAndFix
previously applied all autofixes when thefix
option was set tofalse
, even though the documented behavior was to apply no autofixes. This commit fixes the bug.This fix was also included as part of #9090 because the bug was affecting the updated behavior of
CLIEngine
. However, I decided to separate it out into a different fix because it's an independent bug.Is there anything you'd like reviewers to focus on?
Nothing in particular