From 1df7f131489d001d3511fedce2d04c7cd45483b5 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 3 Dec 2021 11:05:02 -0500 Subject: [PATCH] Oop,a ctually commit the set --- src/rules/aria-role.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rules/aria-role.js b/src/rules/aria-role.js index 83ead048d..57e4096bd 100644 --- a/src/rules/aria-role.js +++ b/src/rules/aria-role.js @@ -38,8 +38,8 @@ export default { create: (context) => { const options = context.options[0] || {}; const ignoreNonDOM = !!options.ignoreNonDOM; - const allowedInvalidRoles = new Set(options.allowedInvalidRoles || []) - const validRoles = [...roles.keys()].filter((role) => roles.get(role).abstract === false); + const allowedInvalidRoles = new Set(options.allowedInvalidRoles || []); + const validRoles = new Set([...roles.keys()].filter((role) => roles.get(role).abstract === false)); return ({ JSXAttribute: (attribute) => { @@ -64,7 +64,7 @@ export default { if (value === undefined || value === null) { return; } const values = String(value).split(' '); - const isValid = values.every((val) => allowedInvalidRoles.has(val) || validRoles.indexOf(val) > -1); + const isValid = values.every((val) => allowedInvalidRoles.has(val) || validRoles.has(val)); if (isValid === true) { return; }