Skip to content

package.json with missing name property unhandled in some scenarios #1876

Open
@rlmestre

Description

@rlmestre

I ran into this issue in an existing internal project, so I'm not 100% sure of what a minimum reproduction looks like, but a linked nested package dependency without a name causes the following code to fail:

const match = (typeof name === "object" ? name.name || "" : name || "").match(

Because name === null satisfies typeof name === 'object', this throws Cannot read properties of null (reading 'name').

It's probably an edge case, and package.json should always be compliant, but I don't see the harm in fixing it if there are no guards against it, so I can contribute the fix.

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