nodejs / nodejs/node

Warn when package.json contains an invalid "type" value

Open
#60,085 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request never-stale
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

What is the problem this feature will solve?

Valid (meaningful) values are:

  • commonjs
  • module

I had set CommonJS, and it behaves the same as if type was unset, which is so close to the actual commonjs behavior, that I thought I had set it correctly. But I kept having cases resulting in the MODULE_TYPELESS_PACKAGE_JSON warning, instead of failing hard.

Note that while tsconfig.js ignores case, the canonical version is CommonJS, so I never considered that I was using incorrect case.

What is the feature you are proposing to solve the problem?

Raise warning/error if "type" is set, but value is none of commonjs or module.

What alternatives have you considered?

No response

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 tracing where Node.js handles the package.json type field and emits the MODULE_TYPELESS_PACKAGE_JSON warning; the issue names no source file or test, so map that path and its existing coverage first. Define and test the chosen warning or error behavior for values other than commonjs and module while preserving those canonical values.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.