Skip to content

[eslint-plugin] Add gap/gridGap shorthand expansion to stylex-valid-shorthands#1552

Merged
abhakat merged 1 commit intomainfrom
gap-shorthand-autofix
Mar 31, 2026
Merged

[eslint-plugin] Add gap/gridGap shorthand expansion to stylex-valid-shorthands#1552
abhakat merged 1 commit intomainfrom
gap-shorthand-autofix

Conversation

@abhakat
Copy link
Copy Markdown
Contributor

@abhakat abhakat commented Mar 25, 2026

Expand gap and gridGap shorthands into rowGap + columnGap longhands. Single-value
gap is always expanded (not passed through) because gap is banned by stylex-valid-styles
propLimits on all surfaces. Also adds gridColumnGapcolumnGap and gridRowGaprowGap
as legacy name renames.

What changed / motivation ?

gap is banned by stylex-valid-styles on all Meta surfaces. Without an autofix in
stylex-valid-shorthands, users see an error from valid-styles with no automated path to fix it.
This PR ensures gap (even single-value) always expands to rowGap + columnGap.

  • gap: '10px'rowGap: '10px' + columnGap: '10px'
  • gap: '10px 20px'rowGap: '10px' + columnGap: '20px'
  • gridGap → same expansion as gap
  • gridColumnGapcolumnGap (legacy rename)
  • gridRowGaprowGap (legacy rename)

Linked PR/Issues

Follow-up to #1477

Additional Context

Added tests covering: single values, numeric values, calc(), var(), !important,
comma/slash/3-value CANNOT_FIX edge cases.

Pre-flight checklist

…horthands

Always expand gap to rowGap + columnGap (even single values), since gap
is banned by stylex-valid-styles propLimits on all surfaces. gridGap
expands identically. gridColumnGap and gridRowGap are simple legacy
renames to columnGap and rowGap respectively.
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
stylex Skipped Skipped Mar 25, 2026 7:02pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 25, 2026
@github-actions
Copy link
Copy Markdown

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
yarn workspace v1.22.22
yarn run v1.22.22
$ node ./compare.js /tmp/tmp.20eCZayt5N /tmp/tmp.4pn1gidk6D

Results Base Patch Ratio
@stylexjs/stylex/lib/cjs/stylex.js
· compressed 1,447 1,447 1.00
· minified 4,558 4,558 1.00
@stylexjs/stylex/lib/cjs/inject.js
· compressed 1,793 1,793 1.00
· minified 4,915 4,915 1.00
benchmarks/size/.build/bundle.js
· compressed 496,650 496,650 1.00
· minified 4,847,840 4,847,840 1.00
benchmarks/size/.build/stylex.css
· compressed 99,653 99,653 1.00
· minified 747,850 747,850 1.00
Done in 0.08s.
Done in 0.32s.

@github-actions
Copy link
Copy Markdown

workflow: benchmarks/perf

Comparison of performance test results, measured in operations per second. Larger is better.
yarn workspace v1.22.22
yarn run v1.22.22
$ node ./compare.js /tmp/tmp.gkPyiIHVE4 /tmp/tmp.VGl6MW25TY

Results Base Patch Ratio
babel-plugin: stylex.create
· basic create 533 529 0.99 -
· complex create 66 65 0.98 -
babel-plugin: stylex.createTheme
· basic themes 437 435 1.00 -
· complex themes 34 33 0.97 -
Done in 0.08s.
Done in 0.32s.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants