Skip to content

no-redundant-publishConfig

💼 This rule is enabled in the following configs: ✔️ legacy-recommended, ✅ 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.

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 field only affects scoped packages.

The rule will:

  • Warn when unscoped packages have publishConfig.access defined
  • Remain silent for scoped packages (@org/name) where the field is meaningful

Examples of incorrect code for this rule:

{
"name": "my-package",
"publishConfig": { "access": "public" }
}
{
"name": "my-package",
"publishConfig": { "access": "restricted" }
}
{
"name": "my-package",
"publishConfig": {
"access": "public",
"registry": "https://example.com"
}
}

Examples of correct code for this rule:

{
"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"
}

Disable this rule if you:

  • Want to keep the publishConfig.access field as documentation even though it has no effect
  • Are planning to convert your unscoped package to a scoped package in the future