Skip to main content

prefer-commenting-pubspec-ignores

effort: 2m
teams+

Warns when # ignore: comments are left without any additional description of why this ignore is applied.

info

This rule doesn't trigger on global # ignore_for_file: comments.

Example

❌ Bad:

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

dev_dependencies:
# ignore: prefer-caret-version-syntax // LINT Prefer adding a description to the pubspec ignores.
lints: any
mocktail: ^0.3.0

# ignore: some-other-rule // LINT Prefer adding a description to the pubspec ignores.
screenshots:
- description: Some description
path: some/path.txt

✅ Good:

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

dev_dependencies:
# We need to have for proper resolution.
# ignore: prefer-caret-version-syntax
lints: any
mocktail: ^0.3.0

# Not applicable in our case.
# ignore: some-other-rule
screenshots:
- description: Some description
path: some/path.txt