From 0fdb0e110494381b5792c7a20c4fca691f66ff03 Mon Sep 17 00:00:00 2001 From: Luke Walton Date: Thu, 2 Jan 2025 16:06:15 +0000 Subject: [PATCH] chore: Update rules (#1) ci: Add release please --- .github/CODEOWNERS | 1 + .github/workflows/on-main.yml | 17 ++++++++ .github/workflows/on-release.yml | 29 +++++++++++++ .release-please-manifest.json | 3 ++ lib/all_lint_rules.yaml | 20 +++++---- lib/analysis_options.3.1.yaml | 5 ++- lib/analysis_options_lib.yaml | 2 + lib/analysis_options_strict.3.1.yaml | 8 +++- pubspec.yaml | 2 +- release-please-config.json | 63 ++++++++++++++++++++++++++++ 10 files changed, 139 insertions(+), 11 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/on-main.yml create mode 100644 .github/workflows/on-release.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..e85d5a6 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @ZebraDevs/front-end-devs @thelukewalton @ps9310 @mikecoomber \ No newline at end of file diff --git a/.github/workflows/on-main.yml b/.github/workflows/on-main.yml new file mode 100644 index 0000000..2a3a0e6 --- /dev/null +++ b/.github/workflows/on-main.yml @@ -0,0 +1,17 @@ +name: CI - On Main +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + with: + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml new file mode 100644 index 0000000..1b5fd0e --- /dev/null +++ b/.github/workflows/on-release.yml @@ -0,0 +1,29 @@ +name: CI - On Release +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+*" + +jobs: + check-package: + runs-on: ubuntu-latest + permissions: + id-token: write + environment: pub.dev + steps: + - uses: actions/checkout@v4 + - uses: dart-lang/setup-dart@v1 + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + cache: true + channel: stable + flutter-version: 3.27.x + - name: Install dependencies + run: flutter pub get + - name: Format code + run: dart format --fix . + - name: Check Publish Warnings + run: dart pub publish --dry-run + - name: Publish + run: dart pub publish --force diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..fea3454 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.0.0" +} \ No newline at end of file diff --git a/lib/all_lint_rules.yaml b/lib/all_lint_rules.yaml index 25bc9d9..6db718a 100644 --- a/lib/all_lint_rules.yaml +++ b/lib/all_lint_rules.yaml @@ -1,15 +1,15 @@ -# Retrieved from https://dart.dev/tools/linter-rules/all 05-Oct-23 -# TODO: Automate this +# Retrieved from https://dart.dev/tools/linter-rules/all 02-Jan-25 +# TODO(UX-1354): Automate this linter: rules: - always_declare_return_types - always_put_control_body_on_new_line - always_put_required_named_parameters_first - - always_require_non_null_named_parameters - always_specify_types - always_use_package_imports - annotate_overrides + - annotate_redeclares - avoid_annotating_with_dynamic - avoid_bool_literals_in_conditional_expressions - avoid_catches_without_on_clauses @@ -23,6 +23,7 @@ linter: - avoid_field_initializers_in_const_classes - avoid_final_parameters - avoid_function_literals_in_foreach_calls + - avoid_futureor_void - avoid_implementing_value_types - avoid_init_to_null - avoid_js_rounded_ints @@ -35,8 +36,6 @@ linter: - avoid_relative_lib_imports - avoid_renaming_method_parameters - avoid_return_types_on_setters - - avoid_returning_null - - avoid_returning_null_for_future - avoid_returning_null_for_void - avoid_returning_this - avoid_setters_without_getters @@ -72,6 +71,7 @@ linter: - directives_ordering - discarded_futures - do_not_use_environment + - document_ignores - empty_catches - empty_constructor_bodies - empty_statements @@ -84,7 +84,7 @@ linter: - implicit_call_tearoffs - implicit_reopen - invalid_case_patterns - - iterable_contains_unrelated_type + - invalid_runtime_check_with_js_interop_types - join_return_with_assignment - leading_newlines_in_multiline_strings - library_annotations @@ -92,9 +92,9 @@ linter: - library_prefixes - library_private_types_in_public_api - lines_longer_than_80_chars - - list_remove_unrelated_type - literal_only_boolean_expressions - matching_super_parameters + - missing_code_block_language_in_doc_comment - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - no_default_cases @@ -111,6 +111,7 @@ linter: - null_check_on_nullable_type_parameter - null_closures - omit_local_variable_types + - omit_obvious_local_variable_types - one_member_abstracts - only_throw_errors - overridden_fields @@ -169,6 +170,7 @@ linter: - sort_constructors_first - sort_pub_dependencies - sort_unnamed_constructors_first + - specify_nonobvious_local_variable_types - test_types_in_equals - throw_in_finally - tighten_type_of_initializing_formals @@ -176,6 +178,7 @@ linter: - type_init_formals - type_literal_in_constant_pattern - unawaited_futures + - unintended_html_in_doc_comment - unnecessary_await_in_return - unnecessary_brace_in_string_interps - unnecessary_breaks @@ -186,6 +189,7 @@ linter: - unnecessary_lambdas - unnecessary_late - unnecessary_library_directive + - unnecessary_library_name - unnecessary_new - unnecessary_null_aware_assignments - unnecessary_null_aware_operator_on_extension_on_nullable @@ -202,7 +206,6 @@ linter: - unnecessary_to_list_in_spreads - unreachable_from_main - unrelated_type_equality_checks - - unsafe_html - use_build_context_synchronously - use_colored_box - use_decorated_box @@ -222,5 +225,6 @@ linter: - use_super_parameters - use_test_throws_matchers - use_to_and_as_if_applicable + - use_truncating_division - valid_regexps - void_checks diff --git a/lib/analysis_options.3.1.yaml b/lib/analysis_options.3.1.yaml index a973198..40be812 100644 --- a/lib/analysis_options.3.1.yaml +++ b/lib/analysis_options.3.1.yaml @@ -197,4 +197,7 @@ linter: - use_test_throws_matchers - use_to_and_as_if_applicable - valid_regexps - - void_checks \ No newline at end of file + - void_checks + - invalid_runtime_check_with_js_interop_types + - unintended_html_in_doc_comment + - unnecessary_library_name diff --git a/lib/analysis_options_lib.yaml b/lib/analysis_options_lib.yaml index 6cf88de..b31c5de 100644 --- a/lib/analysis_options_lib.yaml +++ b/lib/analysis_options_lib.yaml @@ -39,3 +39,5 @@ linter: unnecessary_final: false avoid_annotating_with_dynamic: false avoid_catches_without_on_clauses: false + specify_nonobvious_local_variable_types: false + omit_obvious_local_variable_types: false diff --git a/lib/analysis_options_strict.3.1.yaml b/lib/analysis_options_strict.3.1.yaml index a307151..6abd89c 100644 --- a/lib/analysis_options_strict.3.1.yaml +++ b/lib/analysis_options_strict.3.1.yaml @@ -202,4 +202,10 @@ linter: - use_test_throws_matchers - use_to_and_as_if_applicable - valid_regexps - - void_checks \ No newline at end of file + - void_checks + - document_ignores + - invalid_runtime_check_with_js_interop_types + - missing_code_block_language_in_doc_comment + - unintended_html_in_doc_comment + - unnecessary_library_name + - use_truncating_division diff --git a/pubspec.yaml b/pubspec.yaml index c889fa5..27c91af 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: zds_analysis description: Lint rules for Dart and Flutter used internally at Zebra Technologies homepage: https://github.com/ZebraDevs/zds_analysis repository: https://github.com/ZebraDevs/zds_analysis -issue_tracker: https://github.com/zebradevs/zds_analysis/issues +issue_tracker: https://github.com/ZebraDevs/zds_analysis version: 1.0.0 environment: diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..816af8f --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,63 @@ +{ + "packages": { + ".": { + "release-type": "dart" + } + }, + "include-component-in-tag": false, + "changelog-sections": [ + { + "type": "feat", + "section": "โœจ New Features" + }, + { + "type": "fix", + "section": "๐Ÿชฒ Bug Fixes" + }, + { + "type": "revert", + "section": "๐Ÿ‘€ Reverts" + }, + { + "type": "docs", + "section": "๐Ÿ“ˆ Documentation" + }, + { + "type": "deps", + "section": "โ›“๏ธ Dependencies" + }, + { + "type": "test", + "section": "๐Ÿงช Tests" + }, + { + "type": "chore", + "section": "๐Ÿงน Miscellaneous Chores" + }, + { + "type": "perf", + "section": "Performance Improvements", + "hidden": true + }, + { + "type": "refactor", + "section": "Code Refactoring", + "hidden": true + }, + { + "type": "style", + "section": "Styles", + "hidden": true + }, + { + "type": "build", + "section": "Build System", + "hidden": true + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ] +} \ No newline at end of file