From 80b0d9dfe12a2348bfd266d3c437d4e580c684dc Mon Sep 17 00:00:00 2001 From: TobiasWawrzinek <48699936+TobiasWawrzinek@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:42:54 +0100 Subject: [PATCH] Add avoid-banned-imports to metrics (#24) * Add avoid-banned-imports * Remove punctuation * Bump version and update CHANGELOG.md --------- Co-authored-by: Tobias Wawrzinek Co-authored-by: Quoc Huynh --- CHANGELOG.md | 4 ++++ lib/metrics.yaml | 11 +++++++++++ pubspec.yaml | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0de5f6..7fa4252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.0 + +* Add [`avoid-banned-imports`](https://dcm.dev/docs/rules/common/avoid-banned-imports/) + ## 0.4.0 * Remove deprecated rules diff --git a/lib/metrics.yaml b/lib/metrics.yaml index 04d8a20..002a111 100644 --- a/lib/metrics.yaml +++ b/lib/metrics.yaml @@ -52,6 +52,17 @@ dart_code_metrics: - test/** - integration_test/** - prefer-trailing-comma + - avoid-banned-imports: + entries: + - paths: ['lib\/domain(\/\w+)+\.dart'] + deny: ['^package:\w*\/ui(\/\w+)+\.dart$'] + message: 'Do not import UI classes within domain layer' + - paths: ['lib\/infrastructure(\/\w+)+\.dart'] + deny: ['^package:\w*\/ui(\/\w+)+\.dart$'] + message: 'Do not import UI classes within infrastructure layer' + - paths: ['lib\/domain(\/\w+)+\.dart'] + deny: ['^package:\w*\/infrastructure(\/\w+)+\.dart$'] + message: 'Do not import infrastructure layer classes within domain layer' # Flutter - always-remove-listener diff --git a/pubspec.yaml b/pubspec.yaml index e640597..0be39a8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: Lint rules and metrics for Dart and Flutter used internally at cose repository: https://github.com/cosee/cosee_lints homepage: https://pub.dev/publishers/cosee.biz/packages issue_tracker: https://github.com/cosee/cosee_lints/issues -version: 0.4.0 +version: 0.5.0 topics: - lints