-
Notifications
You must be signed in to change notification settings - Fork 653
Conversation
Parser conformance results on ubuntu-latestjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
4a47d05
to
5c67f07
Compare
Deploying with
|
Latest commit: |
51d682d
|
Status: | ✅ Deploy successful! |
Preview URL: | https://227535e1.tools-8rn.pages.dev |
Branch Preview URL: | https://feature-use-camel-case.tools-8rn.pages.dev |
Relevant for: #2925 |
@@ -19,8 +19,14 @@ rome_console = { path = "../rome_console" } | |||
rome_diagnostics = { path = "../rome_diagnostics" } | |||
roaring = "0.9.0" | |||
rustc-hash = "1.1.0" | |||
iai = "0.1.1" |
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.
Does it have to be a dependency? Can it be moved in dev-dependencies
?
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.
Yes. Wrong place.
const CATEGORY: RuleCategory = RuleCategory::Lint; | ||
|
||
type Query = Semantic<JsIdentifierBinding>; | ||
type State = (String, Vec<Reference>); |
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.
Could you document the state please?
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 for a struct.
/// let candidates = once(Cow::from(new_name)).chain(candidates); | ||
/// batch.try_rename_node_declaration_until_success(model, node, candidates); | ||
/// ``` | ||
fn try_rename_node_declaration_until_success<S, I>( |
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 think using try_*
should hint to return Result
, at least that's what the convention seems to be.
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.
The name of the function seems different from what it actually does. If inside candidates
we have more than one eligible for renaming, only the first gets renamed and the rest don't. I think we should review the logic or the name of the function.
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 renamed this function.
crates/rome_js_analyze/src/semantic_analyzers/js/use_camel_case.rs
Outdated
Show resolved
Hide resolved
5c67f07
to
7da9e99
Compare
pub(crate) UseCamelCase { | ||
version: "0.8.0", | ||
name: "useCamelCase", | ||
recommended: true |
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.
What do you think if we don't recommend the rule? Mostly because it's not finished as you suggested. But I don't mind having it recommended too. No strong opinions, as long as the current implementation is reliable.
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.
Done.
!bench_analyzer |
Analyzer Benchmark Results
|
* lint useCamelCase working
Summary
Implements #2903.
Test Plan
Camel Case
This PR implements only the happy path for camel case. It does not support nice camel case for abbreviations and acronyms.
Renaming and conflicts
Given that we rename different bindings to possibly the same name, they can conflict. The renaming is correctly dealing with this. So if we have:
After renaming everything in one go, we have:
But this is not reflected in the diagnostic phase. Because there is no conflict there. This is something we may need to address in another PR.
Performance
I compared this PR to https://github.com/SkylerLipthay/case. But focusing on being faster when everything is ok. Now we are only slower when we actually need to transform the string. We run fewer instructions, but unfortunately, we access the memory more times.