Skip to main content

prefer-publish-to-none

added in: 1.2.0
Pro+

Warns when a pubspec file does not have publish_to: none config.

Adding publish_to: none helps ensure that your internal packages (that are not actually intended to be published) won't be published when dart publish is called (even accidentally).

Example

❌ Bad:

pubspec.yaml
name: some_package # LINT: Add 'publish_to: none' to ensure that the package won't be published.
description: ...
version: 1.0.0

✅ Good:

pubspec.yaml
name: some_package
publish_to: none
description: ...
version: 1.0.0