coolint
An opinionated and strict set of lint rules for Dart and Flutter projects to enforce a clean, robust, and consistent codebase.
Why coolint?
The Dart ecosystem provides a solid foundation for linting with package:lints. coolint builds on top of the recommended set of rules from package:lints and adds many more carefully selected rules to:
- Prevent Common Errors: A wide range of rules to catch potential runtime errors during static analysis.
- Enforce a Consistent Style: Keep your codebase looking clean and uniform, no matter how many developers are working on it.
- Promote Best Practices: Encourage the use of modern and performant Dart features.
- Improve Readability: A well-linted codebase is easier to read, understand, and maintain.
Getting Started
1. Add dependency
Add coolint to your pubspec.yaml file under dev_dependencies.
dev_dependencies:
coolint: ^3.0.0 # Make sure to use the latest version
2. Configure analysis_options.yaml
coolint provides modular rulesets tailored to your project type:
For Flutter Apps
Include the Flutter ruleset in your analysis_options.yaml file. This contains all Dart and Flutter-specific best practices without noisy debug-fill requirements:
include: package:coolint/flutter.yaml
For Public UI Packages & Widget Libraries
If you are publishing a Flutter UI package, design system, or widget library to pub.dev, use the dedicated package ruleset (enforces diagnostic_describe_all_properties and public_member_api_docs):
include: package:coolint/flutter_package.yaml
For Pure Dart Projects
If you are working on a pure Dart project (e.g., CLI tools, backend servers, or utility packages), use the pure Dart ruleset:
include: package:coolint/dart.yaml
That's it! The Dart analyzer will now use the selected rules from coolint.
Philosophy
The philosophy of coolint is to be strict but pragmatic. The rules are designed to be strict enough to prevent common pitfalls and ensure high code quality, but not so strict that they become a burden or hinder productivity.
This package is ideal for teams and individuals who want to maintain a high standard of quality in their Dart and Flutter projects.
Show your support
If you use coolint in your project and you like it, you can show your support by adding one of these badges to your README.md:
How to add
To include a badge in your project:
- Copy the Markdown code snippet for the badge you want.
- Paste it into your project’s
README.mdfile.
Markdown:
[](https://pub.dev/packages/coolint)
Markdown (for-the-badge style):
[](https://pub.dev/packages/coolint)
Contributing
Contributions are welcome! If you have a suggestion for a new rule, or you want to improve the existing set, please open an issue or a pull request on our GitHub repository.
License
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.