Skip to content

Commit 37db5a3

Browse files
Ethan Cohenjessebeach
authored andcommitted
Clean up impl a bit
1 parent d31ebb5 commit 37db5a3

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/rules/accessible-emoji.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,16 @@ module.exports = {
3131
return false;
3232
});
3333

34-
if (literalChildValue) {
35-
const containsEmoji = emojiRegex().test(literalChildValue.value);
36-
37-
if (containsEmoji) {
38-
const roleProp = getProp(node.attributes, 'role');
39-
const rolePropValue = getLiteralPropValue(roleProp);
40-
const ariaLabelProp = getProp(node.attributes, 'aria-label');
41-
const isSpan = elementType(node) === 'span';
42-
if (ariaLabelProp === 'undefined' || rolePropValue !== 'img' || isSpan === false) {
43-
context.report({
44-
node,
45-
message: errorMessage,
46-
});
47-
}
34+
if (literalChildValue && emojiRegex().test(literalChildValue.value)) {
35+
const rolePropValue = getLiteralPropValue(getProp(node.attributes, 'role'));
36+
const ariaLabelProp = getProp(node.attributes, 'aria-label');
37+
const isSpan = elementType(node) === 'span';
38+
39+
if (ariaLabelProp === 'undefined' || rolePropValue !== 'img' || isSpan === false) {
40+
context.report({
41+
node,
42+
message: errorMessage,
43+
});
4844
}
4945
}
5046
},

0 commit comments

Comments
 (0)