Warn when package.json contains an invalid "type" value
Nobody has claimed this yet.
- 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:
commonjsmodule
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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