Skip to content

[DOCS] package.json "overrides" should be explicit about supporting version range syntax #9475

@denilsonsa

Description

@denilsonsa

Is there an existing issue for this?

  • I have searched the existing issues

This is a CLI Docs Enhancement, not another kind of Docs Enhancement.

  • This is a CLI Docs Enhancement.

Description of Problem

The documentation for "overrides" explains the different nesting levels, explains the different special values for the key… But it doesn't explain what are the valid values for versions.

Specifically, all the current examples only use explicit versions (in the format 1.2.3). Thus, after (re-)reading the documentation (several times), I'm still not sure if it supports version ranges.

Why would I want that? Because if I want to update something due to a security vulnerability, I could change it to ^2.4.0 instead of 2.4.0. Why? Because in the future I'll wonder why I had overridden to that very specific version. Since package.json doesn't support comments, I won't know. Thus, by using a version range, I'm explaining to my future self that I didn't intend that very specific version, but at least that version.

Potential Solution

Explicitly define the valid values for the overrides. Additionally, add (or modify) some examples showing version ranges, as that helps people reading the documentation in a hurry.

Docs URL

https://docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentationdocumentation related issueNeeds Triageneeds review for next steps

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions