Skip to content

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

Closed

Description

@paritosh-yadav

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

Activity

  1. ljharb commented on Jan 4, 2022

    @ljharb
    Member

    Why is flow checking node_modules?

  2. TrySound commented on Jan 4, 2022

    @TrySound

    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?

  3. ljharb commented on Jan 4, 2022

    @ljharb
    Member

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

  4. ljharb commented on Jan 4, 2022

    @ljharb
    Member

    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.

  5. changed the title [-]Flow type checking error[/-] [+]intentionally malformed package.json fixture in tests breaks flowtype when checking node_modules[/+] on Jan 5, 2022
  6. paritosh-yadav commented on Jan 5, 2022

    @paritosh-yadav
    Author

    Hi @ljharb ,

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

  7. ljharb commented on Jan 5, 2022

    @ljharb
    Member

    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.

  8. jacksontims123 commented on Jan 5, 2022

    @jacksontims123

    So you can ignore when problems arise in flow?

  9. ljharb commented on Jan 5, 2022

    @ljharb
    Member

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

  10. chrisbobbe commented on Jan 25, 2022

    @chrisbobbe

    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

  11. added a commit that references this issue on Oct 10, 2023
    39ed3c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions