EagleEye
EagleEye is a Dart CLI tool for detecting architecture violations in Dart projects.
📚 Check our documentation here.
Minimum Requirements
Dart Package
- Dart 3.8+
Features
- Analyze Dart project files for architectural rules.
- Validate the configuration before analysis, rejecting malformed rules and files matched by more than one rule.
- Detect forbidden dependencies based on configurable patterns.
- Lightweight CLI, easy to integrate into your project workflow.
How to install?
dev_dependencies:
...
eagle_eye: ^version
Getting Started
Quick setup
- Enable the lint rule in
analysis_options.yaml:
analyzer:
errors:
avoid_relative_lib_imports: error
- Create
eagle_eye_config.jsonat your project root:
[
{
"filePattern": "*/model/*",
"dependenciesAllowed": false,
"name": "models-no-imports"
},
{
"filePattern": "*viewmodel.dart",
"forbiddenDependencies": ["*_screen.dart"],
"name": "viewmodels-no-screens"
}
]
- Add the dependency to
pubspec.yaml:
dev_dependencies:
eagle_eye: ^2.0.4
- Run it:
dart run eagle_eye:main
Verbose mode
Pass --verbose (or -v) to print every configuration, file, import, and
pattern check performed by Eagle Eye:
dart run eagle_eye:main --verbose
Verbose lines are prefixed with [verbose] on stdout, so regular output stays
unchanged when the flag is omitted. Use --help to see all available options.
Checking specific files
Pass one or more file paths to analyze only those files:
dart run eagle_eye:main lib/data/user_repository.dart lib/model/user.dart
Paths must exist, end with .dart, and live under lib/. When no paths are
given, EagleEye keeps scanning all Dart files in lib/. Configuration conflict
validation also applies only to the files being checked.
Auto-generate config with a prompt
You can use this prompt with an AI assistant to automatically detect your architecture and generate an eagle_eye_config.json with the right rules.
For the full setup guide with architecture-specific templates and customization guidelines, see the Getting Started documentation.
Libraries
- analyzer/checker/exclusive_dependencies_rule_checker
- analyzer/checker/forbidden_dependencies_rule_checker
- analyzer/config_validator
- analyzer/eagle_eye_matcher
- analyzer/eagle_eye_visitor
- analyzer/regex_helper
- data/config_item_mapper
- data/config_keys
- data/dart_source_loader
- data/eagle_eye_repository
- data/file_helper
- data/json_converter
- eagle_eye_launcher
- model/eagle_eye_config
- model/eagle_eye_config_item
- model/exceptions/application_name_not_found_exception
- model/exceptions/config_file_not_found_exception
- model/exceptions/eagle_eye_exception
- model/exceptions/empty_dart_file_list_exception
- model/exceptions/invalid_config_exception
- model/exceptions/invalid_file_selection_exception
- model/exceptions/invalid_json_key_exception
- model/exceptions/library_folder_not_found_exception
- model/violation
- service_locator
- util/check_reporter
- util/cli_options
- util/logger_helper
- util/output_renderer