Flow errors on malformed package.json
I updated from Node 12 to Node 14 and now flow gives me this error:
$ repo/node_modules/.bin/flow check --max-warnings 0
| Skipping /repo/client/<PROJECT_ROOT>/flow-typed/: No such file or directory
|
| Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
| ../../../libs/tools-common/node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/resolver/malformed_package_json/package.json:2:1
|
| Unexpected end of input, expected the token }
|
| 1│ {
| 2│
|
|
My app is setup in a workspace and imports a package called /tools-common im not sure how that's causing a failure in my main app though
What's your .flowconfig look like? Flow shouldn't be checking external modules like that unless it's been explicitly told to with [include]
See also https://github.com/facebook/flow/issues/2364
We recently started to encounter this as well, I guess starting from 0.169. Never happened before.
And we have nothing under [include] actually.
@mroch Any ideas on what could be happening here?
I added:
[ignore]
.*/**/malformed_package_json/package.json
same here with flow 0.176.3 / Node 17.8.0 / CRA 5.0.1
The fix mentioned by @simkessy right above does the trick but as pointed out by @mvitousek I can't understand why flow even cares about a deep node_modules file like that 🤷