Skip to content

Fix: no-extra-boolean-cast invalid autofix with yield before negation#12164

Merged
btmills merged 1 commit intomasterfrom
noextrabooleancast-fixer
Aug 30, 2019
Merged

Fix: no-extra-boolean-cast invalid autofix with yield before negation#12164
btmills merged 1 commit intomasterfrom
noextrabooleancast-fixer

Conversation

@mdjermanovic
Copy link
Copy Markdown
Member

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

[X] Bug fix

Tell us about your environment

  • ESLint Version: 6.2.2
  • Node Version: 10.16.0
  • npm Version: 6.9.0

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

Configuration
module.exports = {
  parserOptions: {
    ecmaVersion: 2015,
  },
};

What did you do? Please include the actual source code causing the issue.

Demo link

/*eslint no-extra-boolean-cast: "error"*/

function *foo() {
  yield!!a ? b : c;
}

What did you expect to happen?

Fix to:

/*eslint no-extra-boolean-cast: "error"*/

function *foo() {
  yield a ? b : c;
}

What actually happened? Please include the actual, raw output from ESLint.

Fixed to:

/*eslint no-extra-boolean-cast: "error"*/

function *foo() {
  yielda ? b : c;
}

What changes did you make? (Give an overview)

Fixed the fixer to check can the tokens be adjacent.

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

Only these tests were failing, others are regression tests:

function *foo() { yield!!a ? b : c }
function *foo() { yield!! a ? b : c }
function *foo() { yield! !a ? b : c }

@eslint-deprecated eslint-deprecated Bot added the triage An ESLint team member will look at this issue soon label Aug 25, 2019
@mdjermanovic mdjermanovic added bug ESLint is working incorrectly rule Relates to ESLint's core rules labels Aug 25, 2019
Copy link
Copy Markdown
Member

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Copy Markdown
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, thanks!

@platinumazure platinumazure added accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Aug 25, 2019
@btmills btmills merged commit febb660 into master Aug 30, 2019
@mdjermanovic mdjermanovic deleted the noextrabooleancast-fixer branch August 30, 2019 21:59
@eslint-deprecated eslint-deprecated Bot locked and limited conversation to collaborators Feb 27, 2020
@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 27, 2020
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 rule Relates to ESLint's core rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants