Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve documentation for lint rules #961

Merged
merged 1 commit into from
Mar 24, 2025
Merged

chore: improve documentation for lint rules #961

merged 1 commit into from
Mar 24, 2025

Conversation

mellyeliu
Copy link
Member

@mellyeliu mellyeliu commented Mar 22, 2025

Context

From discussions with ESLint oncall StyleX lint rules often provide lots of confusion, particularly around logical -> standard properties. We've previously added autofixes, but updating rules documentation here and internally to reduce confusion

Pre-flight checklist

Sorry, something went wrong.

@facebook-github-bot facebook-github-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 Mar 22, 2025
@mellyeliu mellyeliu changed the title Eslint fixes chore: improve documentation for lint rules Mar 22, 2025
@mellyeliu mellyeliu marked this pull request as ready for review March 22, 2025 00:20
@mellyeliu mellyeliu requested review from nmn and necolas March 22, 2025 00:20
Copy link

github-actions bot commented Mar 22, 2025

workflow: benchmarks/size

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

[email protected] size:compare
node size/compare.js /tmp/tmp.72rx9eVq8f /tmp/tmp.w1fBOUGA2U

Results Base Patch Ratio
stylex/lib/stylex.js
· compressed 985 985 1.00
· minified 3,154 3,154 1.00
stylex/lib/StyleXSheet.js
· compressed 1,266 1,266 1.00
· minified 3,776 3,776 1.00
benchmarks/size/.build/bundle.js
· compressed 537,611 537,611 1.00
· minified 7,435,904 7,435,904 1.00
benchmarks/size/.build/stylex.css
· compressed 100,609 100,609 1.00
· minified 755,721 755,721 1.00

```js
{
allowImportant: false, // Whether `!important` is allowed
preferInline: false // Whether inline variants are preferred over directional
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this mean?

Copy link
Member Author

Choose a reason for hiding this comment

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

preferInline expands shorthands to standard logical equivalents when set to true, otherwise uses directional expansion (default).

ie.

//prefer-inline: true
margin: 10 15 20 25, 

marginTop: 10px;
marginRight: 15px;
marginBottom: 20px;
marginLeft: 25px;

//prefer-inline: false
margin: 10 15 20 25, 

marginTop: 10px;
marginInlineEnd: 15px;
marginBottom: 20px;
marginInlineStart 25px;

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Not the best name. The comment should probably say something like "Whether the expansion uses logical direction properties instead of physical"

@mellyeliu mellyeliu merged commit 82653e1 into main Mar 24, 2025
8 checks passed
@mellyeliu mellyeliu deleted the eslint-fixes branch March 24, 2025 18:28
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.

None yet

3 participants