EagleEye is a Dart CLI tool for detecting architecture violations in Dart projects.
📚 Check our documentation here.
- Analyze Dart project files for architectural rules.
- Detect forbidden dependencies based on configurable patterns.
- Lightweight CLI, easy to integrate into your project workflow.
git clone <repository-url>
cd eagle_eye⚠ We are working on a better way to distribute the library.
dev_dependencies:
eagle_eye:
path: ../eagle_eye# analysis_options.yaml
analyzer:
errors:
avoid_relative_lib_imports: errorIn this way, we are forcing the internal imports to have the app name:
// BAD ❌ (relative import)
import '../utils/helper.dart';// GOOD ✅ (package import)
import 'package:my_app/utils/helper.dart';Ensure that this lint rule is enabled for EagleEye to function correctly.
Create a JSON file in your project to define rules. Example:
[
{
"filePattern": "*util.dart",
"noDependsEnabled": true
},
{
"filePattern": "*viewmodel.dart",
"justWithPatterns": ["*repository.dart"]
},
{
"filePattern": "*repository.dart",
"doNotWithPatterns": ["*screen.dart"]
}
]Add the json file in the root level of your project.
Just to explain, we are defining some rules in this example:
- Any file ending with the
util.dartsuffix must not have dependencies; - Any viewModel file should depend on repository classes;
- Any repository file should not depends on screen files.
dart run eagle_eye:mainIf you have any error, the process will fail immediately.
⚠ We are working on error reports.