-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
[React 19] eslint-plugin-react-compiler
throws SyntaxErrors when it encounters .json
or .graphql
files
#29107
Comments
Thanks for filing this! |
Found another tricky issue, hermes parser doesn't support top-level await: |
I believe that @poteto already fixed this on the latest release — can you confirm? |
poteto
added a commit
that referenced
this issue
May 29, 2024
Eslint rules should never throw, so if we fail to parse with Babel or Hermes, we should just ignore the error. This should fix issues such as trying to run the eslint rule on non tsx|ts|jsx|js files, Hermes parser not supporting certain JS syntax, etc. Fixes #29107 ghstack-source-id: 6d114ebdbee0161d3747634aa956da3d71de39ed Pull Request resolved: #29631
poteto
added a commit
that referenced
this issue
May 29, 2024
Eslint rules should never throw, so if we fail to parse with Babel or Hermes, we should just ignore the error. This should fix issues such as trying to run the eslint rule on non tsx|ts|jsx|js files, Hermes parser not supporting certain JS syntax, etc. I didn't add a test for this as our eslint-rule-tester config uses hermes-eslint parser, so it wasn't possible to add a top level await as it would crash hermes-eslint before our rule was triggered. Similarly I couldn't add a test for non-JS files as it would not be parseable by hermes-eslint. Fixes #29107 ghstack-source-id: 6d114ebdbee0161d3747634aa956da3d71de39ed Pull Request resolved: #29631
poteto
added a commit
that referenced
this issue
May 31, 2024
Eslint rules should never throw, so if we fail to parse with Babel or Hermes, we should just ignore the error. This should fix issues such as trying to run the eslint rule on non tsx|ts|jsx|js files, Hermes parser not supporting certain JS syntax, etc. I didn't add a test for this as our eslint-rule-tester config uses hermes-eslint parser, so it wasn't possible to add a top level await as it would crash hermes-eslint before our rule was triggered. Similarly I couldn't add a test for non-JS files as it would not be parseable by hermes-eslint. Fixes #29107 ghstack-source-id: 60afcdb89ab4a8d2e4697cc50c5490803e7cbeac Pull Request resolved: #29631
github-actions bot
pushed a commit
that referenced
this issue
May 31, 2024
Eslint rules should never throw, so if we fail to parse with Babel or Hermes, we should just ignore the error. This should fix issues such as trying to run the eslint rule on non tsx|ts|jsx|js files, Hermes parser not supporting certain JS syntax, etc. I didn't add a test for this as our eslint-rule-tester config uses hermes-eslint parser, so it wasn't possible to add a top level await as it would crash hermes-eslint before our rule was triggered. Similarly I couldn't add a test for non-JS files as it would not be parseable by hermes-eslint. Fixes #29107 ghstack-source-id: 60afcdb89ab4a8d2e4697cc50c5490803e7cbeac Pull Request resolved: #29631 DiffTrain build for commit 113c8e7.
github-actions bot
pushed a commit
that referenced
this issue
May 31, 2024
Eslint rules should never throw, so if we fail to parse with Babel or Hermes, we should just ignore the error. This should fix issues such as trying to run the eslint rule on non tsx|ts|jsx|js files, Hermes parser not supporting certain JS syntax, etc. I didn't add a test for this as our eslint-rule-tester config uses hermes-eslint parser, so it wasn't possible to add a top level await as it would crash hermes-eslint before our rule was triggered. Similarly I couldn't add a test for non-JS files as it would not be parseable by hermes-eslint. Fixes #29107 ghstack-source-id: 60afcdb89ab4a8d2e4697cc50c5490803e7cbeac Pull Request resolved: #29631 DiffTrain build for [113c8e7](113c8e7)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
If your linting command encompasses
.json
or.graphql
files (e.g.eslint . package.json --ext .js,.jsx,.ts,.tsx,.graphql
), and you have react-compiler/react-compiler enabled in your rules object:Then HermesParser will throw an exception and stop linting:
This is the stack trace for the error:
The workaround to solve this right now is to disable the rule for these files using an override:
The text was updated successfully, but these errors were encountered: