exports rules
Validate the exports field in package.json — condition ordering, file existence, format matching, and more.
Rules (28)
| Rule | Description | Severity | Fixable |
|---|---|---|---|
type-module | Check that type: "module" is set appropriately | 🔴 error | 🔧 |
exports-field | Check that exports field exists in package.json | 🔴 error | ⚠️ |
dot-entry | Check that exports has a "." entry | 🔴 error | ⚠️ |
types-order | Check that types condition comes before default in exports | 🔴 error | 🔧 |
import-condition | Check that exports has an import condition | 🔴 error | ⚠️ |
file-exists | Check that files referenced in exports exist on disk | 🟡 warning | |
value-invalid | Check that every string value in exports starts with ./ | 🔴 error | |
default-last | Check that "default" is the last key in every condition map | 🔴 error | 🔧 |
module-before-require | Check that "module" comes before "require" in condition maps | 🟡 warning | 🔧 |
imports-field | Validate package.json imports field | 🔴 error | |
jsx-extensions | Check that exports don't use invalid JSX extensions | 🔴 error | |
format-mismatch | Check that export file contents match the expected module format | 🟡 warning | |
module-esm-only | Check that "module" condition in exports points to ESM content | 🟡 warning | |
fallback-array | Warn against fallback arrays in exports | 🟡 warning | |
types-format | Check that types conditions use the correct .d.mts/.d.cts extensions for dual packages | 🟡 warning | |
condition-types | Check that export conditions with JS entries have sibling types | 🟡 warning | |
no-deprecated-subpath | Warn on trailing / in exports keys (use /* instead) | 🟡 warning | |
imports-key-invalid | Check that all imports field keys start with # | 🔴 error | |
browser-conflict | Warn when both top-level browser field and exports exist | 🟡 warning | |
browser-value-conflict | Detect when exports values are remapped by the browser field | 🟡 warning | |
file-not-published | Check that files referenced in exports/main/bin are included in the published package | 🔴 error | |
glob-matched-files | Validate that wildcard patterns in exports match at least one file | 🟡 warning | |
cjs-esmodule-interop | Detect CJS files using __esModule interop pattern that may cause inconsistent bundler behavior | 🟡 warning | |
cjs-default-export | Detect CJS-only packages with only a default export and no named exports | :blue_circle: info | |
types-first | Check that "types" is the first condition in every condition map | 🔴 error | 🔧 |
esm-main-no-exports | Warn when "main" is ESM but "exports" is missing | 🟡 warning | |
module-no-exports | Warn when "module" field exists but "exports" is missing | 🟡 warning | |
types-not-exported | Check that "types" field is also represented in exports conditions | 🟡 warning |