-
Notifications
You must be signed in to change notification settings - Fork 653
feat(rome_js_analyze): rule noAccessKey
#3796
Conversation
✅ Deploy Preview for docs-rometools ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
let expression = expression.expression().ok()?; | ||
let name = expression.as_js_identifier_expression()?.name().ok()?; | ||
let name_token = name.value_token().ok()?; | ||
if matches!(name_token.text_trimmed(), "undefined" | "null") { |
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.
Nit: the check for "null" branch will never return true as null
is parsed as a JsNullLiteralExpression
instead of a JsIdentifierExpression
, so the function would have already exited at this point since as_js_identifier_expression
will return None
in this case
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.
a6eae35 thanks!
mutation.remove_node(node.clone()); | ||
Some(JsRuleAction { | ||
category: ActionCategory::QuickFix, | ||
applicability: Applicability::Always, |
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.
This should probably be set to MaybeIncorrect
for now since I think our infrastructure for accessibility rules yields many false positives at the moment. @MichaReiser I think you may have some additional context on this ?
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.
18ba61c set to MaybeIncorrect
@@ -60,6 +60,7 @@ define_dategories! { | |||
"lint/complexity/noExtraBooleanCast": "https://docs.rome.tools/lint/rules/noExtraBooleanCast", | |||
|
|||
// a11y group | |||
"lint/a11y/noAccessKey": "https://docs.rome.tools/lint/rules/noAccessKey", |
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.
New rules must be placed under the nursery
group the first time they're created.
When implementing new rules, they have to be implemented under the group nursery. New rules should always be considered unstable/not exhaustive.
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.
5fb27c2 Thanks @ematipico!
// We do not know if the `accessKey` prop is used as the `accessKey` attribute on HTML elements | ||
// inside a user-created React component |
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.
// We do not know if the `accessKey` prop is used as the `accessKey` attribute on HTML elements | |
// inside a user-created React component | |
// We do not know if the `accessKey` prop is used for HTML elements | |
// or for user-created React components |
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.
fe2d326 updated
Summary
Test Plan
cargo test -p rome_js_analyze -- no_access_key