Open
Conversation
added 2 commits March 19, 2026 15:35
…rthands Add animation shorthand expansion following the createSpecificTransformer pattern. The rule now reports an error and autofixes when users write `animation: 'slidein 3s ease-in'` instead of the expanded longhands. Handles all CSS spec cases: - Duration and delay (first time = duration, second = delay) - Timing functions: keywords (ease, linear, etc.) and functions (cubic-bezier(), steps()) - Iteration count: number or infinite - Direction: normal, reverse, alternate, alternate-reverse - Fill mode: forwards, backwards, both - Play state: running, paused - Animation name: any unclassified identifier - Comma-separated multi-animation returns CANNOT_FIX - !important support
| The latest updates on your projects. Learn more about Vercel for GitHub. |
workflow: benchmarks/perfComparison of performance test results, measured in operations per second. Larger is better.
|
workflow: benchmarks/sizeComparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
|
mellyeliu approved these changes Mar 20, 2026
| const styles = stylex.create({ | ||
| main: { | ||
| animationDuration: '1s', | ||
| animationFillMode: 'none', |
Member
There was a problem hiding this comment.
hmmm don't think we need animationFillMode here - let's refactor and remove
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.
What changed / motivation ?
Added animation shorthand expansion to
stylex-valid-shorthandsfollowing the samecreateSpecificTransformerpattern used by existing shorthand expanders.This change makes the rule report and autofix animation shorthand values into longhands for supported single-animation inputs.
Changes:
animation: createSpecificTransformer('animation')to shorthand aliases.expandAnimationShorthand()insplitShorthands.jsto parse and expand:animationDurationanimationTimingFunctionanimationDelayanimationIterationCountanimationDirectionanimationFillModeanimationPlayStateanimationNamesplitSpecificShorthands.Supported behavior:
slidein 3s)ease-in,cubic-bezier(...),steps(...),linear(...))slidein 3s 1s)2 3s slidein)!importantpropagation to expanded longhandsCANNOT_FIXSafest semantic handling for ambiguous
none:animation: '1s none'expands to both:animationFillMode: 'none'animationName: 'none'animation: 'fadein 1s none'expands to:animationDuration: '1s'animationFillMode: 'none'animationName: 'fadein'Motivation:
animationshorthand handling in line with existing shorthand autofix behavior.nonesemantics.Linked PR/Issues
N/A
Additional Context
Example autofix:
animation: '3s ease-in 1s 2 reverse both paused slidein'animationDuration: '3s'animationTimingFunction: 'ease-in'animationDelay: '1s'animationIterationCount: '2'animationDirection: 'reverse'animationFillMode: 'both'animationPlayState: 'paused'animationName: 'slidein'Tests:
npx jest --watchman=false --coverage=false stylex-valid-shorthands-test.jsPASS(95 passed,0 failed)Screenshots:
Pre-flight checklist
Contribution Guidelines