Repository navigation
feat(lint): flag div/span wrappers that only style an Astryx component - #4758
Merged
Merged
Conversation
Flags a div/span that exists only to style a single Astryx component; those components extend BaseProps, so the styles belong on xstyle.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Copilot instructions (repo-wide + packages) and the eslint plugin README. Internal review guidance only — the end-user-facing CLI principles doc is deliberately left alone.
cixzhang
force-pushed
the
no-style-wrappers
branch
from
August 6, 2026 17:15
836ce76 to
02cd548
Compare
cixzhang
marked this pull request as ready for review
August 7, 2026 00:11
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
This was referenced Aug 7, 2026
nynexman4464
added a commit
that referenced
this pull request
Aug 7, 2026
pr-rtl ran the RTL audit unfiltered on every PR, sweeping all ~1400 core-* stories in ~26 minutes — the long pole of PR CI by 2.5x, and paid even by PRs that touch no component. On #4758 (eslint-plugin + docs only) the sibling pr-a11y correctly skipped in 0s while pr-rtl audited the whole library. Scope the job like pr-a11y: gate on check-components.has_components, download pr-analysis, and pass the changed components to the audit's --filter. Every piece already existed — check-components publishes has_components, analyze-pr.js writes newComponents/modifiedComponents, rtl-audit.mjs parses --filter — pr-a11y used all three, pr-rtl used none. New components stay covered via newComponents. Also short-circuit D5 before the RTL page load. autoPositionalMirror loaded LTR, always loaded RTL, then checked whether either produced candidates. With no LTR candidate there is nothing to measure against, and 1378 of 1394 stories have none, so this drops ~half of D5's page loads. It also closes a silent false-pass: the old `ltr === 0 && rtl === 0` guard let one-sided stories reach a compare loop that runs min(ltr, rtl) = 0 times and reported "pass" having compared nothing. Adds a root rtl:audit script for parity with a11y:audit, which also avoids a footgun — pnpm -F IS --filter, so `pnpm -F @astryxdesign/storybook rtl-audit --filter Avatar` has pnpm eat the flag and audit everything. Coverage for untouched components comes from the weekly full sweep in the stacked follow-up, mirroring the pr-a11y / a11y-weekly.yml split. Test plan: verified against the Storybook artifact from run 31122588220 (same 1394 stories). `pnpm rtl:audit -- --filter Avatar,TableTree` finishes in 19.7s and reproduces that run's Avatar verdicts exactly (cand=3/14/4/6/14). Full unfiltered sweep of the unmodified script on the same input: 1724s, matching CI's counts (AUTO 11/0/114, PM 16/0/1378). ci.yml parses; pnpm check:repo clean; prettier-clean.
nynexman4464
added a commit
that referenced
this pull request
Aug 7, 2026
pr-rtl ran the RTL audit unfiltered on every PR, sweeping all ~1400 core-* stories in ~26 minutes — the long pole of PR CI by 2.5x, and paid even by PRs that touch no component. On #4758 (eslint-plugin + docs only) the sibling pr-a11y correctly skipped in 0s while pr-rtl audited the whole library. Scope the job like pr-a11y: gate on check-components.has_components, download pr-analysis, and pass the changed components to the audit's --filter. Every piece already existed — check-components publishes has_components, analyze-pr.js writes newComponents/modifiedComponents, rtl-audit.mjs parses --filter — pr-a11y used all three, pr-rtl used none. New components stay covered via newComponents. Also short-circuit D5 before the RTL page load. autoPositionalMirror loaded LTR, always loaded RTL, then checked whether either produced candidates. With no LTR candidate there is nothing to measure against, and 1378 of 1394 stories have none, so this drops ~half of D5's page loads. It also closes a silent false-pass: the old `ltr === 0 && rtl === 0` guard let one-sided stories reach a compare loop that runs min(ltr, rtl) = 0 times and reported "pass" having compared nothing. Adds a root rtl:audit script for parity with a11y:audit, which also avoids a footgun — pnpm -F IS --filter, so `pnpm -F @astryxdesign/storybook rtl-audit --filter Avatar` has pnpm eat the flag and audit everything. Coverage for untouched components comes from the weekly full sweep in the stacked follow-up, mirroring the pr-a11y / a11y-weekly.yml split. Test plan: verified against the Storybook artifact from run 31122588220 (same 1394 stories). `pnpm rtl:audit -- --filter Avatar,TableTree` finishes in 19.7s and reproduces that run's Avatar verdicts exactly (cand=3/14/4/6/14). Full unfiltered sweep of the unmodified script on the same input: 1724s, matching CI's counts (AUTO 11/0/114, PM 16/0/1378). ci.yml parses; pnpm check:repo clean; prettier-clean.
nynexman4464
added a commit
that referenced
this pull request
Aug 7, 2026
pr-rtl ran the RTL audit unfiltered on every PR, sweeping all ~1400 core-* stories in ~26 minutes — the long pole of PR CI by 2.5x, and paid even by PRs that touch no component. On #4758 (eslint-plugin + docs only) the sibling pr-a11y correctly skipped in 0s while pr-rtl audited the whole library. Scope the job like pr-a11y: gate on check-components.has_components, download pr-analysis, and pass the changed components to the audit's --filter. Every piece already existed — check-components publishes has_components, analyze-pr.js writes newComponents/modifiedComponents, rtl-audit.mjs parses --filter — pr-a11y used all three, pr-rtl used none. New components stay covered via newComponents. Also short-circuit D5 before the RTL page load. autoPositionalMirror loaded LTR, always loaded RTL, then checked whether either produced candidates. With no LTR candidate there is nothing to measure against, and 1378 of 1394 stories have none, so this drops ~half of D5's page loads. It also closes a silent false-pass: the old `ltr === 0 && rtl === 0` guard let one-sided stories reach a compare loop that runs min(ltr, rtl) = 0 times and reported "pass" having compared nothing. Adds a root rtl:audit script for parity with a11y:audit, which also avoids a footgun — pnpm -F IS --filter, so `pnpm -F @astryxdesign/storybook rtl-audit --filter Avatar` has pnpm eat the flag and audit everything. Coverage for untouched components comes from the weekly full sweep in the stacked follow-up, mirroring the pr-a11y / a11y-weekly.yml split. Test plan: verified against the Storybook artifact from run 31122588220 (same 1394 stories). `pnpm rtl:audit -- --filter Avatar,TableTree` finishes in 19.7s and reproduces that run's Avatar verdicts exactly (cand=3/14/4/6/14). Full unfiltered sweep of the unmodified script on the same input: 1724s, matching CI's counts (AUTO 11/0/114, PM 16/0/1378). ci.yml parses; pnpm check:repo clean; prettier-clean.
This was referenced Aug 11, 2026
cixzhang
added a commit
that referenced
this pull request
Aug 12, 2026
Encode the mechanically checkable part of the wiki's "Principles for authoring theming targets" as three rules, split by the severity they can realistically ship at: - @astryx/theming-target-shape — a target must sit on an element that paints. Flags a target on a layout-only box, on a paint-free wrapper around a composed Astryx component, and on an element with no styles at all. Uses #4758's stylex-style-source.js to read style objects across modules. - @astryx/theming-target-name — {parent}-{position}-{component}: an appearance word in the component slot, a missing position segment, and state used as a name suffix. - @astryx/themeprops-reflection — themeProps() read as `.className` (drops the data-* reflection) and hand-authored state data-*. Shared analysis lives in theming-target.js: which themeProps() calls land on an element, which stylex.props() arguments it applies, and whether those declare paint, layout, or neither. Not wired into eslint.config.js yet — prototype for review.
cixzhang
added a commit
that referenced
this pull request
Aug 14, 2026
Encode the mechanically checkable part of the wiki's "Principles for authoring theming targets" as three rules, split by the severity they can realistically ship at: - @astryx/theming-target-shape — a target must sit on an element that paints. Flags a target on a layout-only box, on a paint-free wrapper around a composed Astryx component, and on an element with no styles at all. Uses #4758's stylex-style-source.js to read style objects across modules. - @astryx/theming-target-name — {parent}-{position}-{component}: an appearance word in the component slot, a missing position segment, and state used as a name suffix. - @astryx/themeprops-reflection — themeProps() read as `.className` (drops the data-* reflection) and hand-authored state data-*. Shared analysis lives in theming-target.js: which themeProps() calls land on an element, which stylex.props() arguments it applies, and whether those declare paint, layout, or neither. Not wired into eslint.config.js yet — prototype for review.
cixzhang
added a commit
that referenced
this pull request
Aug 25, 2026
Encode the mechanically checkable part of the wiki's "Principles for authoring theming targets" as three rules, split by the severity they can realistically ship at: - @astryx/theming-target-shape — a target must sit on an element that paints. Flags a target on a layout-only box, on a paint-free wrapper around a composed Astryx component, and on an element with no styles at all. Uses #4758's stylex-style-source.js to read style objects across modules. - @astryx/theming-target-name — {parent}-{position}-{component}: an appearance word in the component slot, a missing position segment, and state used as a name suffix. - @astryx/themeprops-reflection — themeProps() read as `.className` (drops the data-* reflection) and hand-authored state data-*. Shared analysis lives in theming-target.js: which themeProps() calls land on an element, which stylex.props() arguments it applies, and whether those declare paint, layout, or neither. Not wired into eslint.config.js yet — prototype for review.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#4752 fixed a caret that sat a few pixels high. The cause was not the caret — it
was the
<span>around it: a wrapper whose only job was to carryrtlStyles.mirror, which put an extra element between the button's flexcentering and the
Icon. Every Astryx component extendsBaseProps, so it takesxstyle; a styling-only wrapper is a DOM node the component contract never askedfor, and it silently changes the parent's flex/grid child relationship.
The guidance already existed (
packages.instructions.mdeven uses<Divider xstyle={…} />as the example) and it still shipped twice in the samecomponent. So this adds the mechanical check to go with the prose.
What
@astryx/no-style-only-wrapper— reports adiv/spanwhose attributes areonly styles (a
stylex.props()spread,className,style, optionallykey)wrapping a single Astryx component, and offers a suggestion that moves the
styles onto the child's
xstyle. It is a suggestion, never a--fix: removing anode can shift layout, so a human confirms.
The rule stays quiet where the wrapper is doing real work — more than one child,
a host or non-Astryx child, anything semantic on the wrapper (
role,aria-*,data-*,ref, a handler,{...rest}), a child that renders no root element(overlays, providers), or styles that are structural:
display, the flex/gridcontainer properties,
gap,padding. Those change the child's own formattingcontext or the space around its border box, so the wrapper is not redundant.
To classify structural styles honestly it has to read the style object, which is
usually in another module (
../utils→rtlStyles,./shared→styles).stylex-style-source.jsdoes that lookup with a brace-balanced scan that followsbarrel re-exports. Without it the rule mislabels five Schedule wrappers that are
genuine grid/flex containers.
Docs — the same rule stated for reviewers and agents: a repo-wide expectation
plus a worked example in the Copilot instructions, and the styling bullet in the
packages instructions expanded with the failure mode and the legitimate cases.
Internal review guidance only — the end-user-facing
astryx docs principlestextis deliberately untouched.
Risk
No runtime code changes and nothing consumer-visible — lint config, an internal
plugin, and internal review guidance. No changeset for that reason.
The rule runs as a warning in both tiers, not an error: 25 wrappers in
packages/corepredate it (Carousel, Chat, Lightbox, MobileNav, Pagination,PowerSearch, Switch, Table/rowExpansion, TopNav). Flipping it to
errorin thestrict tier is a one-line change once those are migrated — the path
no-physical-propertiestook. I deliberately did not grandfather those fileswith
allowFiles: #4752's wrapper was a new wrapper in a file that already hadone, and a file-level exemption would have missed it exactly.
Test files are exempt — sizing scaffolding around a component under test is not
shipped DOM.
Testing
37 new tests (27 rule cases, 10 for the cross-file style reader), 245 plugin
tests green.
CI=true eslint .across the repo: 0 errors, 25 warnings, all fromthis rule — the two spans #4752 is fixing are among them, so the rule
demonstrably catches the case it was written for.
Follow-up worth doing separately: migrate those 25 sites and flip the rule to
error. Each one moves real styles onto a component root, so it wants its ownvisual check rather than riding along here.