Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

arrow-parens incompatible with flowtype #55

Closed
camjackson opened this issue Mar 13, 2016 · 4 comments
Closed

arrow-parens incompatible with flowtype #55

camjackson opened this issue Mar 13, 2016 · 4 comments

Comments

@camjackson
Copy link

Not sure if this is the right repo for this issue, happy to go complain elsewhere :)

I'm running arrow-parens as-needed, but I'm also using flowtype. eslint complains that the parens are unnecessary on this type-annotated, single-parameter arrow function

const fn = (a: number) => {
  console.log(a);
};

I tried removing the parens, but that seems to be invalid syntax, as everything breaks at that point.

@hzoo
Copy link
Member

hzoo commented Mar 17, 2016

This should of been covered by https://github.com/babel/eslint-plugin-babel/pull/44/files?

@aaron-harvey
Copy link

aaron-harvey commented Sep 15, 2016

I'm also facing a similar issue with flowtype annotations on arrow functions.

// arrow-parens": [2, "as-needed", { "requireForBlockBody": true }],
const bar = (foo: FooType) => ({});
// "Unexpected parentheses around single function arg..."

I've had to disable the rule for now.

EDIT: replacing with "babel/arrow-parens" resolved the issue.

@matteocng
Copy link

@aaron-harvey the following .eslintrc configuration works for me with eslint-plugin-babel@3.30

...
"rules":
{
"arrow-parens": 0,
"babel/arrow-parens": 1
}
...

@aaron-harvey
Copy link

@matteocng I completely missed the fact it was a default eslint rule vs babel rule. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants