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

[auto fix] Bug encountered while optimizing ternary operator #866

Closed
shiye515 opened this issue Apr 24, 2017 · 5 comments

Comments

@shiye515
Copy link

commented Apr 24, 2017

before fix

var value = 'a'
var canSet = true
var result = value ? value : canSet ? 'unset' : 'can not set'

The value of result is 'a'

after fix

var value = 'a'
var canSet = true
var result = value || canSet ? 'unset' : 'can not set'

The value of result is 'unset'

@dcousens dcousens added the bug label Apr 24, 2017

@dcousens

This comment has been minimized.

Copy link
Member

commented Apr 24, 2017

Brackets!

var result = value || (canSet ? 'unset' : 'can not set')

ESLint bug it would seem.

@feross

This comment has been minimized.

Copy link
Member

commented Apr 25, 2017

Reported bug to eslint team: eslint/eslint#8507

@feross

This comment has been minimized.

Copy link
Member

commented Apr 25, 2017

Closing this issue. Further discussion should happen in the ESLint issue.

@feross feross closed this Apr 25, 2017

@saknarak

This comment has been minimized.

Copy link

commented Apr 26, 2017

I just found same case. That make me sick to find bug.

@cytGitHub

This comment has been minimized.

Copy link

commented Apr 26, 2017

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
5 participants
You can’t perform that action at this time.