Closed mellyeliu closed 3 months ago
Other shorthands are out of scope for this specific change, but can be explored in a follow up!
compressed-size: runtime library
Size change: 0.00 kB Total size: 2.52 kB
compressed-size: e2e bundles
Size change: 0.00 kB Total size: 1128.74 kB
Updated to include the following:
marginBlock
, marginInline
, paddingBlock
, paddingInline
!important
tags in the fixFor the next iteration we can (1) expand this rule to include handling for other shorthands and (2) provide more specific handling for shorthands with two values (margin -> marginBlock. marginInline)
Context
This PR introduces a new lint rule for the handling of margin and padding shorthands in stylex.
Legacy Property Mapping: Legacy margin and padding properties like marginStart and paddingEnd are now automatically mapped to their logical property counterparts (marginInlineStart, marginInlineEnd, etc.)
Shorthand Expansion: The handling of CSS shorthands for margin and padding (e.g., margin: 0 0 0 0) will be autodetected and fixable. Shorthands are now automatically expanded into separate properties (e.g., marginInlineStart, marginInlineEnd, etc.).
Testing
Added tests to cover a number of different cases, including:
Expanding shorthands with 1, 2, and 4 values for margin/padding
Expanding shorthands for marginInline and paddingInline
Replacing legacy formats
Use of
calc
and!important
[x] I have read the contributing guidelines Contribution Guidelines
[ ] Performed a self-review of my code