react/compiler/packages/eslint-plugin-react-compiler/__tests__
Lauren Tan cf7d895db6 [compiler:eslint] Fix false positive with TS type param syntax
Previously we would attempt to parse code in the eslint plugin with the
HermesParser first as it can handle some TS syntax. However, this was
leading to a mis-parse of React hook calls with type params (eg,
`useRef<null>()` as a BinaryExpression rather than a CallExpression with
a type param. This triggered our validation that Hooks should not be
used as normal values.

To fix this, we now try to parse with the babel parser (with TS support)
for filenames that end with ts/tsx, and fallback to HermesParser for
regular JS files.

ghstack-source-id: 5b7231031c
Pull Request resolved: https://github.com/facebook/react/pull/29081
2024-05-15 15:44:21 -07:00
..
ReactCompilerRule-test.ts Allow eslint rule reportable severity to be set 2024-05-06 20:07:36 -04:00
ReactCompilerRuleTypescript-test.ts [compiler:eslint] Fix false positive with TS type param syntax 2024-05-15 15:44:21 -07:00