Skip to main content

prefer-correct-package-name

added in: 1.2.0
⚙️
Pro+

Warns when a package name does not match the configured pattern.

note

This rule requires configuration in order to highlight any issues.

⚙️ Config

Set name-pattern (default is none) to set the expected package name pattern.

analysis_options.yaml
dart_code_metrics:
pubspec-rules:
- prefer-correct-package-name:
name-pattern: ^company_name*

Example

❌ Bad:

pubspec.yaml
name: some_package # LINT: Package name does not match the configured pattern '^company_name*'.
description: ...
version: 1.0.0

✅ Good:

pubspec.yaml
name: company_name_package
description: ...
version: 1.0.0