From 00404b8ce958e9090eeedb05238ff8e7e8d0c289 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 17:26:14 +0000 Subject: [PATCH 1/3] chore: replace DCM with the bitwild_analysis presets Move the shared options to a root analysis_options.yaml that includes the bitwild_analysis v0.3.0 presets and the bitwild_lints analyzer plugin from btwld/lints. Remove the DCM config, melos scripts and dependencies, and run the plugin in CI through melos run analyze. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01QEFHxKAKfcCJWc6pQDZL25 --- .claude/settings.json | 1 - .github/workflows/test.yml | 6 +- AGENTS.md | 7 +- analysis_options.yaml | 74 ++++++++++++++++++++++ demo/analysis_options.yaml | 8 +-- demo/pubspec.yaml | 15 ++--- packages/builder/analysis_options.yaml | 8 +-- packages/builder/pubspec.yaml | 4 +- packages/cli/analysis_options.yaml | 4 +- packages/cli/pubspec.yaml | 12 ++-- packages/core/analysis_options.yaml | 4 +- packages/core/pubspec.yaml | 14 ++-- packages/playground/analysis_options.yaml | 64 +------------------ packages/playground/pubspec.yaml | 2 - packages/plugins/pdf/analysis_options.yaml | 11 ++-- packages/plugins/pdf/pubspec.yaml | 4 +- packages/superdeck/analysis_options.yaml | 11 ++-- packages/superdeck/pubspec.yaml | 34 +++++----- pubspec.lock | 17 ++--- pubspec.yaml | 57 ++++------------- shared_analysis_options.yaml | 60 ------------------ 21 files changed, 156 insertions(+), 261 deletions(-) create mode 100644 analysis_options.yaml delete mode 100644 shared_analysis_options.yaml diff --git a/.claude/settings.json b/.claude/settings.json index 863afc795..81bdd992e 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -18,7 +18,6 @@ "Bash(test:*)", "Bash(sort:*)", "Bash(wc:*)", - "Bash(dcm:*)", "mcp__plugin_playwright_playwright__browser_navigate", "mcp__plugin_playwright_playwright__browser_console_messages" ] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4069cc49..df893719c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,10 +54,10 @@ jobs: timeout-minutes: 5 # Runs what maintainers run: `dart analyze --fatal-infos` over every - # package, after code generation so generated files exist. DCM is the - # other half of `melos run analyze` and is not run here yet. + # package, with the bitwild_lints plugin, after code generation so + # generated files exist. - name: Analyze - run: melos run analyze:dart --no-select + run: melos run analyze --no-select - name: Check Contract Schemas run: melos run contracts:check --no-select diff --git a/AGENTS.md b/AGENTS.md index a030eb15a..d46ea1817 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -53,9 +53,8 @@ Always work inside the FVM-provided SDK (`.fvm/flutter_sdk`) to avoid toolchain ### Analysis & Linting ```bash -fvm dart run melos run analyze # Run dart analyze + DCM analysis -fvm dart run melos run analyze:all # Full analysis including unused code/files -fvm dart run melos run fix # Apply dart fix + DCM autofixes +fvm dart run melos run analyze # Run dart analyze with the bitwild_lints plugin +fvm dart run melos run fix # Apply dart fix ``` ### Code Generation @@ -140,7 +139,7 @@ fvm dart run melos run clean # Clean all Flutter build artifacts - Keep widgets focused; colocate private helpers with their widget - Run `melos run fix` before committing -### Member Ordering (enforced by DCM) +### Member Ordering (convention; `bitwild_lints/sort_class_members` can check it) 1. Public fields 2. Private fields 3. Constructors diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 000000000..9179db22f --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,74 @@ +# Shared analyzer configuration for every package in the SuperDeck workspace. +# Each package's analysis_options.yaml includes this file. The presets and the +# bitwild_lints plugin come from https://github.com/btwld/lints. +# +# plugin.yaml turns on the plugin's recommended rules. plugin_all.yaml would +# also turn on the ordering and formatting conventions, which report about +# 1,700 issues on the current code. +include: + - package:bitwild_analysis/dart.yaml + - package:bitwild_analysis/plugin.yaml + +analyzer: + # The strict modes were off before the shared presets. Turning them on + # reports about 40 issues; do that in a separate change. + language: + strict-casts: false + strict-inference: false + strict-raw-types: false + errors: + invalid_annotation_target: ignore + body_might_complete_normally_nullable: ignore + exclude: + - '**/generated_plugin_registrant.dart' + - '**/*.g.dart' + - '**/*.ack.dart' + # Vendored third-party code keeps its upstream style. + - '**/vendor/**' + +linter: + rules: + public_member_api_docs: false + always_use_package_imports: false + prefer_relative_imports: true + prefer_initializing_formals: false + library_private_types_in_public_api: false + # Conflicts with unnecessary_parenthesis; bitwild_analysis 0.4.0 drops it. + no_adjacent_strings_in_list: false + # Reports 65 dynamic calls, mostly on decoded JSON and YAML. Fix them in a + # separate change. + avoid_dynamic_calls: false + +# Member order, as in AGENTS.md, for sort_class_members. The rule is in +# plugin_all.yaml, not plugin.yaml. Widgets and States use the same order, so +# `build` stays last. +bitwild_lints: + sort_class_members: + order: + - public-fields + - private-fields + - constructors + - static-methods + - private-methods + - private-getters + - private-setters + - public-getters + - public-setters + - public-methods + - overridden-public-methods + - overridden-public-getters + - build-method + widgets-order: + - public-fields + - private-fields + - constructors + - static-methods + - private-methods + - private-getters + - private-setters + - public-getters + - public-setters + - public-methods + - overridden-public-methods + - overridden-public-getters + - build-method diff --git a/demo/analysis_options.yaml b/demo/analysis_options.yaml index 8ffc0b4e6..f2a559228 100644 --- a/demo/analysis_options.yaml +++ b/demo/analysis_options.yaml @@ -1,3 +1,7 @@ +include: + - ../analysis_options.yaml + - package:bitwild_analysis/flutter.yaml + analyzer: exclude: - build/** @@ -7,7 +11,3 @@ analyzer: - windows/** - macos/** - linux/** -include: - - package:flutter_lints/flutter.yaml - - ../shared_analysis_options.yaml - diff --git a/demo/pubspec.yaml b/demo/pubspec.yaml index 392d4de90..4486e058e 100644 --- a/demo/pubspec.yaml +++ b/demo/pubspec.yaml @@ -9,26 +9,25 @@ environment: resolution: workspace dependencies: - flutter: - sdk: flutter ack: ^1.6.2 ack_annotations: ^1.6.2 + flutter: + sdk: flutter google_fonts: ^8.2.1 mesh: ^0.5.0 mix: ^2.2.0-beta.0 - superdeck_core: ^1.0.0 - superdeck: ^1.0.0 - signals_flutter: ^7.1.0 naked_ui: ^1.0.0-beta.4 remix: ^1.0.0-beta.1 + signals_flutter: ^7.1.0 + superdeck: ^1.0.0 + superdeck_core: ^1.0.0 dev_dependencies: + ack_generator: ^1.6.2 + build_runner: ^2.5.4 flutter_test: sdk: flutter integration_test: sdk: flutter - flutter_lints: ^6.0.0 - build_runner: ^2.5.4 - ack_generator: ^1.6.2 superdeck_builder: ^1.0.0 superdeck_cli: ^1.0.0 superdeck_pdf: ^1.0.0 diff --git a/packages/builder/analysis_options.yaml b/packages/builder/analysis_options.yaml index 7f6b9f428..f04c6cf0f 100644 --- a/packages/builder/analysis_options.yaml +++ b/packages/builder/analysis_options.yaml @@ -1,7 +1 @@ -include: - - package:lints/recommended.yaml - - ../../shared_analysis_options.yaml - -linter: - rules: - prefer_initializing_formals: false +include: ../../analysis_options.yaml diff --git a/packages/builder/pubspec.yaml b/packages/builder/pubspec.yaml index 8fb2a80d6..2fe24e6c0 100644 --- a/packages/builder/pubspec.yaml +++ b/packages/builder/pubspec.yaml @@ -10,11 +10,9 @@ environment: resolution: workspace dependencies: - superdeck_core: ^1.0.0 logging: ^1.3.0 path: ^1.9.0 + superdeck_core: ^1.0.0 dev_dependencies: - lints: ^6.1.0 test: ^1.25.8 - dart_code_metrics_presets: ^2.33.0 diff --git a/packages/cli/analysis_options.yaml b/packages/cli/analysis_options.yaml index 8d1275e09..f04c6cf0f 100644 --- a/packages/cli/analysis_options.yaml +++ b/packages/cli/analysis_options.yaml @@ -1,3 +1 @@ -include: - - package:lints/recommended.yaml - - ../../shared_analysis_options.yaml +include: ../../analysis_options.yaml diff --git a/packages/cli/pubspec.yaml b/packages/cli/pubspec.yaml index c46d36254..43db08353 100644 --- a/packages/cli/pubspec.yaml +++ b/packages/cli/pubspec.yaml @@ -12,16 +12,14 @@ environment: resolution: workspace dependencies: - yaml: ^3.1.4 args: ^2.6.0 - path: ^1.9.0 - yaml_writer: ^2.0.1 + mason_logger: ^0.3.6 meta: ^1.16.0 - superdeck_core: ^1.0.0 + path: ^1.9.0 superdeck_builder: ^1.0.0 - mason_logger: ^0.3.6 + superdeck_core: ^1.0.0 + yaml: ^3.1.4 + yaml_writer: ^2.0.1 dev_dependencies: - dart_code_metrics_presets: ^2.33.0 - lints: ^6.1.0 test: ^1.25.8 diff --git a/packages/core/analysis_options.yaml b/packages/core/analysis_options.yaml index 8d1275e09..f04c6cf0f 100644 --- a/packages/core/analysis_options.yaml +++ b/packages/core/analysis_options.yaml @@ -1,3 +1 @@ -include: - - package:lints/recommended.yaml - - ../../shared_analysis_options.yaml +include: ../../analysis_options.yaml diff --git a/packages/core/pubspec.yaml b/packages/core/pubspec.yaml index d0fdc047f..ab8a96631 100644 --- a/packages/core/pubspec.yaml +++ b/packages/core/pubspec.yaml @@ -12,17 +12,15 @@ resolution: workspace # Add regular dependencies here. dependencies: - yaml: ^3.1.4 - collection: ^1.18.0 - path: ^1.9.0 ack: ^1.6.2 ack_annotations: ^1.6.2 - markdown: ^7.3.0 + collection: ^1.18.0 logging: ^1.3.0 + markdown: ^7.3.0 + path: ^1.9.0 + yaml: ^3.1.4 dev_dependencies: - lints: ^6.1.0 - test: ^1.24.0 - dart_code_metrics_presets: ^2.33.0 - build_runner: ^2.5.4 ack_generator: ^1.6.2 + build_runner: ^2.5.4 + test: ^1.24.0 diff --git a/packages/playground/analysis_options.yaml b/packages/playground/analysis_options.yaml index ea8de9c37..244cd0411 100644 --- a/packages/playground/analysis_options.yaml +++ b/packages/playground/analysis_options.yaml @@ -1,65 +1,7 @@ -include: package:flutter_lints/flutter.yaml +include: + - ../../analysis_options.yaml + - package:bitwild_analysis/flutter.yaml -linter: - rules: - prefer_relative_imports: true - prefer_initializing_formals: false - -dcm: - extends: - - recommended - - metrics-recommended - exclude: - metrics: - - test/** - - test_live/** - rules: - - test/** - - test_live/** - unused-code: - - test/** - - test_live/** - unused-files: - - test/** - - test_live/** - rules: - - newline-before-return - - avoid-importing-entrypoint-exports: - only-in-src: true - - prefer-match-file-name: false - - prefer-overriding-parent-equality: false - - prefer-correct-callback-field-name: false - - prefer-single-widget-per-file: false - - match-getter-setter-field-names: false - - prefer-dedicated-media-query-methods: false - - avoid-shadowing: false - - avoid-accessing-collections-by-constant-index: false - - enum-constants-ordering: false - - avoid-unsafe-collection-methods: false - - prefer-prefixed-global-constants: false - - avoid-returning-widgets: false - - arguments-ordering: - last: - - child - - avoid-nested-conditional-expressions: - acceptable-level: 3 - - member-ordering: - order: - - public-fields - - private-fields - - constructors - - static-methods - - private-methods - - private-getters - - private-setters - - public-getters - - public-setters - - public-methods - - overridden-public-methods - - overridden-public-getters - - build-method - - prefer-named-boolean-parameters: - ignore-single: true analyzer: exclude: - build/** diff --git a/packages/playground/pubspec.yaml b/packages/playground/pubspec.yaml index 26d575ead..77c6bc1bf 100644 --- a/packages/playground/pubspec.yaml +++ b/packages/playground/pubspec.yaml @@ -51,8 +51,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^6.0.0 - dart_code_metrics_presets: ^2.33.0 build_runner: ^2.5.4 ack_generator: ^1.6.2 http: ^1.5.0 diff --git a/packages/plugins/pdf/analysis_options.yaml b/packages/plugins/pdf/analysis_options.yaml index 147744308..32c0ac6e4 100644 --- a/packages/plugins/pdf/analysis_options.yaml +++ b/packages/plugins/pdf/analysis_options.yaml @@ -1,10 +1,7 @@ +include: + - ../../../analysis_options.yaml + - package:bitwild_analysis/flutter.yaml + analyzer: exclude: - build/** -include: - - package:flutter_lints/flutter.yaml - - ../../../shared_analysis_options.yaml - -linter: - rules: - prefer_initializing_formals: false diff --git a/packages/plugins/pdf/pubspec.yaml b/packages/plugins/pdf/pubspec.yaml index d00456e38..dd55ace98 100644 --- a/packages/plugins/pdf/pubspec.yaml +++ b/packages/plugins/pdf/pubspec.yaml @@ -11,9 +11,9 @@ environment: resolution: workspace dependencies: + file_saver: ^0.4.0 flutter: sdk: flutter - file_saver: ^0.4.0 pdf: ^3.13.1 signals: ^7.1.0 signals_flutter: ^7.1.0 @@ -22,8 +22,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^6.0.0 - dart_code_metrics_presets: ^2.33.0 google_fonts: ^8.2.1 superdeck_core: ^1.0.0 diff --git a/packages/superdeck/analysis_options.yaml b/packages/superdeck/analysis_options.yaml index c0cbc5574..9b249c8d7 100644 --- a/packages/superdeck/analysis_options.yaml +++ b/packages/superdeck/analysis_options.yaml @@ -1,10 +1,7 @@ +include: + - ../../analysis_options.yaml + - package:bitwild_analysis/flutter.yaml + analyzer: exclude: - build/** -include: - - package:flutter_lints/flutter.yaml - - ../../shared_analysis_options.yaml - -linter: - rules: - prefer_initializing_formals: false diff --git a/packages/superdeck/pubspec.yaml b/packages/superdeck/pubspec.yaml index 19f7c493a..153d325aa 100644 --- a/packages/superdeck/pubspec.yaml +++ b/packages/superdeck/pubspec.yaml @@ -11,41 +11,39 @@ environment: resolution: workspace dependencies: - flutter: - sdk: flutter cached_network_image: ^4.0.0 - window_manager: ^0.5.2 collection: ^1.18.0 - string_scanner: ^1.4.0 - path: ^1.9.0 + flutter: + sdk: flutter + flutter_markdown_plus: ^1.0.5 go_router: ^18.0.1 - path_provider: ^2.1.4 + google_fonts: ^8.2.1 + markdown: ^7.3.0 + mermaid_core: 0.3.0 + mermaid_flutter: 0.3.0 mix: ^2.2.0-beta.0 mix_annotations: ^2.2.0-beta.0 + path: ^1.9.0 + path_provider: ^2.1.4 + qr_flutter: ^4.1.0 remix: ^1.0.0-beta.1 - flutter_markdown_plus: ^1.0.5 - mermaid_core: 0.3.0 - mermaid_flutter: 0.3.0 + signals: ^7.1.0 + signals_flutter: ^7.1.0 + string_scanner: ^1.4.0 superdeck_core: ^1.0.0 - markdown: ^7.3.0 web: ^1.1.0 webview_flutter: ^4.10.0 webview_flutter_web: ^0.2.3 - google_fonts: ^8.2.1 - qr_flutter: ^4.1.0 - signals: ^7.1.0 - signals_flutter: ^7.1.0 + window_manager: ^0.5.2 dev_dependencies: + build_runner: ^2.5.4 flutter_test: sdk: flutter - flutter_lints: ^6.0.0 - dart_code_metrics_presets: ^2.33.0 - build_runner: ^2.5.4 mix_generator: 2.2.0-beta.0 path_provider_platform_interface: ^2.1.2 - webview_flutter_platform_interface: ^2.15.1 superdeck_builder: ^1.0.0 + webview_flutter_platform_interface: ^2.15.1 flutter: uses-material-design: true diff --git a/pubspec.lock b/pubspec.lock index b01cba938..f2c94c7f4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -169,6 +169,15 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" + bitwild_analysis: + dependency: "direct dev" + description: + path: "packages/bitwild_analysis" + ref: "v0.3.0" + resolved-ref: "5c638dc900d24cb1c3369c5e52ccf4b149abf7a5" + url: "https://github.com/btwld/lints.git" + source: git + version: "0.3.0" boolean_selector: dependency: transitive description: @@ -401,14 +410,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" - dart_code_metrics_presets: - dependency: transitive - description: - name: dart_code_metrics_presets - sha256: "9029dac0e2c62af8b8361f8d240e10cb023c11d7b9caaac2be85c77e4e63c486" - url: "https://pub.dev" - source: hosted - version: "2.33.0" dart_style: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2aaae566c..5d361268c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,6 +11,11 @@ workspace: - packages/plugins/* dev_dependencies: + bitwild_analysis: + git: + url: https://github.com/btwld/lints.git + path: packages/bitwild_analysis + ref: v0.3.0 # Keep in sync with `melos-version` in .github/workflows/*.yml. melos: 8.9.0 @@ -19,9 +24,9 @@ dependency_overrides: # branches. Resolve its runtime dependencies to the published betas used by # this workspace until that upstream migration is released. mix_annotations: 2.2.0-beta.0 - remix: 1.0.0-beta.1 # Remix beta.1 uses positioning and slider APIs removed in naked_ui 1.0.1. naked_ui: 1.0.0-beta.4 + remix: 1.0.0-beta.1 melos: sdkPath: .fvm/flutter_sdk @@ -32,54 +37,18 @@ melos: scripts: # ANALYSIS analyze: - run: fvm dart run melos run analyze:dart && fvm dart run melos run analyze:dcm - description: Run standard static analysis checks. - - analyze:all: - run: fvm dart run melos run analyze && fvm dart run melos run analyze:dcm:unused-files && fvm dart run melos run analyze:dcm:unused-code - description: Run all analysis checks including unused files and code. - - analyze:dart: run: fvm dart run melos exec -c 10 -- fvm dart analyze --fatal-infos - description: Run Dart static analysis checks. - - analyze:dcm: - run: fvm dart run melos exec -c 10 -- "dcm analyze . --fatal-style --fatal-warnings -e '{**/*.g.dart,**/*.ack.dart}'" - description: Run DCM static analysis checks. - packageFilters: - dependsOn: dart_code_metrics_presets - - analyze:dcm:unused-files: - # Public barrels/plugin entrypoints are not cleanup targets (--exclude-public-api). - # Generated-file excludes cover *.g.dart and *.ack.dart. - # Extra globs: tests + platform conditional files DCM misclassifies as unused. - # Quotes must survive melos exec so brace globs are not shell-expanded. - run: fvm dart run melos exec -c 10 -- "dcm check-unused-files . --fatal-unused --exclude-public-api -e '{**/*.g.dart,**/*.ack.dart,test/**,**/*_web.dart,**/*_stub.dart,**/*_io.dart}'" - description: Check for unused files using DCM (public API, generated, platform stubs excluded). - packageFilters: - dependsOn: dart_code_metrics_presets + description: >- + Run static analysis checks, including the bitwild_lints analyzer + plugin. - analyze:dcm:unused-code: - # Public API surface stays even if unused in-repo (--exclude-public-api). - # Same exclude set as unused-files (generated + platform stubs + tests). - run: fvm dart run melos exec -c 10 -- "dcm check-unused-code . --fatal-unused --exclude-public-api -e '{**/*.g.dart,**/*.ack.dart,test/**,**/*_web.dart,**/*_stub.dart,**/*_io.dart}'" - description: Check for unused code using DCM (public API, generated, platform stubs excluded). - packageFilters: - dependsOn: dart_code_metrics_presets + analyze:dart: + run: fvm dart run melos run analyze + description: Alias for analyze. fix: - run: fvm dart run melos run fix:dart && fvm dart run melos run fix:dcm - description: Run all static analysis checks and apply fixes. - - fix:dart: run: fvm dart run melos exec -- fvm dart fix --apply . - description: Run Dart static analysis checks. - - fix:dcm: - run: fvm dart run melos exec -- dcm fix . - description: Run DCM static analysis checks. - packageFilters: - dependsOn: dart_code_metrics_presets + description: Apply dart fix. Plugin quick fixes are applied from the IDE. build_runner:watch: run: fvm dart run melos exec --order-dependents -- fvm dart run build_runner watch diff --git a/shared_analysis_options.yaml b/shared_analysis_options.yaml deleted file mode 100644 index 2a225d740..000000000 --- a/shared_analysis_options.yaml +++ /dev/null @@ -1,60 +0,0 @@ -analyzer: - errors: - invalid_annotation_target: ignore - body_might_complete_normally_nullable: ignore - exclude: - - '**/generated_plugin_registrant.dart' - - '**/*.g.dart' -linter: - rules: - public_member_api_docs: false - always_use_package_imports: false - prefer_relative_imports: true - prefer_initializing_formals: false - library_private_types_in_public_api: false - -dart_code_metrics: - extends: - - package:dart_code_metrics_presets/recommended.yaml - - package:dart_code_metrics_presets/metrics_recommended.yaml - metrics-exclude: - - test/** - rules-exclude: - - test/** - rules: - # avoid-collection-mutating-methods: true - newline-before-return: true - avoid-importing-entrypoint-exports: - only-in-src: true - prefer-match-file-name: false - prefer-overriding-parent-equality: false - prefer-correct-callback-field-name: false - prefer-single-widget-per-file: false - match-getter-setter-field-names: false - prefer-dedicated-media-query-methods: false - avoid-shadowing: false - enum-constants-ordering: false - avoid-unsafe-collection-methods: false - prefer-prefixed-global-constants: false - avoid-returning-widgets: false - arguments-ordering: - child-last: true - avoid-nested-conditional-expressions: - acceptable-level: 3 - member-ordering: - order: - - public-fields - - private-fields - - constructors - - static-methods - - private-methods - - private-getters - - private-setters - - public-getters - - public-setters - - public-methods - - overridden-public-methods - - overridden-public-getters - - build-method - prefer-named-boolean-parameters: - ignore-single: true From 303d58fd6ca9b68c4a4998a08c8ead567a5d5d99 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 17:26:14 +0000 Subject: [PATCH 2/3] style: fix diagnostics from the shared lint presets Apply dart fix for the new rules, import defining files instead of the barrel, wrap fire-and-forget futures in unawaited and sort pubspecs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01QEFHxKAKfcCJWc6pQDZL25 --- demo/integration_test/layout_matrix_test.dart | 4 +- demo/integration_test/navigation_test.dart | 8 +- demo/lib/src/examples/button.dart | 2 +- demo/lib/src/examples/mix/animation.dart | 6 +- .../src/layout_showcase/showcase_style.dart | 6 +- demo/lib/src/style.dart | 2 +- demo/lib/src/widgets/demo_widgets.dart | 18 ++-- .../lib/src/parsers/markdown_parser.dart | 4 +- packages/builder/lib/superdeck_builder.dart | 3 +- packages/builder/test/public_api_test.dart | 4 +- .../test/src/parsers/block_parser_test.dart | 26 +++--- .../test/src/parsers/comment_parser_test.dart | 18 ++-- .../src/parsers/front_matter_parser_test.dart | 2 +- .../src/parsers/markdown_parser_test.dart | 4 +- .../test/src/parsers/section_parser_test.dart | 5 +- packages/cli/bin/main.dart | 2 +- .../cli/lib/src/commands/setup_command.dart | 2 +- packages/cli/lib/src/utils/logger.dart | 2 +- .../test/src/commands/build_command_test.dart | 2 +- packages/cli/test/src/runner_test.dart | 2 +- .../test/src/utils/update_pubspec_test.dart | 12 +-- packages/core/lib/src/deck/block_insets.dart | 2 +- packages/core/lib/src/deck/block_model.dart | 8 +- .../core/lib/src/deck/deck_build_status.dart | 4 +- .../core/lib/src/deck/deck_build_store.dart | 2 +- .../core/lib/src/deck/deck_workspace.dart | 2 +- packages/core/lib/src/deck/slide_model.dart | 4 +- .../core/lib/src/utils/generate_hash.dart | 4 +- packages/core/lib/superdeck_core.dart | 2 +- .../src/cache/asset_cache_store_test.dart | 2 +- .../test/src/deck/deck_build_store_test.dart | 2 +- .../src/deck/deck_format_exception_test.dart | 4 +- .../src/deck/deck_loader_events_test.dart | 2 +- .../test/src/markdown/markdown_json_test.dart | 92 +++++++++---------- .../src/markdown/markdown_syntaxes_test.dart | 23 +++-- .../test/src/utils/generate_hash_test.dart | 30 +++--- .../core/test/src/utils/pretty_json_test.dart | 8 +- .../core/tool/export_contract_schemas.dart | 4 +- .../pdf_export_dialog_golden_test.dart | 2 +- .../pdf/test/src/pdf_controller_test.dart | 2 +- .../pdf/test/src/pdf_export_screen_test.dart | 4 +- .../plugins/pdf/test/src/pdf_plugin_test.dart | 2 +- .../lib/src/deck/slide_page_content.dart | 4 +- .../builders/alert_element_builder.dart | 2 +- .../builders/code_element_builder.dart | 4 +- .../markdown/builders/mermaid_code_block.dart | 2 +- .../markdown_element_builders_registry.dart | 3 +- .../src/rendering/blocks/block_widget.dart | 6 +- .../src/rendering/layout_debug_overlay.dart | 8 +- .../lib/src/thumbnails/async_thumbnail.dart | 2 + .../lib/src/thumbnails/thumbnail_service.dart | 2 +- .../superdeck/lib/src/ui/superdeck_app.dart | 3 +- .../superdeck/lib/src/ui/tokens/colors.dart | 10 +- .../lib/src/ui/widgets/text_hero_flight.dart | 3 + .../lib/src/utils/app_initialization.dart | 12 ++- .../lib/src/utils/uri_validator.dart | 4 +- packages/superdeck/lib/superdeck.dart | 42 ++++----- .../test/goldens/slide_goldens_test.dart | 2 +- .../helpers/fake_slide_capture_service.dart | 2 +- .../test/helpers/slide_test_harness.dart | 4 +- packages/superdeck/test/public_api_test.dart | 2 +- .../thumbnail_capture_timing_test.dart | 2 +- .../test/src/deck/deck_controller_test.dart | 2 +- .../test/src/deck/navigation_events_test.dart | 16 ++-- .../slide_configuration_builder_test.dart | 8 +- .../src/deck/slide_configuration_test.dart | 2 +- .../test/src/deck/slide_template_test.dart | 3 + .../test/src/deck/template_resolver_test.dart | 28 +++--- .../text_element_builder_widget_test.dart | 14 +-- .../markdown/image_cache_resolution_test.dart | 6 +- .../image_element_rendering_test.dart | 12 +-- .../src/markdown/markdown_builders_test.dart | 20 ++-- .../src/markdown/markdown_helpers_test.dart | 12 +-- .../markdown/markdown_inline_spans_test.dart | 2 +- .../src/markdown/mermaid_code_block_test.dart | 4 +- .../src/markdown/mermaid_corpus_test.dart | 4 +- .../test/src/rendering/block_widget_test.dart | 6 +- .../test/src/rendering/slide_view_test.dart | 2 +- .../test/src/styling/block_variant_test.dart | 2 +- .../superdeck/test/src/ui/panels_test.dart | 18 ++-- .../test/src/ui/superdeck_app_test.dart | 2 +- 81 files changed, 317 insertions(+), 304 deletions(-) diff --git a/demo/integration_test/layout_matrix_test.dart b/demo/integration_test/layout_matrix_test.dart index 961b56e26..b8d028b1e 100644 --- a/demo/integration_test/layout_matrix_test.dart +++ b/demo/integration_test/layout_matrix_test.dart @@ -760,13 +760,13 @@ List _applyBlockFlex(List blocks, List? flex) { return [ for (var index = 0; index < blocks.length; index++) switch (blocks[index]) { - ContentBlock block => ContentBlock( + final ContentBlock block => ContentBlock( block.content, align: block.align, flex: flex[index], scrollable: block.scrollable, ), - WidgetBlock block => WidgetBlock( + final WidgetBlock block => WidgetBlock( name: block.name, args: block.args, align: block.align, diff --git a/demo/integration_test/navigation_test.dart b/demo/integration_test/navigation_test.dart index 7088362bf..cf98b6e07 100644 --- a/demo/integration_test/navigation_test.dart +++ b/demo/integration_test/navigation_test.dart @@ -69,10 +69,10 @@ void main() { final controller = await tester.pumpTestAppWithSlides(makeSlides(6)); // Fire multiple goToSlide calls without awaiting each - controller.presentation.goToSlide(5); - controller.presentation.goToSlide(2); - controller.presentation.goToSlide(4); - controller.presentation.goToSlide(1); + unawaited(controller.presentation.goToSlide(5)); + unawaited(controller.presentation.goToSlide(2)); + unawaited(controller.presentation.goToSlide(4)); + unawaited(controller.presentation.goToSlide(1)); // Let the transition duration and router settle await tester.pumpFor(const Duration(seconds: 2)); diff --git a/demo/lib/src/examples/button.dart b/demo/lib/src/examples/button.dart index bca7d8ab5..815c0a94f 100644 --- a/demo/lib/src/examples/button.dart +++ b/demo/lib/src/examples/button.dart @@ -26,7 +26,7 @@ class ButtonExample extends StatelessWidget { .minWidth(100) .mainAxisAlignment(MainAxisAlignment.center) .labelLetterSpacing(0.3) - .borderRadiusAll(Radius.circular(6)) + .borderRadiusAll(const Radius.circular(6)) .scale(1) .onDisabled( RemixButtonStyler() diff --git a/demo/lib/src/examples/mix/animation.dart b/demo/lib/src/examples/mix/animation.dart index 3431c5da1..1d99d9ed7 100644 --- a/demo/lib/src/examples/mix/animation.dart +++ b/demo/lib/src/examples/mix/animation.dart @@ -23,7 +23,7 @@ class _SwitchAnimationState extends State { .color(_trigger.value ? Colors.deepPurpleAccent : Colors.grey.shade300) .height(30) .width(65) - .borderRadiusAll(Radius.circular(40)) + .borderRadiusAll(const Radius.circular(40)) .alignment( _trigger.value ? Alignment.centerRight : Alignment.centerLeft, ) @@ -41,14 +41,14 @@ class _SwitchAnimationState extends State { ) .foregroundDecoration( BoxDecorationMix().borderRadius( - BorderRadiusMix.all(Radius.circular(40)), + BorderRadiusMix.all(const Radius.circular(40)), ), ) .borderRounded(40) .scale(0.85) .shadowOnly( color: Colors.black.withValues(alpha: 0.1), - offset: Offset(2, 4), + offset: const Offset(2, 4), blurRadius: 4, spreadRadius: 3, ) diff --git a/demo/lib/src/layout_showcase/showcase_style.dart b/demo/lib/src/layout_showcase/showcase_style.dart index fca341d83..529f505bc 100644 --- a/demo/lib/src/layout_showcase/showcase_style.dart +++ b/demo/lib/src/layout_showcase/showcase_style.dart @@ -72,14 +72,14 @@ SlideStyler showcaseBaseStyle() { strong: TextStyleMix(fontWeight: FontWeight.w800, color: _ink), em: TextStyleMix(fontStyle: FontStyle.italic, color: _coral), del: TextStyleMix( - color: Color(0xFF77737D), + color: const Color(0xFF77737D), decoration: TextDecoration.lineThrough, - decorationColor: Color(0xFFAAA6AF), + decorationColor: const Color(0xFFAAA6AF), ), link: TextStyleMix( color: _teal, decoration: TextDecoration.underline, - decorationColor: Color(0x9959D6C8), + decorationColor: const Color(0x9959D6C8), ), list: MarkdownListStyler( text: TextStyler().style( diff --git a/demo/lib/src/style.dart b/demo/lib/src/style.dart index 00878dfbb..c93de7a92 100644 --- a/demo/lib/src/style.dart +++ b/demo/lib/src/style.dart @@ -99,7 +99,7 @@ SlideStyler borderedStyle() { style: BorderStyle.solid, ), ), - borderRadius: BorderRadiusMix.all(Radius.circular(16)), + borderRadius: BorderRadiusMix.all(const Radius.circular(16)), ), ), ), diff --git a/demo/lib/src/widgets/demo_widgets.dart b/demo/lib/src/widgets/demo_widgets.dart index b104e9804..af67b0497 100644 --- a/demo/lib/src/widgets/demo_widgets.dart +++ b/demo/lib/src/widgets/demo_widgets.dart @@ -1,11 +1,11 @@ import 'package:flutter/widgets.dart'; import 'package:superdeck/superdeck.dart'; +import '../examples/button.dart' as remix_button; import '../examples/mix/animation.dart' as mix_animation; import '../examples/mix/box_with_variants.dart' as mix_variants; import '../examples/mix/simple_box.dart' as mix_simple_box; import '../examples/select.dart' as naked_select; -import '../examples/button.dart' as remix_button; import 'ack_metric_card.dart'; /// Auto-registered demo widgets for Superdeck presentations. @@ -29,22 +29,28 @@ import 'ack_metric_card.dart'; /// QR codes use the built-in `@qrcode` widget. Map get demoWidgets => { 'mix-simple-box': (_) => _DemoWrapper( - child: Transform.scale(scale: 3.0, child: mix_simple_box.Example()), + child: Transform.scale(scale: 3.0, child: const mix_simple_box.Example()), ), 'mix-variants': (_) => _DemoWrapper( - child: Transform.scale(scale: 3.0, child: mix_variants.Example()), + child: Transform.scale(scale: 3.0, child: const mix_variants.Example()), ), 'mix-animation': (_) => _DemoWrapper( - child: Transform.scale(scale: 3.0, child: mix_animation.SwitchAnimation()), + child: Transform.scale( + scale: 3.0, + child: const mix_animation.SwitchAnimation(), + ), ), 'naked-select': (_) => _DemoWrapper( child: Transform.scale( scale: 2.0, - child: naked_select.SimpleSelectExample(), + child: const naked_select.SimpleSelectExample(), ), ), 'remix-button': (_) => _DemoWrapper( - child: Transform.scale(scale: 1.2, child: remix_button.ButtonExample()), + child: Transform.scale( + scale: 1.2, + child: const remix_button.ButtonExample(), + ), ), 'ack-metric-card': AckMetricCard.new, }; diff --git a/packages/builder/lib/src/parsers/markdown_parser.dart b/packages/builder/lib/src/parsers/markdown_parser.dart index 9265e1417..d3e28e051 100644 --- a/packages/builder/lib/src/parsers/markdown_parser.dart +++ b/packages/builder/lib/src/parsers/markdown_parser.dart @@ -58,7 +58,7 @@ class MarkdownParser { content = content.trim(); if (content.isEmpty) return []; - final lines = LineSplitter().convert(content); + final lines = const LineSplitter().convert(content); final separators = _findSeparatorLines(lines); final slides = []; @@ -156,7 +156,7 @@ class MarkdownParser { final slides = []; final usedKeys = {}; - final frontMatterExtractor = FrontmatterParser(); + const frontMatterExtractor = FrontmatterParser(); for (final rawSlide in rawSlides) { final frontmatter = frontMatterExtractor.parse(rawSlide); diff --git a/packages/builder/lib/superdeck_builder.dart b/packages/builder/lib/superdeck_builder.dart index 21c4e7eee..823f2d4d2 100644 --- a/packages/builder/lib/superdeck_builder.dart +++ b/packages/builder/lib/superdeck_builder.dart @@ -7,9 +7,8 @@ export 'package:superdeck_core/superdeck_core.dart' export 'src/build/build_event.dart'; export 'src/build/deck_build_plugin.dart'; export 'src/build/deck_builder.dart'; - export 'src/parsers/comment_parser.dart'; export 'src/parsers/markdown_parser.dart'; -export 'src/parsers/slide_assembler.dart'; export 'src/parsers/section_parser.dart'; +export 'src/parsers/slide_assembler.dart'; export 'src/parsers/slide_serializer.dart'; diff --git a/packages/builder/test/public_api_test.dart b/packages/builder/test/public_api_test.dart index 061731e62..5a12a2948 100644 --- a/packages/builder/test/public_api_test.dart +++ b/packages/builder/test/public_api_test.dart @@ -4,13 +4,13 @@ import 'package:test/test.dart'; void main() { group('superdeck_builder public api', () { test('exports the supported build surface', () { - final error = DeckFormatException('invalid', '', 0); + const error = DeckFormatException('invalid', '', 0); expect(DeckBuilder, isNotNull); expect(DeckPlugin, isNotNull); expect(DeckBuildPlugin, isNotNull); expect(DeckBuildContext, isNotNull); - expect(BuildStarted(), isA()); + expect(const BuildStarted(), isA()); expect(error, isA()); }); }); diff --git a/packages/builder/test/src/parsers/block_parser_test.dart b/packages/builder/test/src/parsers/block_parser_test.dart index 54ad60c69..2d71a6f22 100644 --- a/packages/builder/test/src/parsers/block_parser_test.dart +++ b/packages/builder/test/src/parsers/block_parser_test.dart @@ -9,7 +9,7 @@ final List> testCaseTagBlock = [ @tag ''', 'expectedBlocks': [ - ParsedBlock(type: 'tag', data: {}, startIndex: 0, endIndex: 4), + const ParsedBlock(type: 'tag', data: {}, startIndex: 0, endIndex: 4), ], }, { @@ -18,7 +18,7 @@ final List> testCaseTagBlock = [ @tag {key: value} ''', 'expectedBlocks': [ - ParsedBlock( + const ParsedBlock( type: 'tag', data: {'key': 'value'}, startIndex: 0, @@ -36,7 +36,7 @@ final List> testCaseTagBlock = [ Test content ''', 'expectedBlocks': [ - ParsedBlock( + const ParsedBlock( type: 'tag', data: {'key': 'value', 'key2': 'value2'}, startIndex: 0, @@ -51,7 +51,7 @@ Test content @tag{key: value} ''', 'expectedBlocks': [ - ParsedBlock( + const ParsedBlock( type: 'tag', data: {'key': 'value'}, startIndex: 0, @@ -71,7 +71,7 @@ Test content ## Test content 2 ''', 'expectedBlocks': [ - ParsedBlock( + const ParsedBlock( type: 'tag', data: {'key': 'value', 'key2': 'value2'}, startIndex: 0, @@ -89,7 +89,7 @@ Test content } ''', 'expectedBlocks': [ - ParsedBlock( + const ParsedBlock( type: 'tag', data: {'key': 'value', 'key2': 'value2'}, startIndex: 0, @@ -108,7 +108,7 @@ Test content } ''', 'expectedBlocks': [ - ParsedBlock( + const ParsedBlock( type: 'tag', data: {'key': 1, 'key2': 2.0, 'key3': true}, startIndex: 0, @@ -124,7 +124,7 @@ Test content { key: value } ''', 'expectedBlocks': [ - ParsedBlock( + const ParsedBlock( type: 'tag', data: {'key': 'value'}, startIndex: 0, @@ -139,7 +139,7 @@ Test content @tag {label: "{value} text"} ''', 'expectedBlocks': [ - ParsedBlock( + const ParsedBlock( type: 'tag', data: {'label': '{value} text'}, startIndex: 0, @@ -159,13 +159,13 @@ Test content 1 Test content 2 ''', 'expectedBlocks': [ - ParsedBlock( + const ParsedBlock( type: 'tag1', data: {'key': 'value'}, startIndex: 0, endIndex: 18, ), - ParsedBlock( + const ParsedBlock( type: 'tag2', data: {'key2': 'value2'}, startIndex: 35, @@ -181,13 +181,13 @@ Test content 2 @tag2 {key2: value2} ''', 'expectedBlocks': [ - ParsedBlock( + const ParsedBlock( type: 'tag1', data: {'key': 'value'}, startIndex: 0, endIndex: 18, ), - ParsedBlock( + const ParsedBlock( type: 'tag2', data: {'key2': 'value2'}, startIndex: 19, diff --git a/packages/builder/test/src/parsers/comment_parser_test.dart b/packages/builder/test/src/parsers/comment_parser_test.dart index 0d8a41ede..65df2fdca 100644 --- a/packages/builder/test/src/parsers/comment_parser_test.dart +++ b/packages/builder/test/src/parsers/comment_parser_test.dart @@ -10,13 +10,13 @@ void main() { group('CommentParser', () { test('parses single line comment correctly', () { - final input = ''; + const input = ''; final result = parser.parse(input); expect(result, ['This is a comment']); }); test('parses multiple single line comments correctly', () { - final input = ''' + const input = ''' '''; @@ -25,7 +25,7 @@ void main() { }); test('handles comments with special characters', () { - final input = ''' + const input = ''' '''; @@ -38,7 +38,7 @@ void main() { }); test('ignores invalid comments', () { - final input = ''' + const input = ''' <-- Also invalid --> @@ -50,7 +50,7 @@ Text without comments }); test('handles empty comments', () { - final input = ''' + const input = ''' '''; @@ -59,7 +59,7 @@ Text without comments }); test('handles comments with leading and trailing spaces', () { - final input = ''' + const input = ''' '''; @@ -68,7 +68,7 @@ Text without comments }); test('ignores comments without proper spacing', () { - final input = ''' + const input = ''' '''; @@ -81,7 +81,7 @@ Text without comments }); test('handles mixed content correctly', () { - final input = ''' + const input = ''' Regular text More text @@ -92,7 +92,7 @@ Final text'''; }); test('handles multiline comments correctly', () { - final input = ''' + const input = '''