feat(parser): alias flex-wrap to wrap and warn on unknown classNames (WIND-5)#147
Conversation
…t silently (WIND-5)
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (21)
📝 WalkthroughWalkthroughThis PR aliases the Tailwind Changesflex-wrap alias and unknown-token diagnostics
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR improves Wind’s developer experience by (1) adding a Tailwind-compat alias for flex-wrap and (2) emitting debug-only warnings for dropped className tokens that no parser recognizes, while keeping release behavior unchanged.
Changes:
- Added
flex-wrap→wrapalias inFlexboxGridParser, with a one-timekDebugModehint. - Added a one-time
kDebugModeunknown-token warning inWindParser.findAndGroupClasses, plus an allowlist for valid tokens handled outside the parser map. - Updated docs/skill references and migrated example pages from
flex-wrapto canonicalwrap; added/updated tests for the new diagnostics.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/parser/wind_parser_test.dart | Adds coverage for dropping unknown tokens and for one-time unknown-token debug warnings with allowlist exemptions. |
| test/parser/parsers/flexbox_grid_parser_test.dart | Adds tests for flex-wrap alias behavior and one-time alias-hint logging; resets warning state for determinism. |
| skills/wind-ui/SKILL.md | Updates the skill text to describe flex-wrap alias and the new debug-only unknown-token behavior. |
| skills/wind-ui/references/tailwind-divergence.md | Updates Tailwind divergence guidance to reflect the alias and the new debug-only unknown-token diagnostics. |
| lib/src/parser/wind_parser.dart | Implements the unknown-token warning (debug-only, warn-once) and introduces a _knownUnparsedTokens allowlist. |
| lib/src/parser/parsers/flexbox_grid_parser.dart | Implements flex-wrap → wrap alias and a one-time debug hint (plus test-only reset hook). |
| example/lib/pages/widgets/wind_animation_wrapper_basic.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/typography/colors.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/sizing/aspectratio.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/responsive/visibility.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/responsive/typography.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/responsive/spacing.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/responsive/layout.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/responsive/grid.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/responsive/card.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/popover/popover_alignment.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/layout/z_index.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| example/lib/pages/layout/flex_intro.dart | Updates explanatory copy to acknowledge the alias and prefer canonical wrap. |
| example/lib/pages/backgrounds/colors.dart | Replaces flex-wrap usage with canonical wrap in examples. |
| doc/layout/display.md | Updates display docs to explain wrap vs flex and note the flex-wrap alias + debug hint. |
| CHANGELOG.md | Records the alias + debug-diagnostic behavior changes and associated doc/example updates under Unreleased. |
The hint fires only when no parser's canParse matches the token (unknown family). A recognized family with an unsupported value (text-7xl, claimed by text-*; flex-cow, matching flex-*) still drops silently with no hint. Corrects Core Law 6, the migration table, and the tailwind-divergence unknown-tokens row, which overpromised the hint's reach.
|
@coderabbitai review |
✅ Action performedReview finished.
|
… suite output quiet
|
@coderabbitai review |
✅ Action performedReview finished.
|
…s-unknown-token-warning # Conflicts: # CHANGELOG.md
What (WIND-5)
Two developer-experience fixes for silent failures:
flex-wrap->wrapalias:FlexboxGridParsernow maps the Tailwind spellingflex-wrapdirectly toWindDisplayType.wrap(canParsealready acceptedflex-*; only theparse()handler was missing).wrapstays the canonical token;flex-wrapprints a one-timekDebugModehint pointing at it.WindParser.findAndGroupClassesnow emits a one-timekDebugModedebugPrintnaming any className no parser recognizes (deduped per unique token per session, via the existing_warnedAliasesset). The token is still dropped; release builds print nothing.An allowlist (
_knownUnparsedTokens) exempts valid tokens handled outside the parser map so the warning targets genuine typos, not wind's own vocabulary: the widget-consumedobject-*fit family, theinline-*display keywords (emitted by WBadge), and inert compat tokens (transition-colors,antialiased,sr-only, the*-numsfamily). Verified by an exhaustive sweep of all 20 parsers vs every runtime-emitted className.Why
flex-wrapfrom a web codebase silently no-opped; a typo'd className silently no-opped forever. Both now surface a debug hint without changing release behavior.Changes
lib/src/parser/parsers/flexbox_grid_parser.dart,lib/src/parser/wind_parser.dart(+ tests).flex-wrap->wrap.skills/wind-ui/SKILL.md(2.8.2 -> 2.9.0),skills/wind-ui/references/tailwind-divergence.md,doc/layout/display.md,CHANGELOG.md.Verification
dart analyzeclean,dart formatclean,flutter testgreen (incl. the flex-wrap alias, one-warning-per-token, and allowlist regression tests).Note
Shares
CHANGELOG.md/SKILL.md/tailwind-divergence.mdwith the WIND-1/3/4 PRs (they were developed as one plan). Whichever merges first, the others need a trivial rebase on those doc surfaces.Summary by CodeRabbit
flex-wrapspelling as an alias forwrap.wrapas the canonical token.