Skip to content

Repository files navigation

PRs WelcomePub Version

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.
  • Detect forbidden dependencies based on configurable patterns.
  • Lightweight CLI, easy to integrate into your project workflow.

How to install?

dev_dependencies:
...eagle_eye: ^version

How to use?

1. Make sure you have a lint rule to avoid relative imports

# analysis_options.yamlanalyzer:
errors:
avoid_relative_lib_imports: error

In 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.

2. In your project create a file eagle_eye_config.json

Create a JSON file in your project to define rules. Example:

[
{
"filePattern": "*util.dart",
"dependenciesAllowed": false
},
{
"filePattern": "*viewmodel.dart",
"exclusiveDependencies": ["*repository.dart"]
},
{
"filePattern": "*repository.dart",
"forbiddenDependencies": ["*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.dart suffix must not have dependencies;

  • Any viewModel file should depend on repository classes;

  • Any repository file should not depends on screen files.

3. Run the eagle eye locally

dart run eagle_eye:main

If you have any error, the process will fail immediately.

⚠ We are working on error reports.

About

A Dart CLI tool designed to enforce architectural rules in your flutter/dart project.

Topics

Resources

Contributing

Stars

9 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages