From 52966a0717760c8686030d24342c132b2fcc4063 Mon Sep 17 00:00:00 2001 From: Roman Cinis <52065414+tsinis@users.noreply.github.com> Date: Thu, 26 Dec 2024 20:15:44 +0100 Subject: [PATCH 1/6] chore(deps): remove old dart code linter reference and bump dcm/lints --- .vscode/sealed_world.code-workspace | 10 +- packages/_sealed_world_tests/pubspec.yaml | 9 +- packages/analysis_options.yaml | 257 +++++++++++++++++- packages/flutter_analysis_options.yaml | 45 +++ packages/sealed_countries/pubspec.yaml | 11 +- packages/sealed_currencies/pubspec.yaml | 11 +- packages/sealed_languages/pubspec.yaml | 11 +- packages/world_countries/example/pubspec.lock | 125 ++------- packages/world_countries/example/pubspec.yaml | 7 +- packages/world_countries/pubspec.yaml | 7 +- packages/world_flags/example/pubspec.lock | 4 +- packages/world_flags/example/pubspec.yaml | 4 +- packages/world_flags/pubspec.yaml | 5 +- tools/analysis_options.yaml | 2 +- tools/pubspec.yaml | 13 +- 15 files changed, 363 insertions(+), 158 deletions(-) diff --git a/.vscode/sealed_world.code-workspace b/.vscode/sealed_world.code-workspace index 90097a84..47c07d5a 100644 --- a/.vscode/sealed_world.code-workspace +++ b/.vscode/sealed_world.code-workspace @@ -259,27 +259,27 @@ }, { "type": "shell", - "command": "dart run dart_code_linter:metrics analyze lib", + "command": "dcm analyze lib", "label": "Dart Code Metrics Analyze" }, { "type": "shell", - "command": "dart run dart_code_linter:metrics check-unnecessary-nullable lib", + "command": "dcm check-unnecessary-nullable lib", "label": "Dart Code Metrics Nullable" }, { "type": "shell", - "command": "dart run dart_code_linter:metrics check-unused-l10n lib", + "command": "dcm check-unused-l10n lib", "label": "Dart Code Metrics Unused L10N" }, { "type": "shell", - "command": "dart run dart_code_linter:metrics check-unused-files lib", + "command": "dcm check-unused-files lib", "label": "Dart Code Metrics Unused Files" }, { "type": "shell", - "command": "dart run dart_code_linter:metrics check-unused-code lib", + "command": "dcm check-unused-code lib", "label": "Dart Code Metrics Unused Code" }, { diff --git a/packages/_sealed_world_tests/pubspec.yaml b/packages/_sealed_world_tests/pubspec.yaml index 3ddde7d7..1cb95587 100644 --- a/packages/_sealed_world_tests/pubspec.yaml +++ b/packages/_sealed_world_tests/pubspec.yaml @@ -7,14 +7,13 @@ repository: https://github.com/tsinis/sealed_world/tree/main/packages/_sealed_wo issue_tracker: https://github.com/tsinis/sealed_world/issues environment: - sdk: ^3.5.3 + sdk: ^3.6.0 dependencies: meta: ^1.15.0 # Specific version for the flags package. From Google - test: ^1.25.7 # Specific version for the flags package. From Google + test: ^1.25.8 # Specific version for the flags package. From Google vm_service: ^14.2.5 # Specific version for the flags package. From Google dev_dependencies: - dart_code_linter: ^1.1.5 # Ex-DCM. - dart_code_metrics_presets: ^2.17.0 - lints: ^5.0.0 # From Google + dart_code_metrics_presets: ^2.19.0 + lints: ^5.1.1 # From Google diff --git a/packages/analysis_options.yaml b/packages/analysis_options.yaml index 8406979e..f068811f 100644 --- a/packages/analysis_options.yaml +++ b/packages/analysis_options.yaml @@ -43,7 +43,7 @@ analyzer: dart_code_metrics: extends: - - package:dart_code_metrics_presets/all.yaml + - package:dart_code_metrics_presets/dart_all.yaml anti-patterns: - long-parameter-list: ignore-optional: true @@ -62,6 +62,7 @@ dart_code_metrics: rules: # Disabled: - arguments-ordering: false # This will be a breaking change. + - avoid-adjacent-strings: false # It's not being used on one line strings. - avoid-collection-equality-checks: false # Doesn't work for models exclude. - avoid-collection-mutating-methods: false # Mostly false positives. - avoid-duplicate-collection-elements: false # They are being used on purpose. @@ -97,8 +98,6 @@ dart_code_metrics: exceptions: ["a", "b", "e", "i", "k", "v", "x", "y", "io", "bc", "sb"] - avoid-long-parameter-list: ignore-optional: true - - prefer-widget-private-members: - ignore-static: true - avoid-type-casts: exclude: - "*_json.dart" @@ -153,20 +152,262 @@ dart_code_metrics: exclude: - "**/data/**.data.dart" - "**/translations/**.l10n.dart" + # Enabled: + - avoid-accessing-collections-by-constant-index + - avoid-accessing-other-classes-private-members + - avoid-assigning-to-static-field + - avoid-assignments-as-conditions + - avoid-async-call-in-sync-function + - avoid-barrel-files + - avoid-bottom-type-in-patterns + - avoid-bottom-type-in-records + - avoid-cascade-after-if-null + - avoid-casting-to-extension-type + - avoid-collapsible-if + - avoid-collection-equality-checks + - avoid-collection-methods-with-unrelated-types + - avoid-collection-mutating-methods + - avoid-complex-loop-conditions + - avoid-conditions-with-boolean-literals + - avoid-contradictory-expressions + - avoid-declaring-call-method + - avoid-double-slash-imports + - avoid-duplicate-cascades + - avoid-duplicate-collection-elements + - avoid-duplicate-constant-values + - avoid-duplicate-exports + - avoid-duplicate-initializers + - avoid-duplicate-map-keys + - avoid-duplicate-mixins + - avoid-duplicate-named-imports + - avoid-duplicate-patterns + - avoid-duplicate-switch-case-conditions + - avoid-duplicate-test-assertions + - avoid-dynamic + - avoid-empty-spread + - avoid-empty-test-groups + - avoid-equal-expressions + - avoid-excessive-expressions + - avoid-explicit-pattern-field-name + - avoid-explicit-type-declaration + - avoid-extensions-on-records + - avoid-function-type-in-records + - avoid-future-tostring + - avoid-generics-shadowing + - avoid-global-state + - avoid-high-cyclomatic-complexity + - avoid-identical-exception-handling-blocks + - avoid-implicitly-nullable-extension-types + - avoid-importing-entrypoint-exports + - avoid-incomplete-copy-with + - avoid-incorrect-uri + - avoid-inferrable-type-arguments + - avoid-inverted-boolean-checks + - avoid-keywords-in-wildcard-pattern + - avoid-late-final-reassignment + - avoid-local-functions + - avoid-long-files + - avoid-long-functions + - avoid-long-parameter-list + - avoid-long-records + - avoid-map-keys-contains + - avoid-missed-calls + - avoid-missing-completer-stack-trace + - avoid-missing-enum-constant-in-map + - avoid-missing-interpolation + - avoid-misused-set-literals + - avoid-misused-test-matchers + - avoid-misused-wildcard-pattern + - avoid-mixing-named-and-positional-fields + - avoid-multi-assignment + - avoid-mutating-parameters + - avoid-negated-conditions + - avoid-negations-in-equality-checks + - avoid-nested-conditional-expressions + - avoid-nested-extension-types + - avoid-nested-futures + - avoid-nested-records + - avoid-nested-streams-and-futures + - avoid-nested-switch-expressions + - avoid-nested-switches + - avoid-non-ascii-symbols + - avoid-non-empty-constructor-bodies + - avoid-non-final-exception-class-fields + - avoid-non-null-assertion + - avoid-not-encodable-in-to-json + - avoid-nullable-interpolation + - avoid-nullable-parameters-with-default-values + - avoid-nullable-tostring + - avoid-one-field-records + - avoid-only-rethrow + - avoid-passing-async-when-sync-expected + - avoid-passing-default-values + - avoid-passing-self-as-argument + - avoid-positional-record-field-access + - avoid-recursive-calls + - avoid-redundant-async + - avoid-redundant-else + - avoid-redundant-positional-field-name + - avoid-redundant-pragma-inline + - avoid-referencing-discarded-variables + - avoid-referencing-subclasses + - avoid-renaming-representation-getters + - avoid-returning-cascades + - avoid-returning-void + - avoid-self-assignment + - avoid-self-compare + - avoid-shadowed-extension-methods + - avoid-shadowing + - avoid-similar-names + - avoid-single-field-destructuring + - avoid-slow-collection-methods + - avoid-substring + - avoid-suspicious-super-overrides + - avoid-throw-in-catch-block + - avoid-throw-objects-without-tostring + - avoid-top-level-members-in-tests + - avoid-type-casts + - avoid-unassigned-late-fields + - avoid-unassigned-stream-subscriptions + - avoid-uncaught-future-errors + - avoid-unconditional-break + - avoid-unknown-pragma + - avoid-unnecessary-call + - avoid-unnecessary-collections + - avoid-unnecessary-conditionals + - avoid-unnecessary-constructor + - avoid-unnecessary-enum-arguments + - avoid-unnecessary-enum-prefix + - avoid-unnecessary-extends + - avoid-unnecessary-futures + - avoid-unnecessary-getter + - avoid-unnecessary-if + - avoid-unnecessary-local-late + - avoid-unnecessary-negations + - avoid-unnecessary-nullable-return-type + - avoid-unnecessary-overrides + - avoid-unnecessary-patterns + - avoid-unnecessary-reassignment + - avoid-unnecessary-return + - avoid-unnecessary-super + - avoid-unnecessary-type-assertions + - avoid-unnecessary-type-casts + - avoid-unrelated-type-assertions + - avoid-unrelated-type-casts + - avoid-unsafe-collection-methods + - avoid-unsafe-reduce + - avoid-unused-after-null-check + - avoid-unused-assignment + - avoid-unused-generics + - avoid-unused-instances + - avoid-unused-parameters + - avoid-weak-cryptographic-algorithms + - avoid-wildcard-cases-with-enums + - binary-expression-operand-order + - dispose-class-fields + - double-literal-format + - format-comment + - function-always-returns-null + - function-always-returns-same-value + - handle-throwing-invocations + - map-keys-ordering + - match-getter-setter-field-names + - match-lib-folder-structure + - match-positional-field-names-on-assignment + - missing-test-assertion + - move-records-to-typedefs + - move-variable-closer-to-its-usage + - move-variable-outside-iteration + - newline-before-case + - newline-before-method + - newline-before-return + - no-boolean-literal-compare + - no-empty-block + - no-equal-arguments + - no-equal-conditions + - no-equal-nested-conditions + - no-equal-switch-case + - no-equal-switch-expression-cases + - no-equal-then-else + - no-object-declaration + - prefer-abstract-final-static-class + - prefer-add-all + - prefer-addition-subtraction-assignments + - prefer-any-or-every + - prefer-assigning-await-expressions + - prefer-async-await + - prefer-boolean-prefixes + - prefer-both-inlining-annotations + - prefer-bytes-builder + - prefer-commenting-analyzer-ignores + - prefer-conditional-expressions + - prefer-contains + - prefer-correct-callback-field-name + - prefer-correct-error-name + - prefer-correct-for-loop-increment + - prefer-correct-future-return-type + - prefer-correct-handler-name + - prefer-correct-json-casts + - prefer-correct-setter-parameter-name + - prefer-correct-stream-return-type + - prefer-correct-switch-length + - prefer-correct-test-file-name + - prefer-correct-type-name + - prefer-declaring-const-constructor + - prefer-early-return + - prefer-enums-by-name + - prefer-explicit-function-type + - prefer-explicit-parameter-names + - prefer-explicit-type-arguments + - prefer-extracting-function-callbacks + - prefer-first + - prefer-for-in + - prefer-getter-over-method + - prefer-immediate-return + - prefer-iterable-of + - prefer-last + - prefer-match-file-name + - prefer-moving-to-variable + - prefer-named-boolean-parameters + - prefer-null-aware-spread + - prefer-overriding-parent-equality + - prefer-parentheses-with-if-null + - prefer-prefixed-global-constants + - prefer-private-extension-type-field + - prefer-public-exception-classes + - prefer-return-await + - prefer-returning-conditional-expressions + - prefer-simpler-boolean-expressions + - prefer-simpler-patterns-null-check + - prefer-single-declaration-per-file + - prefer-specific-cases-first + - prefer-static-class + - prefer-switch-with-enums + - prefer-switch-with-sealed-classes + - prefer-trailing-comma + - prefer-type-over-var + - prefer-typedefs-for-callbacks + - prefer-unique-test-names + - prefer-unwrapping-future-or + - prefer-visible-for-testing-on-members + - prefer-wildcard-pattern + - record-fields-ordering + - unnecessary-trailing-comma + - use-existing-variable linter: rules: # Disabled: always_put_control_body_on_new_line: false # Makes code harder to read. - omit_local_variable_types: false # Conflicts with: prefer-type-over-var. always_specify_types: false # Conflicts with: omit_local_variable_types. always_use_package_imports: false # Conflicts with: prefer_relative_imports. avoid_classes_with_only_static_members: false # Conflicts with: prefer-static-class avoid_equals_and_hash_code_on_mutable_classes: false # We have no access to meta here. flutter_style_todos: false # Not a Flutter team. - # omit_obvious_local_variable_types: true # Conflicts with: specify_nonobvious_local_variable_types. #TODO! After Dart 3.6 is released. + omit_local_variable_types: false # Conflicts with: prefer-type-over-var prefer_final_parameters: false # Conflicts with: avoid_final_parameters. prefer_single_quotes: false # Conflicts with: prefer_double_quotes. + specify_nonobvious_local_variable_types: false # Conflicts with: avoid-explicit-type-declaration. unnecessary_final: false # Conflicts with: prefer_final_locals. unnecessary_library_name: false # To prevent breaking changes for those who use this libs. @@ -271,6 +512,7 @@ linter: noop_primitive_operations: true null_check_on_nullable_type_parameter: true null_closures: true + omit_obvious_local_variable_types: true one_member_abstracts: true only_throw_errors: true overridden_fields: true @@ -278,6 +520,7 @@ linter: package_names: true package_prefixed_library_names: true parameter_assignments: true + prefer-assigning-await-expressions: true prefer_adjacent_string_concatenation: true prefer_asserts_in_initializer_lists: true prefer_asserts_with_message: true @@ -318,6 +561,7 @@ linter: prefer_void_to_null: true provide_deprecation_message: true public_member_api_docs: true + record-fields-ordering: true recursive_getters: true require_trailing_commas: true secure_pubspec_urls: true @@ -325,7 +569,6 @@ linter: sort_constructors_first: true sort_pub_dependencies: true sort_unnamed_constructors_first: true - # specify_nonobvious_local_variable_types: true #TODO! After Dart 3.6 is released. test_types_in_equals: true throw_in_finally: true tighten_type_of_initializing_formals: true @@ -374,6 +617,6 @@ linter: use_super_parameters: true use_test_throws_matchers: true use_to_and_as_if_applicable: true - # use_truncating_division: true #TODO! After Dart 3.6 is released. + use_truncating_division: true valid_regexps: true void_checks: true diff --git a/packages/flutter_analysis_options.yaml b/packages/flutter_analysis_options.yaml index 6e6cb544..4efe8382 100644 --- a/packages/flutter_analysis_options.yaml +++ b/packages/flutter_analysis_options.yaml @@ -8,10 +8,55 @@ dart_code_metrics: - avoid-long-files: exclude: - lib/**/*_painter.dart + - avoid-returning-widgets: + allow-nullable: true - avoid-similar-names: similarity-threshold: 0.8 ignored-names: - path + - prefer-widget-private-members: + ignore-static: true + - always-remove-listener + - avoid-border-all + - avoid-empty-setstate + - avoid-expanded-as-spacer + - avoid-flexible-outside-flex + - avoid-incorrect-image-opacity + - avoid-inherited-widget-in-initstate + - avoid-late-context + - avoid-missing-controller + - avoid-missing-image-alt + - avoid-recursive-widget-calls + - avoid-shrink-wrap-in-lists + - avoid-single-child-column-or-row + - avoid-state-constructors + - avoid-stateless-widget-initialized-fields + - avoid-undisposed-instances + - avoid-unnecessary-gesture-detector + - avoid-unnecessary-overrides-in-state + - avoid-unnecessary-setstate + - avoid-unnecessary-stateful-widgets + - avoid-wrapping-in-padding + - check-for-equals-in-render-object-setters + - consistent-update-render-object + - dispose-fields + - prefer-action-button-tooltip + - prefer-center-over-align + - prefer-const-border-radius + - prefer-container + - prefer-correct-edge-insets-constructor + - prefer-dedicated-media-query-methods + - prefer-define-hero-tag + - prefer-extracting-callbacks + - prefer-for-loop-in-children + - prefer-padding-over-container + - prefer-single-widget-per-file + - prefer-sized-box-square + - prefer-sliver-prefix + - prefer-text-rich + - prefer-using-list-view + - proper-super-calls + - use-setstate-synchronously linter: rules: diff --git a/packages/sealed_countries/pubspec.yaml b/packages/sealed_countries/pubspec.yaml index d238abe6..40087ec1 100644 --- a/packages/sealed_countries/pubspec.yaml +++ b/packages/sealed_countries/pubspec.yaml @@ -26,9 +26,8 @@ dependencies: dev_dependencies: _sealed_world_tests: path: ../_sealed_world_tests - build_runner: ^2.4.13 # From Google - coverage: ^1.9.2 # From Google - dart_code_linter: ^1.1.5 # Ex-DCM. - dart_code_metrics_presets: ^2.17.0 - lints: ^5.0.0 # From Google - test: ^1.25.8 # From Google + build_runner: ^2.4.14 # From Google + coverage: ^1.11.1 # From Google + dart_code_metrics_presets: ^2.19.0 + lints: ^5.1.1 # From Google + test: ^1.25.14 # From Google diff --git a/packages/sealed_currencies/pubspec.yaml b/packages/sealed_currencies/pubspec.yaml index 6cc921e5..a7c1729e 100644 --- a/packages/sealed_currencies/pubspec.yaml +++ b/packages/sealed_currencies/pubspec.yaml @@ -26,9 +26,8 @@ dependencies: dev_dependencies: _sealed_world_tests: path: ../_sealed_world_tests - build_runner: ^2.4.13 # From Google - coverage: ^1.9.2 # From Google - dart_code_linter: ^1.1.5 # Ex-DCM. - dart_code_metrics_presets: ^2.17.0 - lints: ^5.0.0 # From Google - test: ^1.25.8 # From Google + build_runner: ^2.4.14 # From Google + coverage: ^1.11.1 # From Google + dart_code_metrics_presets: ^2.19.0 + lints: ^5.1.1 # From Google + test: ^1.25.14 # From Google diff --git a/packages/sealed_languages/pubspec.yaml b/packages/sealed_languages/pubspec.yaml index 10a6bca0..ad2517b9 100644 --- a/packages/sealed_languages/pubspec.yaml +++ b/packages/sealed_languages/pubspec.yaml @@ -23,9 +23,8 @@ environment: dev_dependencies: _sealed_world_tests: path: ../_sealed_world_tests - build_runner: ^2.4.13 # From Google - coverage: ^1.9.2 # From Google - dart_code_linter: ^1.1.5 # Ex-DCM. - dart_code_metrics_presets: ^2.17.0 - lints: ^5.0.0 # From Google - test: ^1.25.8 # From Google + build_runner: ^2.4.14 # From Google + coverage: ^1.11.1 # From Google + dart_code_metrics_presets: ^2.19.0 + lints: ^5.1.1 # From Google + test: ^1.25.14 # From Google diff --git a/packages/world_countries/example/pubspec.lock b/packages/world_countries/example/pubspec.lock index 9d894edb..f7051a43 100644 --- a/packages/world_countries/example/pubspec.lock +++ b/packages/world_countries/example/pubspec.lock @@ -5,34 +5,23 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" url: "https://pub.dev" source: hosted - version: "61.0.0" + version: "76.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.3" analyzer: dependency: transitive description: name: analyzer - sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 - url: "https://pub.dev" - source: hosted - version: "5.13.0" - analyzer_plugin: - dependency: transitive - description: - name: analyzer_plugin - sha256: c1d5f167683de03d5ab6c3b53fc9aeefc5d59476e7810ba7bbddff50c6f4392d - url: "https://pub.dev" - source: hosted - version: "0.11.2" - ansicolor: - dependency: transitive - description: - name: ansicolor - sha256: "8bf17a8ff6ea17499e40a2d2542c2f481cd7615760c6d34065cb22bfd22e6880" + sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "6.11.0" args: dependency: transitive description: @@ -101,18 +90,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + sha256: "74691599a5bc750dc96a6b4bfd48f7d9d66453eab04c7f4063134800d6a5c573" url: "https://pub.dev" source: hosted - version: "2.4.13" + version: "2.4.14" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021" url: "https://pub.dev" source: hosted - version: "7.3.2" + version: "8.0.0" built_collection: dependency: transitive description: @@ -193,22 +182,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" - csslib: - dependency: transitive - description: - name: csslib - sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - dart_code_linter: - dependency: "direct dev" - description: - name: dart_code_linter - sha256: "4ab030d610d7833a0e416768dac5341fa873da922694793e1cab6274a7af4991" - url: "https://pub.dev" - source: hosted - version: "1.1.5" dart_code_metrics_presets: dependency: "direct dev" description: @@ -221,10 +194,10 @@ packages: dependency: transitive description: name: dart_style - sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" + sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.7" dartx: dependency: transitive description: @@ -333,22 +306,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" - html: - dependency: transitive - description: - name: html - sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" - url: "https://pub.dev" - source: hosted - version: "0.15.4" - http: - dependency: transitive - description: - name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 - url: "https://pub.dev" - source: hosted - version: "1.2.2" http_multi_server: dependency: transitive description: @@ -445,6 +402,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + macros: + dependency: transitive + description: + name: macros + sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" + url: "https://pub.dev" + source: hosted + version: "0.1.3-main.0" matcher: dependency: transitive description: @@ -517,14 +482,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.0.2" - platform: - dependency: transitive - description: - name: platform - sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" - url: "https://pub.dev" - source: hosted - version: "3.1.5" pool: dependency: transitive description: @@ -533,14 +490,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" - process: - dependency: transitive - description: - name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" - url: "https://pub.dev" - source: hosted - version: "4.2.4" pub_semver: dependency: transitive description: @@ -549,14 +498,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - pub_updater: - dependency: transitive - description: - name: pub_updater - sha256: b06600619c8c219065a548f8f7c192b3e080beff95488ed692780f48f69c0625 - url: "https://pub.dev" - source: hosted - version: "0.3.1" pubspec_parse: dependency: transitive description: @@ -634,14 +575,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" - sprintf: - dependency: transitive - description: - name: sprintf - sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" - url: "https://pub.dev" - source: hosted - version: "7.0.0" stack_trace: dependency: transitive description: @@ -714,14 +647,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" - uuid: - dependency: transitive - description: - name: uuid - sha256: "83d37c7ad7aaf9aa8e275490669535c8080377cfa7a7004c24dfac53afffaa90" - url: "https://pub.dev" - source: hosted - version: "4.4.2" vector_graphics_codec: dependency: transitive description: @@ -818,5 +743,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.5.3 <4.0.0" - flutter: ">=3.24.3" + dart: ">=3.6.0 <4.0.0" + flutter: ">=3.27.1" diff --git a/packages/world_countries/example/pubspec.yaml b/packages/world_countries/example/pubspec.yaml index 87a3ab25..1641c918 100644 --- a/packages/world_countries/example/pubspec.yaml +++ b/packages/world_countries/example/pubspec.yaml @@ -5,8 +5,8 @@ version: 2.0.2+0 # Should run on Flutter v3.27 or higher, because of SearchController bug. environment: - sdk: ^3.5.3 - flutter: ^3.24.3 + sdk: ^3.6.0 + flutter: ^3.27.1 dependencies: flutter: @@ -21,8 +21,7 @@ dependencies: path: ../ dev_dependencies: - build_runner: ^2.4.13 # From Google - dart_code_linter: ^1.1.5 # Ex-DCM. + build_runner: ^2.4.14 # From Google dart_code_metrics_presets: ^2.19.0 dhttpd: ^4.1.0 # From Google flutter_gen_runner: ^5.8.0 diff --git a/packages/world_countries/pubspec.yaml b/packages/world_countries/pubspec.yaml index c6ee51c4..5fff0b97 100644 --- a/packages/world_countries/pubspec.yaml +++ b/packages/world_countries/pubspec.yaml @@ -41,13 +41,12 @@ dependencies: dev_dependencies: _sealed_world_tests: path: ../_sealed_world_tests - build_runner: ^2.4.13 # From Google - dart_code_linter: ^1.1.5 # Ex-DCM. - dart_code_metrics_presets: ^2.17.0 + build_runner: ^2.4.14 # From Google + dart_code_metrics_presets: ^2.19.0 flutter_gen_runner: ^5.8.0 flutter_test: # From Google sdk: flutter - lints: ^5.0.0 # From Google + lints: ^5.1.1 # From Google flutter: uses-material-design: true # Pickers using the Material icon font. diff --git a/packages/world_flags/example/pubspec.lock b/packages/world_flags/example/pubspec.lock index 33eb8d96..3cbd0613 100644 --- a/packages/world_flags/example/pubspec.lock +++ b/packages/world_flags/example/pubspec.lock @@ -232,5 +232,5 @@ packages: source: path version: "1.1.1" sdks: - dart: ">=3.5.3 <4.0.0" - flutter: ">=3.24.3" + dart: ">=3.6.0 <4.0.0" + flutter: ">=3.27.1" diff --git a/packages/world_flags/example/pubspec.yaml b/packages/world_flags/example/pubspec.yaml index cf2a3164..4319574f 100644 --- a/packages/world_flags/example/pubspec.yaml +++ b/packages/world_flags/example/pubspec.yaml @@ -5,8 +5,8 @@ publish_to: none version: 1.1.1+0 environment: - sdk: ^3.5.3 - flutter: ^3.24.3 + sdk: ^3.6.0 + flutter: ^3.27.1 dependencies: flutter: diff --git a/packages/world_flags/pubspec.yaml b/packages/world_flags/pubspec.yaml index 8fe3f535..d805f717 100644 --- a/packages/world_flags/pubspec.yaml +++ b/packages/world_flags/pubspec.yaml @@ -24,12 +24,11 @@ dev_dependencies: _sealed_world_tests: path: ../_sealed_world_tests arabic_font: ^0.0.9 - dart_code_linter: ^1.1.5 # Ex-DCM. - dart_code_metrics_presets: ^2.17.0 + dart_code_metrics_presets: ^2.19.0 flutter_test: # From Google sdk: flutter golden_toolkit: ^0.15.0 # From eBay - lints: ^5.0.0 # From Google + lints: ^5.1.1 # From Google screenshots: - description: "Example of usage" diff --git a/tools/analysis_options.yaml b/tools/analysis_options.yaml index 13f498d0..31a6e220 100644 --- a/tools/analysis_options.yaml +++ b/tools/analysis_options.yaml @@ -5,7 +5,7 @@ linter: public_member_api_docs: false curly_braces_in_flow_control_structures: false -dart_code_linter: +dart_code_metrics: rules: - prefer-moving-to-variable: allowed-duplicated-chains: 3 diff --git a/tools/pubspec.yaml b/tools/pubspec.yaml index 2c5fb0d3..bae5e12f 100644 --- a/tools/pubspec.yaml +++ b/tools/pubspec.yaml @@ -4,19 +4,19 @@ version: 0.0.3 publish_to: none environment: - sdk: ^3.5.3 + sdk: ^3.6.0 dependencies: args: ^2.6.0 change_case: ^2.1.0 - collection: ^1.19.0 - path: ^1.9.0 + collection: ^1.19.1 + path: ^1.9.1 pure_dart_ui: ^0.1.10 rw_git: ^1.0.3 sealed_countries: path: ../packages/sealed_countries select_annotation: ^0.2.0 - yaml: ^3.1.2 + yaml: ^3.1.3 dependency_overrides: sealed_currencies: @@ -25,6 +25,5 @@ dependency_overrides: path: ../packages/sealed_languages dev_dependencies: - build_runner: ^2.4.13 # From Google - dart_code_linter: ^1.1.5 # Ex-DCM. - dart_code_metrics_presets: ^2.17.0 + build_runner: ^2.4.14 # From Google + dart_code_metrics_presets: ^2.19.0 From 48e5429bd6b44dbf85d3e6c1ede9e82cfc93340e Mon Sep 17 00:00:00 2001 From: Roman Cinis <52065414+tsinis@users.noreply.github.com> Date: Thu, 26 Dec 2024 21:01:29 +0100 Subject: [PATCH 2/6] fix(lints): fix linter issues --- .../lib/src/model/country/submodels/world_country.dart | 1 + .../lib/src/model/regional_bloc/regional_bloc.dart | 1 + .../lib/src/model/currency/submodels/fiat_currency.dart | 1 + .../extensions/iso_standardized_string_extension.dart | 8 ++++---- .../src/model/language/submodels/natural_language.dart | 1 + .../submodels/natural_language_family.dart | 1 + .../lib/src/model/script/submodels/script.dart | 2 ++ .../world_countries/example/lib/routing/delegate.dart | 1 + .../world_countries/example/lib/theme/theme_manager.dart | 1 - .../world_countries/example/lib/theme/theme_provider.dart | 3 ++- .../example/lib/widgets/description_tile.dart | 2 +- .../world_countries/example/lib/widgets/tab_body.dart | 6 ++++-- .../lib/src/extensions/typed_locale_extension.dart | 4 ++-- .../lib/src/interfaces/indexed_list_view_interface.dart | 1 - .../lib/src/widgets/country/country_picker.dart | 2 +- .../lib/src/widgets/currency/currency_picker.dart | 4 ++-- .../lib/src/widgets/language/language_picker.dart | 4 ++-- .../lib/src/widgets/phone_code/phone_code_picker.dart | 4 ++-- .../lib/src/widgets/pickers/basic_picker.dart | 2 +- .../lib/src/widgets/pickers/basic_picker_state.dart | 6 +++--- packages/world_flags/lib/src/model/typedefs.dart | 8 ++++---- packages/world_flags/lib/src/ui/country_flag.dart | 2 +- packages/world_flags/lib/src/ui/flags/basic_flag.dart | 2 +- .../lib/src/ui/painters/custom/taegukgi_painter.dart | 1 + tools/lib/utils/args_parser.dart | 5 ++--- tools/lib/utils/json_utils.dart | 4 ++-- 26 files changed, 43 insertions(+), 34 deletions(-) diff --git a/packages/sealed_countries/lib/src/model/country/submodels/world_country.dart b/packages/sealed_countries/lib/src/model/country/submodels/world_country.dart index 3f874884..9e8008e0 100644 --- a/packages/sealed_countries/lib/src/model/country/submodels/world_country.dart +++ b/packages/sealed_countries/lib/src/model/country/submodels/world_country.dart @@ -213,6 +213,7 @@ class WorldCountry extends Country factory WorldCountry.fromCodeNumeric( Object codeNumeric, [ Iterable? countries, + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. ]) { if (countries == null) return codeNumericMap.findByCodeOrThrow(codeNumeric); final trimmedCode = codeNumeric.toUpperCaseIsoCode(); diff --git a/packages/sealed_countries/lib/src/model/regional_bloc/regional_bloc.dart b/packages/sealed_countries/lib/src/model/regional_bloc/regional_bloc.dart index 7d9afbc9..b78fadfb 100644 --- a/packages/sealed_countries/lib/src/model/regional_bloc/regional_bloc.dart +++ b/packages/sealed_countries/lib/src/model/regional_bloc/regional_bloc.dart @@ -40,6 +40,7 @@ class RegionalBloc extends WorldBloc { factory RegionalBloc.fromAcronym( Object acronym, [ Iterable? blocs, + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. ]) { final string = acronym.toUpperCaseIsoCode(); if (blocs == null) return map[string]!; diff --git a/packages/sealed_currencies/lib/src/model/currency/submodels/fiat_currency.dart b/packages/sealed_currencies/lib/src/model/currency/submodels/fiat_currency.dart index 80cdfaa0..5180d9fa 100644 --- a/packages/sealed_currencies/lib/src/model/currency/submodels/fiat_currency.dart +++ b/packages/sealed_currencies/lib/src/model/currency/submodels/fiat_currency.dart @@ -152,6 +152,7 @@ class FiatCurrency extends Currency factory FiatCurrency.fromName( Object name, [ Iterable currencies = listExtended, + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. ]) { final upperCaseName = name.toUpperCaseIsoCode(); diff --git a/packages/sealed_languages/lib/src/helpers/extensions/iso_standardized_string_extension.dart b/packages/sealed_languages/lib/src/helpers/extensions/iso_standardized_string_extension.dart index 92a17844..c513339d 100644 --- a/packages/sealed_languages/lib/src/helpers/extensions/iso_standardized_string_extension.dart +++ b/packages/sealed_languages/lib/src/helpers/extensions/iso_standardized_string_extension.dart @@ -108,13 +108,13 @@ extension IsoStandardizedStringExtension on String { T Function(String code)? regular, T Function(String code)? short, }) { - final code = minLength == maxLength + final code = (minLength == maxLength) ? maybeToValidIsoCode(exactLength: minLength) : maybeToValidIsoCode(maxLength: maxLength, minLength: minLength); if (code == null) return orElse(this); return code.length == IsoStandardized.codeShortLength - ? short?.call(code.toUpperCase()) ?? orElse(code) + ? (short?.call(code.toUpperCase()) ?? orElse(code)) : _onNumericOrRegular(code, orElse, regular: regular, numeric: numeric); } @@ -127,7 +127,7 @@ extension IsoStandardizedStringExtension on String { if (numeric == null && regular == null) return orElse(code); return RegExp("[a-z]", caseSensitive: false).hasMatch(code) - ? regular?.call(code) ?? orElse(code) - : numeric?.call(code) ?? orElse(code); + ? (regular?.call(code) ?? orElse(code)) + : (numeric?.call(code) ?? orElse(code)); } } diff --git a/packages/sealed_languages/lib/src/model/language/submodels/natural_language.dart b/packages/sealed_languages/lib/src/model/language/submodels/natural_language.dart index a1d11205..0a8c11dd 100644 --- a/packages/sealed_languages/lib/src/model/language/submodels/natural_language.dart +++ b/packages/sealed_languages/lib/src/model/language/submodels/natural_language.dart @@ -167,6 +167,7 @@ class NaturalLanguage extends Language factory NaturalLanguage.fromName( Object name, [ Iterable languages = list, + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. ]) { final upperCaseName = name.toUpperCaseIsoCode(); diff --git a/packages/sealed_languages/lib/src/model/language_family/submodels/natural_language_family.dart b/packages/sealed_languages/lib/src/model/language_family/submodels/natural_language_family.dart index 50a5a93d..e7977be7 100644 --- a/packages/sealed_languages/lib/src/model/language_family/submodels/natural_language_family.dart +++ b/packages/sealed_languages/lib/src/model/language_family/submodels/natural_language_family.dart @@ -31,6 +31,7 @@ class NaturalLanguageFamily extends LanguageFamily { factory NaturalLanguageFamily.fromName( String name, [ Iterable families = list, + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. ]) { assert(families.isNotEmpty, "`families` should not be empty!"); diff --git a/packages/sealed_languages/lib/src/model/script/submodels/script.dart b/packages/sealed_languages/lib/src/model/script/submodels/script.dart index db0d7e29..9ea4b6b5 100644 --- a/packages/sealed_languages/lib/src/model/script/submodels/script.dart +++ b/packages/sealed_languages/lib/src/model/script/submodels/script.dart @@ -52,6 +52,7 @@ class Script extends WritingSystem /// {@macro optional_instances_array_parameter} /// This method returns the [Script] instance that corresponds to the /// given code, or throws a [StateError] if no such instance exists. + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. factory Script.fromCode(Object code, [Iterable