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

Commit

Permalink
chore: code suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Dec 19, 2022
1 parent c96d1f6 commit 8177926
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,22 @@ impl Rule for NoNoninteractiveElementToInteractiveRole {
AnyJsExpression::AnyJsLiteralExpression(
AnyJsLiteralExpression::JsStringLiteralExpression(string),
) => string.inner_string_text().ok(),
AnyJsExpression::JsTemplateExpression(template) => template
.elements()
.iter()
.next()
.and_then(|chunk| {
chunk
.as_js_template_chunk_element()
.and_then(|t| t.template_chunk_token().ok())
})
.map(|t| t.token_text_trimmed()),
AnyJsExpression::JsTemplateExpression(template) => {
if template.elements().len() == 1 {
template
.elements()
.iter()
.next()
.and_then(|chunk| {
chunk
.as_js_template_chunk_element()
.and_then(|t| t.template_chunk_token().ok())
})
.map(|t| t.token_text_trimmed())
} else {
None
}
}
_ => None,
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
let a = <span role="button"></span>;
let a = <span role={`scroll${a}bar`}></span>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ expression: valid.jsx
# Input
```js
let a = <span role="button"></span>;
let a = <span role={`scroll${a}bar`}></span>;

```

Expand Down

0 comments on commit 8177926

Please sign in to comment.