PACKAGE_JSON_TYPE_REQUIRED
Requires that every package.json file has the type field set to encourage using ES Modules since commonjs is the default.Conformance is available on Enterprise plans
This check ensures that every package.json
has a type
field. This field determines
how files within the workspace are treated by default. Files are treated as
CommonJS by default. However, the new recommendation
is to use ES Modules.
This field is required so that packages explicitly choose which module format to use, preferring ES Modules when possible.
See the Node.js docs for more information.
- PACKAGE_JSON_NAME_REQUIRED
- PACKAGE_JSON_DESCRIPTION_REQUIRED
- PACKAGE_JSON_PRIVATE_REQUIRED
- PACKAGE_JSON_SIDE_EFFECTS_REQUIRED
The type
field should be set to module
when possible, although there are still situations
where commonjs
has to be used.
Last updated on March 4, 2025
Was this helpful?