implicit-arrow-linebreak autofixer sometimes adds extra characters
See original GitHub issueTell us about your environment
- ESLint Version: 5.12.0
- Node Version: 10.15.0
- npm Version: 6.4.1
What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint
(but i dont believe it matters)
Configuration
{
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module"
},
"env": {
"node": true
},
"rules": {
"implicit-arrow-linebreak": "error"
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
start()
.then(() =>
/* If I put a comment here, eslint --fix breaks badly */
process && typeof process.send === 'function' && process.send('ready')
)
.catch(err => {
/* catch seems to be needed here */
console.log('Error: ', err)
})
eslint --fix
What did you expect to happen?
Code that it “fixes” should not be invalid javascript
What actually happened? Please include the actual, raw output from ESLint.
It creates broken code
start()
.then(() => (
/* If I put a comment here, eslint --fix breaks badly */
process && typeof process.send === 'function' && process.send('ready')
)
)
)
.catch(err => ( {
/* catch seems to be needed here */
console.log('Error: ', err)
})
Notice that it broke the catch as it seems to assume its an implicit object return
Are you willing to submit a pull request to fix this bug?
not really, wouldnt know where to start
This can get REALLY bad and is especially an issue since its part of eslint-config-airbnb
, granted this file is crazy, but the bug ends up filling the entire file up with thousands of invalid lines
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
I’ll look into this.
another falling case:
=>