-
Notifications
You must be signed in to change notification settings - Fork 659
fix(rome_js_analyze): fix for unused flag on functional types on ts #3860
Conversation
✅ Deploy Preview for docs-rometools canceled.
|
!bench_analyzer |
Parser conformance results on ubuntu-latestjs/262
jsx/babel
symbols/microsoft
🔥 Regression (50):
ts/babel
ts/microsoft
|
Analyzer Benchmark Results
|
a3d9499
to
d267622
Compare
Comparing fix(rome_js_analyze): fix for unused flag on functional types on ts Snapshot #12 to median since last deploy of rome.tools.
1 page testedHomeBrowser previews
Most significant changes27 other significant changes: JS Parse & Compile on Chrome Desktop, Largest Contentful Paint on Motorola Moto G Power, 3G connection, First Contentful Paint on Motorola Moto G Power, 3G connection, Total Blocking Time on Chrome Desktop, Time to Interactive on Motorola Moto G Power, 3G connection, Total Page Size in Bytes on Chrome Desktop, Total Page Size in Bytes on iPhone, 4G LTE, Total Page Size in Bytes on Motorola Moto G Power, 3G connection, Total CSS Size in Bytes on Chrome Desktop, Total CSS Size in Bytes on iPhone, 4G LTE, Total CSS Size in Bytes on Motorola Moto G Power, 3G connection, Time to Interactive on Chrome Desktop, First Contentful Paint on Chrome Desktop, Largest Contentful Paint on Chrome Desktop, Number of Requests on Motorola Moto G Power, 3G connection, Number of Requests on Chrome Desktop, Number of Requests on iPhone, 4G LTE, Speed Index on Motorola Moto G Power, 3G connection, Time to Interactive on iPhone, 4G LTE, First Contentful Paint on iPhone, 4G LTE, Largest Contentful Paint on iPhone, 4G LTE, Speed Index on Chrome Desktop, Total HTML Size in Bytes on Chrome Desktop, Total HTML Size in Bytes on iPhone, 4G LTE, Total HTML Size in Bytes on Motorola Moto G Power, 3G connection, Lighthouse Performance Score on Motorola Moto G Power, 3G connection, Lighthouse Performance Score on Chrome Desktop Calibre: Site dashboard | View this PR | Edit settings | View documentation |
crates/rome_js_analyze/tests/specs/correctness/noUnusedVariables/validClass.ts.snap
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/correctness/no_unused_variables.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/correctness/no_unused_variables.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/correctness/no_unused_variables.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/correctness/no_unused_variables.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/correctness/no_unused_variables.rs
Outdated
Show resolved
Hide resolved
// Some parameters are ok to not be used | ||
JsAnyBindingDeclaration::TsPropertyParameter(parameter) => { | ||
let is_binding_ok = | ||
is_ok_to_be_unused(parameter.parent_function()) || is_public_or_private(parameter)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm struggling to understand what the return value of is_public_or_private
is. Does it return true
if it is private
or when it is public
.
Suggestion:
- rename to
is_public
oris_private
- Add a visibility enum and change it to
visibility(parameter).is_public()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the name. Hopefully makes more sense now.
crates/rome_js_analyze/src/semantic_analyzers/correctness/no_unused_variables.rs
Outdated
Show resolved
Hide resolved
a73de33
to
6f7a386
Compare
1 │ // used function declaration | ||
> 2 │ function a() {} | ||
│ ^ | ||
3 │ a() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one seems to be a false positive too, the function is being used on the next line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have keen eyes! 👀
This was actually a scope resolution bug. Thanks!
259278d
to
bfb7632
Compare
ed2a301
to
b99354d
Compare
We don't suggest renaming imports anymore, so we fix the broken suggestion at #3786. |
Summary
Fixes #3669.
This PR also:
noUnusedVariables
;I have also implemented the navigation from
JsIdentifierBinding
to its declaration and from parameters to its parent function. These will not only simplify lint rules, but also help in edgy and forgotten cases.This PR also implements a hardfail for valid tests that contains "/* should not gnerate diagnostics */", but that still generate them.
Test Plan