-
Notifications
You must be signed in to change notification settings - Fork 656
feat(rome_js_analyze): useNamingConvention #4534
Conversation
✅ Deploy Preview for docs-rometools canceled.Built without sensitive environment variables
|
Hi! There are still some code to polish, in particular the documentation. I am wondering: is there a way to test a rule config? |
I have this PR open that will change how we parse and test rules with options. We could merge it, if you think that helps . To test a rule with configuration, create an *.options.json file, where * is the name of the file you want to testtest. The react hooks rules have some examples |
You mean #4541? This could be nice! |
@Conaclos I merged the PR that changes how options are deserialized. Now you can better document the options. You will have to regenerate the schema and bindings. |
I updated the code to validate/hydrate the rule configuration. Something looking wrong for me is the union of all rule options in the schema. Is this normal? There are also some redundancy between the rule option visitor and the visitor of By the way, my current implementation is correctly validated. However, the configuration does not take effect s seen in unit test Also, the json schema informs the user to set both |
I need clarification on what you think it's wrong. Would you mind pointing out the code or explaining in more detail?
Have you tried to debug it? You can use the
Implementing
|
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
I applied most of your suggestions. For now, I am not completely satisfied with the printed diagnostics. I will rework this part. |
I am ready for the final review and merge :) |
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.
There's one thing that concerns me, which is the code action. I failed to find a test case where we have the same incorrect name used multiple times, and how the code action behaves (same thing for the diagnostic).
For example:
const PascalVariable = 2;
console.log(PascalVariable);
how's the diagnostic and how's the code action?
About the documentation: you often the "should" instead to use the imperative. The "should" implies a conditional, which implies something that "is not sure" or "up to interpretation". Since we are writing about a rule, I think we should use more "decisive" tenses.
crates/rome_js_analyze/tests/specs/nursery/useExhaustiveDependencies/malformedOptions.js.snap
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
crates/rome_js_analyze/src/semantic_analyzers/nursery/use_naming_convention.rs
Outdated
Show resolved
Hide resolved
Also, could you upgrade your |
The |
Have you some docs about this? |
Not at the moment, since the JS API are very experimental. This the home of the project: https://github.com/rome/tools/tree/main/npm%2Fjs-api You would need to build the WASM packages. The Once the packages are built, you should be able to run the tests and be able to update the snapshots. |
I am stuck. I installed wasm-pack from my distribution repository (installing with I run I got the following error when running
By the way running these commands without Then I run the following command:
|
That's OK. Not a blocker. We can disable the job for now and move on; it's not a priority that API. |
FYI the locals limit was hit already few months ago. I did digging: rustwasm/wasm-bindgen#3451 Will try to fix it in another PR when I have time. If someone wants to help, that's very welcome |
I finally identified the issue :) |
Summary
Implementation of useNamingConvention.
Test Plan
I added a large test suite.
Changelog
Documentation