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

feat(rome_js_analyze): rule noAccessKey #3796

Merged
merged 8 commits into from
Nov 22, 2022
Merged

feat(rome_js_analyze): rule noAccessKey #3796

merged 8 commits into from
Nov 22, 2022

Conversation

lucasweng
Copy link
Contributor

@lucasweng lucasweng commented Nov 19, 2022

Summary

Test Plan

cargo test -p rome_js_analyze -- no_access_key

@lucasweng lucasweng requested a review from a team November 19, 2022 13:39
@netlify
Copy link

netlify bot commented Nov 19, 2022

Deploy Preview for docs-rometools ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 13313d8
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/637c98dd3f0d6900087f4d2a
😎 Deploy Preview https://deploy-preview-3796--docs-rometools.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

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

Copy link
Contributor Author

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,
Copy link
Contributor

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 ?

Copy link
Contributor Author

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",
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 83 to 84
// We do not know if the `accessKey` prop is used as the `accessKey` attribute on HTML elements
// inside a user-created React component
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fe2d326 updated

@MichaReiser MichaReiser added this to the 11.0.0 milestone Nov 21, 2022
@MichaReiser MichaReiser added A-Linter Area: linter L-JavaScript Langauge: JavaScript labels Nov 21, 2022
@ematipico ematipico removed this from the 11.0.0 milestone Nov 22, 2022
@ematipico ematipico added L-JSX Language: JSX and removed L-JavaScript Langauge: JavaScript labels Nov 22, 2022
@ematipico ematipico merged commit ec6486d into rome:main Nov 22, 2022
@lucasweng lucasweng deleted the feat/no-access-key branch November 22, 2022 09:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Linter Area: linter L-JSX Language: JSX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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