-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
Tell us about your environment
- ESLint Version: 6.5.1
- Node Version: 12.11.0
- npm Version: 6.11.3
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
{
"rules": {
"curly": [2, "multi-or-nest"]
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
I used the following code in file.js
:
if (true) console.log('some statement')
;(function () {})()
The issue occurs whenever the statement in the if block (or any block) has the semicolon on the following line.
Then I linted it:
eslint file.js
What did you expect to happen?
No error would occur as there is only 1 statement in the if block.
What actually happened? Please include the actual, raw output from ESLint.
I got the following error:
file.js
1:1 error Expected { after 'if' condition curly
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
When fixing it with eslint --fix file.js
, it gets changed to
if (true) {console.log('some statement')
;}(function () {})()
which conflicts with the "semi": [2, "never"]
rule as that would change it to:
if (true) {console.log('some statement')
}(function () {})()
which would cause curly
to report Unnecessary { after 'if' condition
.
Are you willing to submit a pull request to fix this bug?
Yes.