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: noInvalidUseBeforeDeclaration false-positive for param destructuring with default values #1672

Closed
wants to merge 39 commits into from

Conversation

vasucp1207
Copy link
Member

Summary

Closes #1648

Test Plan

New tests are passed

Copy link

netlify bot commented Jan 25, 2024

Deploy Preview for biomejs ready!

Name Link
🔨 Latest commit 4138f14
🔍 Latest deploy log https://app.netlify.com/sites/biomejs/deploys/65b29d81c982a600082a029a
😎 Deploy Preview https://deploy-preview-1672--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 6 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.

@github-actions github-actions bot added A-Linter Area: linter A-Website Area: website L-JavaScript Language: JavaScript and super languages A-Changelog Area: changelog labels Jan 25, 2024
Copy link

codspeed-hq bot commented Jan 25, 2024

CodSpeed Performance Report

Merging #1672 will degrade performances by 7.08%

⚠️ No base runs were found

Falling back to comparing vasucp1207:useBeforeDeclaration (4138f14) with main (6a768ed)

Summary

❌ 1 regressions
✅ 90 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main vasucp1207:useBeforeDeclaration Change
db.json[cached] 71.8 ms 77.2 ms -7.08%

@@ -136,6 +136,20 @@ impl Rule for NoInvalidUseBeforeDeclaration {
// type Y = typeof X;
// const X = 0;
// ```
&& reference
Copy link
Member

Choose a reason for hiding this comment

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

The issue with this fix is: it doesn't report used before declaraion such as { a = b, b = "111" }.

I wonder if we should rather change the implementation of biome_js_syntax::binding_ext::AnyJsIdentifierBinding::declaration and consider JsObjectBindingPatternShorthandProperty, JsObjectBindingPattern* and JsArrayBindingPattern* as declarations. I am not sure of the implication in other part of the codebase. This could solve both #1652 and #1648.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I will look into this after some days, quite busy now.

Copy link
Member

Choose a reason for hiding this comment

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

Are you still interested in investigating this? Otherwise, I can take a look :)

Copy link
Member Author

Choose a reason for hiding this comment

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

@Conaclos, I get the idea that we have to include JsObjectBindingPatternShorthandProperty as declarations but as you mention I found it hard to handle its implication in other parts of codebase, so you take a look on this. I will follow your work.

Copy link
Member

Choose a reason for hiding this comment

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

I proposed a fix in #1800

@Conaclos Conaclos closed this Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Linter Area: linter A-Website Area: website L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💅 noInvalidUseBeforeDeclaration - false-positive for param destructuring with default values
2 participants