Skip to content

Commit

Permalink
Don't delete all of attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
khiga8 committed Jul 10, 2023
1 parent 951feea commit 95c60cf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rules/role-supports-aria-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ const elementRolesMap = new ObjectMap()
for (const [key, value] of elementRoles.entries()) {
// - Remove unused `constraints` key
delete key.constraints
key.attributes = key.attributes?.filter(attribute => !('constraints' in attribute))
// - Remove `constraints` key within `attributes`
for (const attribute of key.attributes || []) {
delete attribute.constraints
}
// - Remove empty `attributes` key
if (!key.attributes || key.attributes?.length === 0) {
delete key.attributes
Expand Down

0 comments on commit 95c60cf

Please sign in to comment.