Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

fix(rome_js_analyze): fix useConst suggestion when some bindings cannot live inside const #4014

Merged
merged 3 commits into from
Dec 8, 2022

Conversation

xunilrj
Copy link
Contributor

@xunilrj xunilrj commented Dec 7, 2022

Summary

Fixes: #4006

The real fix is at: crates/rome_js_analyze/src/semantic_analyzers/nursery/use_const.rs
All the other changes were using some of the examples to better test semantic model and batch mutation with the cases of useConst.

I also moved a lot of cases from valid to invalid and vice-versa.
The older version of crates/rome_js_analyze/tests/specs/nursery/useConst/valid.jsonc.snap incorrectly had some diagnostics. I also fixed that.

Test Plan

> cargo test -p rome_js_analyze -- use_const

@xunilrj xunilrj requested review from leops, ematipico and a team as code owners December 7, 2022 19:36
@netlify
Copy link

netlify bot commented Dec 7, 2022

Deploy Preview for docs-rometools canceled.

Name Link
🔨 Latest commit 93ef504
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/63910d96d1dddb0008b66456

@github-actions
Copy link

github-actions bot commented Dec 7, 2022

Parser conformance results on ubuntu-latest

js/262

Test result main count This PR count Difference
Total 45879 45879 0
Passed 44936 44936 0
Failed 943 943 0
Panics 0 0 0
Coverage 97.94% 97.94% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 39 39 0
Passed 36 36 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.31% 92.31% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 5946 5946 0
Passed 1684 1684 0
Failed 4262 4262 0
Panics 0 0 0
Coverage 28.32% 28.32% 0.00%

ts/babel

Test result main count This PR count Difference
Total 588 588 0
Passed 519 519 0
Failed 69 69 0
Panics 0 0 0
Coverage 88.27% 88.27% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 16257 16257 0
Passed 12397 12397 0
Failed 3860 3860 0
Panics 0 0 0
Coverage 76.26% 76.26% 0.00%

@xunilrj xunilrj merged commit 157aa9d into main Dec 8, 2022
@xunilrj xunilrj deleted the fix/4006-use-const-only-if-all-bindings-are-const branch December 8, 2022 12:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 useConst does not take into account destructuring of a reassigned var with an unreassigned one.
3 participants