Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* New: Allow passing a function as `fix` option (fixes #8039) * Pass fix in options, instead of separate arg * Simplify conditional logic * Return source code if shouldFix is false This way, the code that uses this doesn’t need to necessarily check the value of `fixed`. * Clarify that fixesWereApplied is always true here If we’ve gotten to this point, at least one fix will have been applied. * Add a test to ensure that fix functions are pure Meaning, that they cannot access the `this` value of SourceCodeFixer. * Add test with conditional shouldFix This is to verify that the problem can be used to return true or false conditionally, and that eslint will only apply fixes when true is returned. * Account for options not being provided This is to account for #8809
- Loading branch information
1 parent
8796d55
commit c693be5
Showing
5 changed files
with
119 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters