-
-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lint): display correspinding element #2930
feat(lint): display correspinding element #2930
Conversation
CodSpeed Performance ReportMerging #2930 will not alter performanceComparing Summary
|
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.
Thank you @fujiyamaorange for making the rule better.
I left some suggestions.
There's one 'important change we need to do:
There's no need to collect result_elements
and result_attributes
inside the function run
. Instead, you could save inside your State
the JSX attribute that we found, and the role name we found .e.g (AnyJsxAttribute, TokenText)
. And we search for the "concept"/"element" that we need inside the diagnostic
function. This will remove all those string allocations that aren't need. Like this, we will only allocate the string that we need.
crates/biome_js_analyze/src/lint/nursery/use_semantic_elements.rs
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/lint/nursery/use_semantic_elements.rs
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/lint/nursery/use_semantic_elements.rs
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/lint/nursery/use_semantic_elements.rs
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/lint/nursery/use_semantic_elements.rs
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/lint/nursery/use_semantic_elements.rs
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/lint/nursery/use_semantic_elements.rs
Outdated
Show resolved
Hide resolved
@ematipico |
> 8 │ <div role="button" ></div> | ||
│ ^^^^^^^^^^^^^ | ||
│ ^^^^ |
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 range here is incorrect. It should highlight the whole attribute as before
! The elements with the following roles can be changed to the following elements: | ||
<button> | ||
<input type="button"> |
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.
If we're able to suggest possible alternatives like in this case, why do we keep showing the loooong list at the end?
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.
Thank you for reviewing.
I modified suggestion messages in 207c4f4. 👍
345c9fe
to
cd6124b
Compare
Summary
Implements this comment.
Finally, we can get alternative element.
Test Plan