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

fix(service): cached JsFormatOptions with overrides #2186

Merged
merged 9 commits into from
Mar 25, 2024

Conversation

Sec-ant
Copy link
Contributor

@Sec-ant Sec-ant commented Mar 25, 2024

Summary

This PR fixes an issue where we cache the final options after we apply overrides to the options, and reuse them in other files in the same workspace. JavaScript/TypeScript files of different variants (.ts, .js, .tsx, .jsx) in a single workspace cannot share the same cache because they have different file source params which will affect how they are formatted. This PR uses the JsFileSource as the cache key so files of different file sources will have different cached options. Refer to #2109 (comment) for more details.

Fixes #2080, fixes #2109.

As a side note/fix, I updated the overrides application functions and configuration doc on our website to take options lineEnding and attributePosition into account. They were not properly applied or documented. I grouped them into a dedicated commit: bd3aa2c.

Test Plan

Unfortunately I cannot reproduce this issue in our memory filesystem. I think this problem has something to do with the IO overhead in different kinds of filesystems. I tested this fix locally with the provided minimal reproductions in #2080 (comment) and #2109 (comment) and this issue is fixed in those two cases.

@github-actions github-actions bot added A-Project Area: project A-Website Area: website A-Changelog Area: changelog labels Mar 25, 2024
Copy link

netlify bot commented Mar 25, 2024

Deploy Preview for biomejs ready!

Name Link
🔨 Latest commit aa92525
🔍 Latest deploy log https://app.netlify.com/sites/biomejs/deploys/66015090fcad27000878a940
😎 Deploy Preview https://deploy-preview-2186--biomejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (🟢 up 7 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 93 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

I left few suggestions to improve the code

website/src/content/docs/internals/changelog.md Outdated Show resolved Hide resolved
crates/biome_service/src/settings.rs Outdated Show resolved Hide resolved
@Sec-ant Sec-ant requested a review from ematipico March 25, 2024 10:45
@ematipico ematipico merged commit 6a2d92a into biomejs:main Mar 25, 2024
16 checks passed
@Sec-ant Sec-ant deleted the fix/configuration branch March 25, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-CLI Area: CLI A-Project Area: project A-Website Area: website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Different formatting results in GitHub action 💅 "biome check" result differs according to path depth
2 participants