From 39ea73d654c79bdffe70d4e4804f813b049b512b Mon Sep 17 00:00:00 2001 From: Fynn Petersen-Frey <10599762+fyfrey@users.noreply.github.com> Date: Sun, 22 Sep 2024 15:24:08 +0200 Subject: [PATCH] chore(mobile): restrict isar use via CI checks (#12840) --- mobile/analysis_options.yaml | 20 +++++++++++++++++++ mobile/lib/pages/library/favorite.page.dart | 2 +- ...e_provider.dart => favorite.provider.dart} | 0 3 files changed, 21 insertions(+), 1 deletion(-) rename mobile/lib/providers/{favorite_provider.dart => favorite.provider.dart} (100%) diff --git a/mobile/analysis_options.yaml b/mobile/analysis_options.yaml index 2783e8f1d1..8f9d41d736 100644 --- a/mobile/analysis_options.yaml +++ b/mobile/analysis_options.yaml @@ -58,6 +58,26 @@ custom_lint: # refactor to make the providers and services testable - lib/providers/backup/{backup,manual_upload}.provider.dart # uses only PMProgressHandler - lib/services/{background,backup}.service.dart # uses only PMProgressHandler + - import_rule_isar: + message: isar must only be used in entities and repositories + restrict: package:isar + allowed: + # required / wanted + - lib/entities/*.entity.dart + - lib/repositories/{album,asset,backup,user}.repository.dart + # acceptable exceptions for the time being + - integration_test/test_utils/general_helper.dart + - lib/main.dart + - lib/routing/router.dart + - lib/utils/{db,image_url_builder,migration,renderlist_generator}.dart + - test/**.dart + # refactor to make the providers and services testable + - lib/pages/common/{album_asset_selection,gallery_viewer}.page.dart + - lib/providers/{archive,asset,authentication,db,favorite,partner,trash,user}.provider.dart + - lib/providers/{album/album,album/shared_album,asset_viewer/asset_stack,asset_viewer/render_list,backup/backup,backup/manual_upload,search/all_motion_photos,search/recently_added_asset}.provider.dart + - lib/services/{asset,asset_description,background,backup,backup_verification,hash,immich_logger,memory,partner,person,search,stack,sync,user}.service.dart + - lib/widgets/asset_grid/{asset_grid_data_structure,thumbnail_image}.dart + - import_rule_openapi: message: openapi must only be used through ApiRepositories restrict: package:openapi diff --git a/mobile/lib/pages/library/favorite.page.dart b/mobile/lib/pages/library/favorite.page.dart index 7462dc8f21..cc422f88c7 100644 --- a/mobile/lib/pages/library/favorite.page.dart +++ b/mobile/lib/pages/library/favorite.page.dart @@ -2,7 +2,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:immich_mobile/providers/favorite_provider.dart'; +import 'package:immich_mobile/providers/favorite.provider.dart'; import 'package:immich_mobile/providers/multiselect.provider.dart'; import 'package:immich_mobile/widgets/asset_grid/multiselect_grid.dart'; diff --git a/mobile/lib/providers/favorite_provider.dart b/mobile/lib/providers/favorite.provider.dart similarity index 100% rename from mobile/lib/providers/favorite_provider.dart rename to mobile/lib/providers/favorite.provider.dart