require-package-json-export
ðĄ This rule is manually fixable by editor suggestions.
This rule requires that if a package.json includes exports (or publishConfig.exports) that an explicit ./package.json export is included.
More Details
Section titled âMore DetailsâWhen a package declares exports, that represents the entire API surface for that package.
By including an explicit export for the package.json, external tools can more easily consume it (via direct import/require).
If the package does not export the package.json, it makes it harder for tools to load / inspect it.
Examples
Section titled âExamplesâ{ "exports": "./index.mjs"}{ "exports": { ".": "./index.mjs" }}{ "exports": { "import": "./index.mjs", "require": "./index.cjs" }}{ "exports": { ".": "./index.mjs", "./package.json": "./package.json" }}{ "exports": { ".": { "import": "./index.mjs", "require": "./index.cjs" }, "./package.json": "./package.json" }}When Not to Use It
Section titled âWhen Not to Use ItâIf youâre not concerned about providing easier access to your packageâs package.json, then you can safely exclude this rule.
Related Rules
Section titled âRelated Rulesârequire-exports- Enforces that theexportsproperty is present.valid-exports- Enforces that theexportsproperty is valid.