Skip to content

[eslint-plugin] Add gap auto-fix for legacy-expand-shorthands and skip single-value gap in valid-shorthands - #1668

Merged
mellyeliu merged 1 commit into
mainfrom
anay/gap-shorthand-fixes
May 15, 2026
Merged

mellyeliu merged 1 commit into
mainfrom
anay/gap-shorthand-fixes

Conversation

@abhakat

@abhakat abhakat commented May 14, 2026

Copy link
Copy Markdown
Contributor

What changed / motivation ?

Two changes to the eslint-plugin's gap handling:

  1. Add gap to shorthandExpansionMap in valid-styles — enables the auto-fixer to expand gap to rowGap/columnGap when styleResolution: 'legacy-expand-shorthands' or banPropsForLegacy is active. No impact on users who don't opt into legacy mode — the auto-fix path is already gated behind isLegacyExpandShorthands.

  2. Skip single-value gap in valid-shorthandsgap: 10px is a valid CSS property, not a multi-value shorthand. Previously, the rule would flag it and expand to rowGap: 10px + columnGap: 10px, which is unnecessary. Multi-value gap (e.g., gap: 10px 20px) still correctly expands. gridGap single-value expansion is unchanged since gridGap is a deprecated property name.

Linked PR/Issues

n/a

Additional Context

All 546 eslint-plugin tests pass. 5 single-value gap test cases moved from invalid to valid in the valid-shorthands test suite.

Pre-flight checklist

…p single-value gap in valid-shorthands

- Add `gap` to `shorthandExpansionMap` in valid-styles so the auto-fixer
  can expand `gap` to `rowGap`/`columnGap` when `legacy-expand-shorthands`
  or `banPropsForLegacy` is active.
- In valid-shorthands, skip reporting single-value `gap` (e.g. `gap: 10px`)
  since it is a valid CSS property, not a multi-value shorthand. Multi-value
  `gap` (e.g. `gap: 10px 20px`) still expands to `rowGap`/`columnGap`.
- `gridGap` single-value expansion is unchanged — it still expands since
  `gridGap` is a deprecated property name.
@vercel

vercel Bot commented May 14, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
stylex Skipped Skipped May 14, 2026 11:22pm

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 May 14, 2026
@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.oehC56qwYQ /tmp/tmp.VxXfxeESri

Results Base Patch Ratio
babel-plugin: stylex.create
· basic create 514 525 1.02 +
· complex create 63 63 1.00
babel-plugin: stylex.createTheme
· basic themes 415 412 0.99 -
· complex themes 32 33 1.03 +
Done in 0.08s.
Done in 0.32s.

@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.8nze1SA3b2 /tmp/tmp.jFia6anozs

Results Base Patch Ratio
@stylexjs/stylex/lib/cjs/stylex.js
· compressed 1,535 1,535 1.00
· minified 5,166 5,166 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,757 99,757 1.00
· minified 748,850 748,850 1.00
Done in 0.08s.
Done in 0.34s.

@mellyeliu
mellyeliu merged commit d3f930e into main May 15, 2026
13 checks passed

This branch was previously deployed

1 inactive deployment
Preview 5a22a0b7 Deployed May 14, 2026 by vercel[bot]
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