I'm unclear whether anyone was ever confused by this but the eslint page is kind of compelling
```js
// The intent is not clear
var x = a => 1 ? 2 : 3;
// Did the author mean this
var x = function (a) { return 1 ? 2 : 3 };
// Or this
var x = a <= 1 ? 2 : 3;
```
Adding a parenthesis makes it valid with `{"allowParens": true}` rule. Note that if this option is not enabled, the code would not pass lint in the first place.
4 lines
70 B
JavaScript
4 lines
70 B
JavaScript
// no-confusing-arrow
|
|
var x = a => 1 ? 2 : 3;
|
|
var x = a <= 1 ? 2 : 3;
|