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

feat(rome_js_analyzer): rule useKeyWithClickEvents #3372

Closed
wants to merge 33 commits into from

Conversation

jk-gan
Copy link
Contributor

@jk-gan jk-gan commented Oct 9, 2022

Summary

Closes #3301

Test Plan

Added various test cases

Screenshot 2022-10-09 at 5 00 20 PM

Screenshot 2022-10-09 at 5 00 17 PM

@jk-gan jk-gan requested a review from a team October 9, 2022 09:05
@netlify
Copy link

netlify bot commented Oct 9, 2022

👷 Deploy request for docs-rometools accepted.

Name Link
🔨 Latest commit bb614f9
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/63495427aa9e560008e2e01d

@jk-gan
Copy link
Contributor Author

jk-gan commented Oct 9, 2022

if possible, could you please add hacktoberfest label to the PR?
because otherwise it won't be count for me.

fn diagnostic(ctx: &RuleContext<Self>, _attr: &Self::State) -> Option<RuleDiagnostic> {
let node = ctx.query();

Some(RuleDiagnostic::new(
Copy link
Contributor

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 ?

Copy link
Contributor Author

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?

Copy link
Contributor

@ematipico ematipico Oct 12, 2022

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())
Copy link
Contributor

@xunilrj xunilrj Oct 10, 2022

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) { ... }
    }
);

@ematipico
Copy link
Contributor

if possible, could you please add hacktoberfest label to the PR? because otherwise it won't be count for me.

We'll check tomorrow internally if we are able to opt-in for hacktoberfest :)

@ematipico
Copy link
Contributor

if possible, could you please add hacktoberfest label to the PR? because otherwise it won't be count for me.

The team agreed to opt-in, we will have some issue for hacktoberfest

MichaReiser and others added 2 commits October 11, 2022 17:32
* docs(website): small QoL for rules page

* fix: version of the website

* fix: outdated documentation

* format
MichaReiser and others added 13 commits October 12, 2022 14:07
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
…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
@jk-gan jk-gan requested a review from MichaReiser as a code owner October 14, 2022 12:20
@jk-gan
Copy link
Contributor Author

jk-gan commented Oct 14, 2022

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.

@jk-gan jk-gan closed this Oct 14, 2022
@jk-gan
Copy link
Contributor Author

jk-gan commented Oct 14, 2022

#3426 this PR is able to detect the correct file change

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.

useKeyWithClickEvents
7 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载