Skip to content

[eslint-plugin] allow local resolved constants in valid-styles number checks - #1216

Merged
mellyeliu merged 1 commit into
mainfrom
eslint-fix
Sep 3, 2025
Merged

mellyeliu merged 1 commit into
mainfrom
eslint-fix

Conversation

@mellyeliu

@mellyeliu mellyeliu commented Sep 3, 2025 •

Copy link
Copy Markdown
Member

The isNumber lint check was incorrectly flagging identifiers for constants declared in the same file. We generally allow them in place of number literals as Babel handles the static evaluation of these bindings.

The rule now resolves scope correctly so that same-file const identifiers initialized with numbers can be used within arithmetic expressions and pass without error.

Within the isNumber check

  • resolve math expressions down to both sides as before
  • use getScope to determine whether any identifiers are declared within the file

@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 Sep 3, 2025
@github-actions

github-actions Bot commented Sep 3, 2025 •

Copy link
Copy Markdown

workflow: benchmarks/perf

Comparison of performance test results, measured in operations per second. Larger is better.

benchmarks@0.15.3 compare
node ./compare.js /tmp/tmp.msjDvKkzSg /tmp/tmp.AElsaN1Mkl

Results Base Patch Ratio
babel-plugin: stylex.create
· basic create 642 641 1.00 -
· complex create 190 188 0.99 -
babel-plugin: stylex.createTheme
· basic themes 452 448 0.99 -
· complex themes 42 42 1.00

@github-actions

github-actions Bot commented Sep 3, 2025 •

Copy link
Copy Markdown

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.

benchmarks@0.15.3 compare
node ./compare.js /tmp/tmp.DLsJEYfZx2 /tmp/tmp.tOpCWllIyW

Results Base Patch Ratio
@stylexjs/stylex/lib/cjs/stylex.js
· compressed 1,190 1,190 1.00
· minified 3,541 3,541 1.00
@stylexjs/stylex/lib/cjs/inject.js
· compressed 1,223 1,223 1.00
· minified 3,216 3,216 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,853 99,853 1.00
· minified 747,541 747,541 1.00

@mellyeliu
mellyeliu marked this pull request as ready for review September 3, 2025 17:45
@mellyeliu
mellyeliu merged commit 648008d into main Sep 3, 2025
@mellyeliu
mellyeliu deleted the eslint-fix branch September 3, 2025 18:41

This branch was successfully deployed

1 active deployment
Preview — 359ec435 Deployed Sep 3, 2025 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