-
Notifications
You must be signed in to change notification settings - Fork 653
feat(rome_js_analyzer): rule useKeyWithClickEvents
#3372
Conversation
👷 Deploy request for docs-rometools accepted.
|
if possible, could you please add hacktoberfest label to the PR? |
* feat(rome_analyze): use serde to deserialize rule settings * chore: code suggestions
fn diagnostic(ctx: &RuleContext<Self>, _attr: &Self::State) -> Option<RuleDiagnostic> { | ||
let node = ctx.query(); | ||
|
||
Some(RuleDiagnostic::new( |
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 we add an additional footer note to explain why these attributes are required ?
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.
ya sure, is there a way to add additional notes? or just add more explanations on the RuleDiagnostic
?
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.
Like this:
RuleDiagnostic::new(/* arguments */)
.footer_note(markup!{"Additional text"}.to_owned());
|
||
match required_props | ||
.iter() | ||
.find_map(|key_event| element.find_attribute_by_name(key_event).ok().flatten()) |
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.
find_attribute_by_name
is kind a expensive function, probably makes more sense to do the inverse
let all_atts_present = element.attributes()
.filter_map(|att| {
let name = att.as_jsx_attribute()?.name().ok()?.as_jsx_name()?.value_token().trimmed_text();
if required_props.contains(name) { ... }
}
);
We'll check tomorrow internally if we are able to opt-in for hacktoberfest :) |
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
…least 10 characters wide (rome#3396)
The team agreed to opt-in, we will have some issue for hacktoberfest |
* docs(website): small QoL for rules page * fix: version of the website * fix: outdated documentation * format
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
… pattern member union (rome#3408)
…me#3381) * feat(rome_analyze): use serde to deserialize rule settings * chore: code suggestions * feat(rome_js_analyze): handle serde errors inside `RuleContext` * chore: move to use `serde::Value` to avoid breaking deserialization * chore: merge from main * chore: code suggestions * chore: clippy * feat(rome_js_analyze): compute `AnalyzerOptions` from `Workspace` * chore: todo for track diagnostic error * chore: fix link * chore: fix test * chore: code suggestions
…3412) * fix(rome_diagnostics): fix unknown rule warning false positive * address PR review
* fix(rome_cli): improve the main help text * address PR review
* feat(rome_js_analyze): new rule `noExplicitAny` * chore: address PR feedback * fix: version number * fix: update docs
…m/jk-gan/rome-tools into feature/use-key-with-click-events
hmmm I think the commits are messed up after I rebased. Let me open another PR and see if Github can detect the correct file change. |
#3426 this PR is able to detect the correct file change |
Summary
Closes #3301
Test Plan
Added various test cases