Add parenthesis for no-confusing-arrow rule #1182

Merged
merged 1 commit into from Apr 11, 2017

Conversation

Projects
None yet
1 participant
@vjeux
Collaborator

vjeux commented Apr 11, 2017

I'm unclear whether anyone was ever confused by this but the eslint page is kind of compelling

// 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.

Add parenthesis for no-confusing-arrow rule
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.

@vjeux vjeux merged commit 2e63684 into prettier:master Apr 11, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@lydell lydell referenced this pull request in prettier/eslint-config-prettier Apr 11, 2017

Closed

Re-evaluate no-confusing-arrow #12

lydell added a commit to prettier/eslint-config-prettier that referenced this pull request Apr 18, 2017

Make no-confusing-arrow a "regular" rule
... instead of a special rule. Since prettier/prettier#1182 it is not
necessary when using prettier anymore.

Fixes #12.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment