klin_dart 1.0.0
klin_dart: ^1.0.0 copied to clipboard
KlinDart is a collection of opinionated custom lint rules for Dart and Flutter projects. It focuses on improving code **readability**, **maintainability**, and **scalability** by enforcing architectur [...]
๐ง KlinDart #
KlinDart is a collection of opinionated custom lint rules for Dart and Flutter projects. It focuses on improving code readability, maintainability, and scalability by enforcing architectural and stylistic best practices.
โจ Features #
Rule Name | Description |
---|---|
avoid_hardcoded_strings_in_ui |
Discourages hardcoded string literals directly inside widgets to improve localization readiness. |
avoid_string_literals_in_logic |
Flags string literals used in conditions, comparisons, or logicโsuggests constants or enums instead. |
cognitive_complexity |
Warns about methods/functions that are too complex to easily understand or maintain. |
function_length |
Enforces a maximum function/method size to encourage smaller, testable units. |
class_length |
Prevents overly long classes that may violate single-responsibility principle. |
file_length |
Warns about files that exceed a configurable number of lines. Useful for splitting concerns. |
๐ Installation #
To use KlinDart in your project:
1. Add dependency to your linter package #
# pubspec.yaml
dev_dependencies:
custom_lint:
klin_dart: <latest_version>
2. Enable it in analysis_options.yaml #
# analysis_options.yaml
analyzer:
plugins:
- custom_lint
custom_lint:
๐ Philosophy #
Clean code is not just about writing less code โ it's about writing the right code in the right place. KlinDart helps enforce practices that scale with your team, reduce bugs, and increase developer confidence across Dart and Flutter codebases. The rules are designed to be opinionated yet flexible, allowing you to adapt them to your project's specific needs.
๐ License #
This project is licensed under the MIT License. See the LICENSE file for details. MIT โ feel free to fork and adapt to your team's needs.
๐ฅ Contributing #
We welcome contributions! If you have suggestions, bug reports, or feature requests, please open an issue or submit a pull request. Please ensure that your code adheres to the existing style and includes tests where applicable. We also encourage you to write documentation for any new features or changes you make.