valid-exports
💼 This rule is enabled in the following configs: ✅ recommended, 📦 recommended-publishable.
This rule uses package-json-validator to validate the exports property, if present, against the following criteria:
- It should be of type
stringorobject. - If it’s a
string, it should be a path to an entry point. - If it’s an export condition object, its properties should have values that are either a path to an entry point, or another exports condition object.
Examples
Section titled “Examples”{ "exports": { "import": true }}{ "exports": "./index.js"}{ "exports": { ".": "./index.js", "./secondary": "./secondary.js" }}{ "exports": { ".": { "import": { "types": "./esm/index.d.mts", "default": "./esm/index.mjs" }, "require": { "types": "./cjs/index.d.cts", "default": "./cjs/index.cjs" } } }}Related Rules
Section titled “Related Rules”require-exports- Enforces that theexportsproperty is present.