New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flow type triggers space-infix-ops error #5211
Comments
@danez Thanks for the issue! If you're reporting a bug, please be sure to include:
Requesting a new rule? Please see Proposing a New Rule for instructions. |
This rule was create for JavaScript and it rightly assumes that there shouldn't be anything between left and right sides of an |
I've been trying to get some standardization on where type annotations go in the tree, and I think I'm close. If it can be hammered down, we can add an exception. |
This is being tracked on babel/babel-eslint#226 too. |
There's some standardization now. The |
I would work on creating a PR for this now, but I'm not sure how to test it, as espree doesn't support any typeannotation when parsing. Is there a way to workaround this? Or should i create the test in babel-eslint or include babel-eslint as devDependency? |
I think if you include |
Thank you so much. |
I know that eslint is not supporting flow types, but it seems that the space-infix-ops rule is assuming that between
left
andright
side of anExpressionPattern
, there is only onPunctation
which in the case of flow type is not true.(https://github.com/eslint/eslint/blob/master/lib/rules/space-infix-ops.js#L32)
example:
triggers:
What would be a proper way to fix this? I think this is something in the rule itself should be accounted for and it should ignore anything which belongs to left or right side instead of treating it as "something between left and right".
refs babel/babel-eslint#226
eslint version: 1.10.3
The text was updated successfully, but these errors were encountered: