no-redundant-publishConfig
💼 This rule is enabled in the following configs: ✅ recommended, 📦 recommended-publishable.
💡 This rule is manually fixable by editor suggestions.
This rule warns when publishConfig.access is used in unscoped packages, as it has no effect.
More Details
Section titled “More Details”Per npm documentation, unscoped packages (package names without @) are always public and cannot be made private.
Using publishConfig.access in these packages is redundant since the property only affects scoped packages.
The rule will report when unscoped packages have publishConfig.access defined.
It will ignore the property for scoped packages (e.g. @org/name).
Examples
Section titled “Examples”{ "name": "my-package", "publishConfig": { "access": "public" }}{ "name": "my-package", "publishConfig": { "access": "restricted" }}{ "name": "my-package", "publishConfig": { "access": "public", "registry": "https://example.com" }}{ "name": "@myorg/my-package", "publishConfig": { "access": "public" }}{ "name": "@myorg/my-package", "publishConfig": { "access": "restricted" }}{ "name": "my-package", "publishConfig": { "registry": "https://example.com" }}{ "name": "my-package"}When Not to Use It
Section titled “When Not to Use It”Disable this rule if you:
- Want to keep the
publishConfig.accessfield as documentation even though it has no effect - Are planning to convert your unscoped package to a scoped package in the future
Related Rules
Section titled “Related Rules”require-publishConfig- Enforces that thepublishConfigproperty is present.valid-publishConfig- Enforces that thepublishConfigproperty is valid.