Skip to content
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 require a third argument in linter.verifyAndFix (fixes #8805) #8809

Merged
merged 1 commit into from Jun 27, 2017

Conversation

not-an-aardvark
Copy link
Member

What is the purpose of this pull request? (put an "X" next to item)

[x] Bug fix (#8805)

What changes did you make? (Give an overview)

Previously, linter.verifyAndFix would crash if no third argument was provided, because some debugging lines assumed that the argument always existed. This updates the method to make the third argument optional.

Is there anything you'd like reviewers to focus on?

Nothing in particular

Previously, `linter.verifyAndFix` would crash if no third argument was provided, because some debugging lines assumed that the argument always existed. This updates the method to make the third argument optional.
@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features labels Jun 26, 2017
@eslintbot
Copy link

LGTM

Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Should this be a patch candidate?

@not-an-aardvark
Copy link
Member Author

I don't think so, it's very minor. We can include it if we do a patch release to fix another issue though.

@gyandeeps gyandeeps merged commit a53ef7e into master Jun 27, 2017
@gyandeeps gyandeeps deleted the verify-and-fix-third-argument branch June 27, 2017 20:29
IanVS added a commit that referenced this pull request Jun 28, 2017
not-an-aardvark pushed a commit that referenced this pull request Jun 29, 2017
* 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
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants