exportsValidity
Enforces that the
exportsproperty is valid.
✅ This rule is included in the package-json logical presets.
The rule checks that, if present, the exports property is a string or object.
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" } } }}When Not To Use It
Section titled “When Not To Use It”If you don’t need compliance with npm’s exports field specification, you can disable this rule.
For example, if you use a different package manager that treats the field differently, this rule may not be correct for you.
Related Rules
Section titled “Related Rules”- exportsPresence - Enforces that the
exportsproperty is present.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
package-json/valid-exports
Made with ❤️🔥 around the world by
the Flint team and contributors.