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
Indent rule - Reports incorrectly for function expressions containing Flowtype annotations #8990
Comments
Hi, thanks for reporting. This issue is occurring due to an invariant of regular JS which doesn't exist for Flow (namely, that the last token of an However, I think it might be possible to make the rule more robust in this case so that it handles custom syntax more gracefully. |
@not-an-aardvark Thanks for the clarification. It was my impression that Flowtype annotations were fully supported with the babel-eslint parser, though - Is that not the case? And is this actually a babel-eslint issue? |
Our policy is generally that we're fine with making core rules more robust when dealing with custom syntax in general, but we don't accept code that explicitly accounts for the semantics of a particular custom syntax. In those cases, we generally encourage people to create custom rules and get them added to eslint-plugin-babel, which has some replacements for core rules that handle some particular syntax extensions correctly. To clarify, I think this particular case might fall into the first category (making the rule more robust against custom syntax in general), which would mean we can fix it in the core rule. |
Glad I'm not the only one. |
Also having this problem. |
(Regarding Flow type annotations) That is what the eslint-plugin-flowtype plugin is for? There also is babel-plugin-transform-flow-strip-type to just strip the types (I prefer the first plugin, why not have some checks instead of just stripping the types). |
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
Neither of the above patterns to return errors.
What actually happened? Please include the actual, raw output from ESLint.
The second pattern above returned an error (for the line containing
}: State ): React.Element =>
):error Expected indentation of 2 spaces but found 0 indent
Note: This works correctly in indent-legacy
The text was updated successfully, but these errors were encountered: