npm / npm/rfcs

[RRFC] Stop removing or give option not to remove `dependencies`

Open
#329 0 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")

Hi,

I like to preserve dependencies (and devDependencies, etc.) even when it is empty in package.json. I can search through a large file to find the dependencies (without getting a thunk noise from my IDE that it doesn't exist), and it just makes clear at a glance to those browsing the status (e.g., of having no dependencies).

Example

As others have pointed out, not removing dependencies would help avoid diff noise.

How
Current Behaviour

The property currently gets removed upon performing npm install or npm uninstall.

Desired Behaviour

Please don't remove dependencies or other dependency fields when performing npm install or npm uninstall, etc., even if they are left empty. Or, at the very least, please consider configuration to disable this behavior.

Thanks!

References
  • n/a

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 by reviewing the issue's examples and the referenced npm feedback discussion. Examine how npm install and npm uninstall currently handle dependency fields in package.json, then determine the intended behavior or configuration boundary. Done means an agreed proposal covering empty dependencies, devDependencies, and related fields.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.