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

no-unneeded-ternary with arrow function results in parsing error #1266

Closed
noisyscanner opened this issue Mar 28, 2019 · 5 comments

Comments

@noisyscanner
Copy link

commented Mar 28, 2019

What version of standard?
12.0.1
What operating system, Node.js, and npm version?
⬢ 8.11.2 📦 5.6.0

Using the no-unneeded-ternary rule.
When formatting code that is using a ternary like below, the function is not wrapped, causing a parse error and fails.

const foo = true
const bar = foo ? foo : () => {}

Causes this error

  2:21  error  Parsing error: Unexpected token

  1 | const foo = true
> 2 | const bar = foo || () => {}
    |                     ^
  3 |

✖ 1 problem (1 error, 0 warnings)

EXPECTED

const bar = foo || (() => {})
@LinusU

This comment has been minimized.

Copy link
Member

commented Apr 2, 2019

Could you report this upstream to eslint and link that issue here? Thanks

@noisyscanner

This comment has been minimized.

Copy link
Author

commented Apr 2, 2019

Opened bug report in eslint repo
eslint/eslint#11579

@LinusU

This comment has been minimized.

Copy link
Member

commented Apr 3, 2019

That's great, thanks!

@stale

This comment has been minimized.

Copy link

commented Jul 2, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Jul 2, 2019

@LinusU

This comment has been minimized.

Copy link
Member

commented Jul 9, 2019

This is fixed upstream and should be fixed in Standard 13, install with npm install standard@next

@LinusU LinusU closed this Jul 9, 2019

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