Repository: react-native
Issue: React Native 0.76.3 Eslint Parser Issue with Flow
Labels: Flow,Needs: Repro,Needs: Attention

### Description

I have recently migrated the app to 0.76.3 following the upgrade helper and also upgraded `@react-native/babel-preset` which has resulted in eslint parsing error for flow typed files.

### Steps to reproduce

Using latest react native 0.76.3 with @react-native/babel-preset version 0.76.3, add some flow files.
Run `yarn eslint`

### React Native Version

0.76.3

### Affected Platforms

Other (please specify)

### Output of `npx react-native info`

```text
System:
  OS: macOS 15.0.1
  CPU: (12) arm64 Apple M2 Pro
  Memory: 502.45 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.5
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.2
    path: /usr/local/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/ravindragupta/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-26 | ARM 64 v8a
      - android-26 | Google APIs ARM 64 v8a
      - android-28 | Google ARM64-V8a Play ARM 64 v8a
      - android-30 | Google APIs ARM 64 v8a
      - android-30 | Google Play ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12483815
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 3.0.4
    path: /Users/ravindragupta/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.3
    wanted: 0.76.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: false
```


### Stacktrace or Logs

```text
Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/services/syncData/checkConnection.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/oauth.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/services/syncData/checkConnection.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/types.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/types.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/actions/saveUtils.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/records.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/types.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/urlRoute.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/types.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/records.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/actions/saveUtils.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/components/helpers/listField.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/oauth.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/services/syncData/checkConnection.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/urlRoute.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/BaseField.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/records.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/actions/saveUtils.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/BaseField.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/records.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/actions/saveUtils.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/BaseField.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/services/syncData/checkConnection.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/BaseField.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

Error while parsing /Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
Line undefined, column undefined: Cannot read properties of undefined (reading 'forEach')
`parseForESLint` from parser `/Users/ravindragupta/Desktop/Projects/mobilev2/native/node_modules/@babel/eslint-parser/lib/index.cjs` is invalid and will just be ignored

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/actions/popupMenu.action.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/actions/saveUtils.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/components/AnswerFields/AnswerRenderer.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/components/Detail/FieldsController.js
  178:9  warning  Invalid loop. Its body allows only one iteration  no-unreachable-loop

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/components/helpers/listField.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/BaseField.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/batch.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/batchList.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/filters.api.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/filters.operators.api.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/filters.operators.offline.api.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/metadata.api.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/oauth.api.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/offline.api.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/prefetch.api.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/prefetch.diffsync.api.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/prefetch.etags.api.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/records.api.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/types.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/api/urlRoute.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/services/realm.js
  10:1  warning  Dependency cycle detected  import/no-cycle

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/services/realmDb/RealmDbUpdates.js
  11:1  warning  Dependency cycle detected  import/no-cycle

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/services/syncData/checkConnection.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

/Users/ravindragupta/Desktop/Projects/mobilev2/native/src/mobileCore/services/syncData/syncDataWrappers.js
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'forEach')

✖ 24 problems (21 errors, 3 warnings)
```


### Reproducer

https://github.com/test

### Screenshots and Videos

<img width="1135" alt="Screenshot 2024-11-25 at 11 38 55 PM" src="https://github.com/user-attachments/assets/8f7e699c-37da-4aee-aa1e-9926750d55d7">