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
Fix: prevent space-before-function-paren from checking type annotations #8349
Fix: prevent space-before-function-paren from checking type annotations #8349
Conversation
Previously, the space-before-function-paren rule's listener would be triggered for custom nodes such as `FunctionTypeAnnotation`, and would throw an error. This broke the regression build. This commit updates the rule to only listen for known function nodes.
@not-an-aardvark, thanks for your PR! By analyzing the history of the files in this pull request, we identified @btmills, @nzakas and @alberto to be potential reviewers. |
LGTM |
I think at some point we need to figure out a better way to test those changes. Those fixtures are huge. |
We could add babel-eslint as a devDependency for testing and have it handle the parsing on its own. |
@@ -0,0 +1,525 @@ | |||
"use strict"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but would it make sense to name the folder tests/fixtures/parsers/babel/
instead? Or maybe we could clean up/re-organize the fixtures/parsers/
folder in a separate PR. I think it's a bit confusing now where to put parser fixtures.. related: https://github.com/eslint/eslint/pull/8297/files#diff-824f19921586246afb6f381021c34222
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I moved the fixture. I agree with reorganizing the folder in a separate PR.
LGTM |
What is the purpose of this pull request? (put an "X" next to item)
[x] Bug fix
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint
Please show your full configuration:
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
I expected ESLint to not crash.
What actually happened? Please include the actual, raw output from ESLint.
ESLint crashed.
This was working in 3.18.0, but it broke due to 9b509ce.
What changes did you make? (Give an overview)
Previously, the space-before-function-paren rule's listener would be triggered for custom nodes such as
FunctionTypeAnnotation
, and would throw an error. This broke the regression build. This commit updates the rule to only listen for known function nodes.Is there anything you'd like reviewers to focus on?
Nothing in particular