Skip to content

refactor: apply mix_lint dot-shorthand fixes in tests and showcase - #1084

Open
leoafarias wants to merge 5 commits into
refactor/mix-lint-cleanupfrom
chore/mix-lint-shorthand-fixes
Open

leoafarias wants to merge 5 commits into
refactor/mix-lint-cleanupfrom
chore/mix-lint-shorthand-fixes

Conversation

@leoafarias

@leoafarias leoafarias commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Related issue

Stacked on #1083, which adds and fixes the lints. This PR's base is #1083's branch (refactor/mix-lint-cleanup), so the diff shows only the applied fixes.

After #1083 is squash-merged:

  1. Retarget this PR to main. GitHub does this for you only when the base branch is deleted through GitHub after the merge.
  2. Replay only the fix commits onto the new main, so the diff doesn't show refactor(mix_lint)!: rename rules, fix false positives, and align with Mix style #1083's files again:
    git fetch origin
    git switch chore/mix-lint-shorthand-fixes
    git rebase --onto origin/main refactor/mix-lint-cleanup
    git push --force-with-lease
    
    No conflicts are expected: a simulated squash of refactor(mix_lint)!: rename rules, fix false positives, and align with Mix style #1083 plus a replay of these commits applied cleanly (60 files). git merge origin/main gives the same tree if a force-push is not wanted.

Description

Applies the quick fixes for unnecessary_styler_constructor and unnecessary_type_name across the repo, then runs dart format. This brings the tests and the showcase in line with the nested-shorthand style the Mix skill prescribes.

Package Files Where
mix 40 tests only
mix_chart 9 tests only
examples/showcase 11 app code

No library code in mix or mix_chart changes. Seven findings in generated *.g.dart files are left alone; they should be fixed in mix_generator's output.

Changes

Nested Stylers use factory shorthands (83 edits):

// before
.onHovered(BoxStyler().color(Colors.indigo.shade500).scale(1.02))
PieChartStyler().slice(PieSliceStyler().label(common))
// after
.onHovered(.color(Colors.indigo.shade500).scale(1.02))
PieChartStyler().slice(.label(common))

Styler expressions drop type names the parameter type already gives (570 edits):

// before
.label(.fontSize(_labelSize).fontWeight(FontWeight.w500))
GridBoxStyler().onConstraints(Breakpoint.maxWidth(400), …)
.onNot(ContextVariant.widgetState(WidgetState.hovered), BoxStyler().color(Colors.red))
// after
.label(.fontSize(_labelSize).fontWeight(.w500))
GridBoxStyler().onConstraints(.maxWidth(400), …)
.onNot(.widgetState(.hovered), .color(Colors.red))

The fixes removed the last use of package:mix/mix.dart in three mix_chart tests, so those imports are removed too. Without that, dart analyze reports unused_import, which fails CI's Analyze step.

Review Checklist

  • Testing:
    • An independent review resolved all 653 edited sites with the analyzer: each dot shorthand resolves to the same class and member as the prefix it replaced (0 mismatches). That includes const constructors, generic Prop.maybeMix, and factories that return a subtype.
    • The only other changes are trailing commas from dart format and the three removed imports. No strings, comments, or test names changed.
    • dart analyze in mix_chart is clean after the import removal. mix and the showcase have no new findings, and the showcase also analyzes cleanly against published mix 2.2.0.
    • The affected tests pass: 906 in mix (the 40 changed files), 45 in mix_chart, and all 127 in the showcase (including goldens).
    • With the plugin from refactor(mix_lint)!: rename rules, fix false positives, and align with Mix style #1083 enabled, no findings remain in the changed packages' tests or in the showcase. 10 remain in packages/mix/lib, which this PR leaves out on purpose.
    • The Test Workflow runs only for PRs into main or next, so CI runs here after the retarget.
  • Breaking Changes: None. Tests and example code only.
  • Documentation Updates: Not needed. The skill examples were updated in refactor(mix_lint)!: rename rules, fix false positives, and align with Mix style #1083.
  • Website Updates: Not needed.

Additional Information (optional)

🤖 Generated with Claude Code

https://claude.ai/code/session_011EP34h1rAB3nkZvg3V3fHi

Apply the quick fixes for unnecessary_styler_constructor and
unnecessary_type_name from #1083 across the repo, then dart format:

- Nested Stylers use factory shorthands:
  `.onHovered(BoxStyler().color(c))` -> `.onHovered(.color(c))`.
- Styler expressions drop inferable type names:
  `.fontWeight(FontWeight.w600)` -> `.fontWeight(.w600)`,
  `.onNot(.widgetState(WidgetState.hovered), ...)` ->
  `.onNot(.widgetState(.hovered), ...)`.

653 edits in 60 files: 49 test files in mix and mix_chart, and 11 files
in the showcase app. No library code in mix or mix_chart changes, and
generated *.g.dart files are left to mix_generator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011EP34h1rAB3nkZvg3V3fHi
@leoafarias
leoafarias added this pull request to stack #1085 September 30, 2026 16:10
…d-fixes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011EP34h1rAB3nkZvg3V3fHi
The dot-shorthand fixes removed the last use of package:mix/mix.dart in
three tests, so dart analyze reported unused_import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011EP34h1rAB3nkZvg3V3fHi

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants