Skip to content

Conversation

@jcperez-ch
Copy link
Contributor

What changed / motivation ?

We wan to split fixable rules related to disallowed properties in stylex onto a separate eslint rule, out of stylex-valid-styles.
Why? Because having fixable rules will serve as an education leverage for users to understand the pool of properties that are no valid in stylex. It will alleviate the extreme burden of checking for way too many rules with different purposes on a single eslint rule. Similar to what we did with no-nonstandard-styles rule.

It also abstracts several repeated code in functions under /utils folder, including:

  • isStylexCreateDeclaration
  • isStylexCreateCallee

Linked PR/Issues

Issue in progress (issue 1201).
PR Related 1246

Additional Context

Tests for the rule have also been ported from one test file to a new one

Pre-flight checklist

@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 Oct 24, 2025
@github-actions
Copy link

workflow: benchmarks/size

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

[email protected] compare
node ./compare.js /tmp/tmp.4rF8sSKapT /tmp/tmp.ehYvoPMszE

Results Base Patch Ratio
@stylexjs/stylex/lib/cjs/stylex.js
· compressed 1,282 1,282 1.00
· minified 4,025 4,025 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

@github-actions
Copy link

workflow: benchmarks/perf

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

[email protected] compare
node ./compare.js /tmp/tmp.Hhc3Izm8EM /tmp/tmp.KoA8tNCpqv

Results Base Patch Ratio
babel-plugin: stylex.create
· basic create 581 558 0.96 -
· complex create 169 172 1.02 +
babel-plugin: stylex.createTheme
· basic themes 416 420 1.01 +
· complex themes 40 39 0.97 -

Copy link
Member

@mellyeliu mellyeliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! A few initial issues:

  1. Looks like some of the CSS variable override checks got moved into no-disallowed-properties, that should probably stay in valid-styles
  2. Also, all the disallowed properties under banPropsForLegacy should be moved under the new rule

import * as stylex from '@stylexjs/stylex';
const styles = stylex.create({
foo: {
'--bar': '0',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, we likely want to keep this in the original valid-styles rule, as CSS variable overrides aren't really a CSS property

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.

3 participants