Skip to content
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

intentionally malformed package.json fixture in tests breaks flowtype when checking node_modules #262

Closed
paritosh-yadav opened this issue Jan 4, 2022 · 9 comments

Comments

@paritosh-yadav
Copy link

Steps to regenerate:-

  • npm install resolve
  • run flow command

flow output:-

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/resolve/test/resolver/malformed_package_json/package.json:2:1 Unexpected end of input, expected the token }

 1│ {
 2│

@ljharb, Kindly respond. Thank you

@ljharb
Copy link
Member

ljharb commented Jan 4, 2022

Why is flow checking node_modules?

@TrySound
Copy link

TrySound commented Jan 4, 2022

To collect published types. It finds package.json to check for entry point and cannot parse it. Why tests are published anyway? Do they or ci configs have any use in node_modules?

@ljharb
Copy link
Member

ljharb commented Jan 4, 2022

@TrySound Tests are published in all my packages because npm explore foo && npm install && npm test should always work.

@ljharb
Copy link
Member

ljharb commented Jan 4, 2022

It seems like a bug should be filed on flow so that it doesn't fail when it encounters invalid JSON, especially inside node_modules. Please link to it here when that’s filed.

@ljharb ljharb changed the title Flow type checking error intentionally malformed package.json fixture in tests breaks flowtype when checking node_modules Jan 5, 2022
@paritosh-yadav
Copy link
Author

Hi @ljharb ,

I have ignored the lib in flow config. Previously ignoring lib isn't working, but now it is.

@ljharb
Copy link
Member

ljharb commented Jan 5, 2022

I'd still suggest filing a bug on flow itself, so that by default it doesn't crash on this case.

Closing, since the only issue I know about here is caused by flow, and ignoring the file in flow config works. Happy to reopen if a different scenario is causing problems.

@ljharb ljharb closed this as completed Jan 5, 2022
@jacksontims123
Copy link

So you can ignore when problems arise in flow?

@ljharb
Copy link
Member

ljharb commented Jan 5, 2022

@jacksontims123 i closed this under the assumption that #262 (comment) means you can indeed ignore that file path, and flow will avoid crashing.

@chrisbobbe
Copy link

It seems like a bug should be filed on flow so that it doesn't fail when it encounters invalid JSON, especially inside node_modules. Please link to it here when that’s filed.

facebook/flow#2364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants