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

Expected { after 'if' condition #664

Closed
fanatid opened this issue Oct 20, 2016 · 6 comments

Comments

@fanatid
Copy link

commented Oct 20, 2016

source:

var x = require('crypto').randomBytes(1)[0]
if (x % 2 === 0) console.log('hello standard')

;(() => {})()

output:

standard: Use JavaScript Standard Style (http://standardjs.com)
  /home/kirill/tmp/test/t.js:2:1: Expected { after 'if' condition.
@Flet

This comment has been minimized.

Copy link
Member

commented Oct 20, 2016

This seems like an obscure bug in the curly rule provided by eslint. It will most likely need to be opened as an issue on https://github.com/eslint/eslint and resolved there.

@fanatid

This comment has been minimized.

Copy link
Author

commented Oct 20, 2016

@Flet I know that this bug related with eslint packages, not with standard. I hoped that you open issue in right eslint repository. Thanks.

not-an-aardvark added a commit to eslint/eslint that referenced this issue Nov 1, 2016

Fix: `curly` false positive with no-semicolon style
With the `multi-line` option, `curly` should not report an error in cases like this:

```js
if (foo) bar()

;[1, 2, 3].map(foo)
```

However, it had a false positive because the semicolon before `[` is considered to be part of the same statement as `bar()`, so `curly` identified `bar()` as a multiline statement. This fixes `curly` to ignore trailing semicolons when determining whether a statement is multiline.

Originally reported here: standard/standard#664

nzakas added a commit to eslint/eslint that referenced this issue Nov 3, 2016

Fix: `curly` false positive with no-semicolon style (#7509)
With the `multi-line` option, `curly` should not report an error in cases like this:

```js
if (foo) bar()

;[1, 2, 3].map(foo)
```

However, it had a false positive because the semicolon before `[` is considered to be part of the same statement as `bar()`, so `curly` identified `bar()` as a multiline statement. This fixes `curly` to ignore trailing semicolons when determining whether a statement is multiline.

Originally reported here: standard/standard#664
@not-an-aardvark

This comment has been minimized.

Copy link

commented Nov 3, 2016

This is fixed in eslint/eslint@ea0970d.

@Flet

This comment has been minimized.

Copy link
Member

commented Nov 3, 2016

Nice! Thanks for doing this @not-an-aardvark!

Looks like we need to wait for the next eslint release (and bump the eslint dependency here).

@feross

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

@not-an-aardvark You're the best!

@feross

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

I'm working on a release to update the ESLint dependency. Closing.

@feross feross closed this Nov 23, 2016

@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.
4 participants
You can’t perform that action at this time.