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: extract eslint get souce code to util #772

Merged
merged 3 commits into from
Nov 12, 2024

Conversation

Samantha-Zhan
Copy link
Contributor

What changed / motivation ?

As per reviewer comment left by @mellyeliu on PR feat: add no-unused eslint rule to find unused styles, multiple eslint rule definition files are using identical conditional logic to get source code from Rule context such that we are backwards comparable with older eslint versions. This PR extract this logic into a separate util function so that it can be reused.

Linked PR/Issues

Fixes #767

Additional Context

  • npx jest * running all test files inside estlint-plugin folder, all tests still passing

Pre-flight checklist

@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 Nov 12, 2024
Copy link

github-actions bot commented Nov 12, 2024

workflow: benchmarks/size

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

@stylexjs/scripts@0.9.3 size:compare
./size-compare.js /tmp/tmp.4vhShG6k81 /tmp/tmp.fmKZX4EeUM

Results Base Patch Ratio
stylex/lib/stylex.js
· compressed 729 729 1.00
· minified 2,541 2,541 1.00
stylex/lib/StyleXSheet.js
· compressed 1,266 1,266 1.00
· minified 3,776 3,776 1.00
rollup-example/.build/bundle.js
· compressed 563,025 563,025 1.00
· minified 10,185,368 10,185,368 1.00
rollup-example/.build/stylex.css
· compressed 99,154 99,154 1.00
· minified 745,649 745,649 1.00

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.

LGTM! fingers crossed for the day we have ESLint parity between StyleX and WWW

@@ -9,6 +9,7 @@

'use strict';

import getSourceCode from './utils/getSourceCode';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we typically import modules after importing types. see the other util imports below

@Samantha-Zhan Samantha-Zhan merged commit 93fd979 into main Nov 12, 2024
8 checks passed
nmn added a commit that referenced this pull request Nov 12, 2024
@nmn nmn deleted the chore/get-source-code-eslint-util branch November 12, 2024 23:36
aminaopio pushed a commit to aminaopio/stylex that referenced this pull request Dec 22, 2024
* chore: extract eslint get souce code to util

* extract null checks

* change import order for better style
aminaopio pushed a commit to aminaopio/stylex that referenced this pull request Dec 22, 2024
* chore: extract eslint get souce code to util

* extract null checks

* change import order for better style
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.

5 participants