From bccde3fe9f3d47b29e08ac6d287c2bc06f6d855c Mon Sep 17 00:00:00 2001 From: "Michael W. Aziz" Date: Wed, 12 Feb 2025 14:21:40 +0200 Subject: [PATCH] [0.1.0] --- analysis_options.yaml | 44 ++++++++++++++++++++++++++++++++-- lib/src/border_extensions.dart | 2 +- lib/src/list_extensions.dart | 4 ++-- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 91cc0d7..0de3c75 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -2,9 +2,49 @@ include: package:lints/recommended.yaml linter: rules: + # ==== Project Organization Rules ==== + # Enforces relative imports to maintain project structure and avoid unnecessary long paths - prefer_relative_imports - - close_sinks - - avoid_empty_else + + # Ensures that files are named in lowercase_with_underscores format - file_names + + # ==== Best Practices ==== + # Enforces the closing of streams and sinks to avoid memory leaks + - close_sinks + + # Avoids empty 'else' blocks to reduce confusion and improve code readability + - avoid_empty_else + + # Prefer using 'const' constructors wherever possible for better performance and immutability - prefer_const_constructors + + # Avoid leading underscores for local variable names to prevent conflicts and improve clarity - no_leading_underscores_for_local_identifiers + + # ==== Code Consistency ==== + # Avoids the use of 'print' statements in production code, encouraging proper logging instead + - avoid_print + + # Encourages using 'final' for fields that are not reassigned to promote immutability + - prefer_final_fields + + # Ensures that all types are explicitly specified for better readability and type safety + - always_specify_types + + # Ensures constructors are at the top of the class for better readability and consistency + - sort_constructors_first + + # Avoids redundant default argument values to keep the code clean + - avoid_redundant_argument_values + + # Enforces consistency by preferring single quotes over double quotes for string literals + - prefer_single_quotes + + # ==== Documentation Rules ==== + # Enforces documentation for all public classes, methods, and fields to improve API clarity + # - public_member_api_docs + + # ==== Null Safety ==== + # Avoids unnecessary null checks and encourages the use of null-aware operators + - unnecessary_null_checks diff --git a/lib/src/border_extensions.dart b/lib/src/border_extensions.dart index 58e9fb0..81f3f4c 100644 --- a/lib/src/border_extensions.dart +++ b/lib/src/border_extensions.dart @@ -1,4 +1,4 @@ -import "package:flutter/painting.dart"; +import 'package:flutter/painting.dart'; extension BorderExtension on BorderDirectional { BorderDirectional all(BorderSide side) { diff --git a/lib/src/list_extensions.dart b/lib/src/list_extensions.dart index b6b5b3a..020273a 100644 --- a/lib/src/list_extensions.dart +++ b/lib/src/list_extensions.dart @@ -1,6 +1,6 @@ extension ListExtension on List { bool containsAll(List otherList) { - List checks = []; + List checks = []; // for (E thisElement in otherList) { checks.add(contains(thisElement)); @@ -9,7 +9,7 @@ extension ListExtension on List { } List getUnique() { - List uniqueItems = []; + List uniqueItems = []; for (E thisElement in this) { if (!uniqueItems.contains(thisElement)) { uniqueItems.add(thisElement);