npm / npm/rfcs

[RRFC] Add a field to package.json recommending that the package be unique.

Open
#649 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
777
Forks
267
PR merge metrics
No merged PRs in 30d

Description

Motivation ("The Why")

There can be a problem when multiple versions of a package in dependencies. but we generally find it difficult to issue warnings without false positives.

However, in the case of a package that uses a global store, such as React, multiple versions are not expected to be used at the same time in most cases. This often occurs as a runtime error and is a source of confusion.

Therefore, I think it would be better to add a field like recommendUnique: boolean that recommend such a package to be unique and issue a warning on any lint tools or npm ownself.

Example

package.json

{
  "recommendUnique": true
}
How
Current Behaviour
Desired Behaviour
$ some-linting-tool or npm install
[warn] `React` recommend unique version but detect multiple version. please run `npm ls` and solve it.
References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed package.json field and the referenced React issue, then review how npm install, npm ls, or linting tools could consume the recommendation. Before implementation, the RFC needs agreement on field semantics, warning ownership, and how multiple versions are detected; done means those behaviors are specified and accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.