You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a current workaround is to either use the namespace e.g. CodegenTypes.Double everywhere
or rename your type alias to e.g. type _Double = CodegenTypes.Double for now
isolates this to codegen flow parser (not the ts one)
i.e. packages\react-native-codegen\src\parsers\flow\parser.js
it looks like getResolvedTypeAnnotation (called in RNFlowParser/RNModuleParser/RNParserCommons)
is looping infinitely in the for loop so we need to break on circular type aliases
by monkey patching node_modules\@react-native\codegen\lib\parsers\flow\parser.js
managed to get it working so can propose a fix for the flow parser
it looks like it also happens with the ts parser, so can follow-up with a similar (if not the same) fix there too
Description
For libs using ESLint plugin
@react-native/eslint-plugin-specsrule@react-native/specs/react-native-moduleswhen a type alias name matches the RHS, e.g.
ESLint never finishes (the Node process hangs)
a current workaround is to either use the namespace e.g.
CodegenTypes.Doubleeverywhereor rename your type alias to e.g.
type _Double = CodegenTypes.Doublefor nowe.g. appandflow/react-native-safe-area-context#744 (review)
seems like the AST is being parsed like
type Double = CodegenTypes.Double→ resolves toDouble→ finds same alias → loopsdigging deeper
react-native/packages/eslint-plugin-specs/react-native-modules.js
Line 37 in d07bd6f
react-native/packages/eslint-plugin-specs/react-native-modules.js
Line 75 in 704c2b1
isolates this to codegen flow parser (not the ts one)
i.e.
packages\react-native-codegen\src\parsers\flow\parser.jsit looks like
getResolvedTypeAnnotation(called in RNFlowParser/RNModuleParser/RNParserCommons)is looping infinitely in the
forloop so we need to break on circular type aliasesby monkey patching
node_modules\@react-native\codegen\lib\parsers\flow\parser.jsmanaged to get it working so can propose a fix for the flow parser
it looks like it also happens with the ts parser, so can follow-up with a similar (if not the same) fix there too
also tested latest stable
Steps to reproduce
yarn validate:eslintReact Native Version
0.85.3, 0.87.0, main
Affected Platforms
Build - Linux, Build - Windows, Build - MacOS
Output of
npx @react-native-community/cli infoStacktrace or Logs
MANDATORY Reproducer
appandflow/react-native-safe-area-context#744 (review)
Screenshots and Videos
No response