Rules
Below is an unordered list of rules used by publint
for
linting.
IMPLICIT_INDEX_JS_INVALID_FORMAT
If there are no entrypoints specified, e.g. main
,
module
, exports
, it's assumed that the root
index.js
is loaded by default. If the file has an invalid
format, the error is reported.
FILE_INVALID_FORMAT
If the file has an invalid format through explicit entrypoints, the error is reported.
FILE_INVALID_EXPLICIT_FORMAT
If the file has an invalid format through explicit entrypoints, and the
file has an explicit extension too, e.g. .mjs
and
.cjs
, the error is reported.
FILE_DOES_NOT_EXIST
The specified file does not exist.
MODULE_SHOULD_BE_ESM
The module
entry should be ESM only.
HAS_MODULE_BUT_NO_EXPORTS
If the package has a module
entry without a
exports
entry, suggest using exports
instead.
HAS_ESM_MAIN_BUT_NO_EXPORTS
If the main
entrypoint is an ES module, you can likely
remove it as environments that supports so also supports
exports
, which should be used instead, and the
main
can then be removed alongside too.
EXPORTS_GLOB_NO_MATCHED_FILES
If the exports
entry contains glob paths, but it doesn't
match any files, suggest the issue.
EXPORTS_GLOB_NO_DEPRECATED_SUBPATH_MAPPING
The exports
entry should not have globs defined with
trailing slashes. It is
deprecated
and should use /*
instead.
EXPORTS_TYPES_SHOULD_BE_FIRST
Ensure types
condition to be the first.
More info.
EXPORTS_DEFAULT_SHOULD_BE_LAST
Ensure default
condition to be the last.