-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat]: Add A11y aria-proptypes check (#6978)
* Add aria prop type list * feat: check aria attribute types * feat: add proptype tests * Add documentation * use aria-query Co-authored-by: Nurassyl Zekenov <[email protected]> Co-authored-by: [email protected] <[email protected]> Co-authored-by: tanhauhau <[email protected]> Co-authored-by: David Mosher <[email protected]>
- Loading branch information
1 parent
4617c0d
commit 3990198
Showing
17 changed files
with
445 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
test/validator/samples/a11y-aria-proptypes-boolean/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script> | ||
const abc = 'abc'; | ||
</script> | ||
|
||
<button aria-disabled="yes"/> | ||
<button aria-disabled="no"/> | ||
<button aria-disabled={1234}/> | ||
<button aria-disabled={`${abc}`}/> |
32 changes: 32 additions & 0 deletions
32
test/validator/samples/a11y-aria-proptypes-boolean/warnings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-disabled' must be exactly one of true or false", | ||
"start": { | ||
"line": 5, | ||
"column": 8, | ||
"character": 51 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 27, | ||
"character": 70 | ||
}, | ||
"pos": 51 | ||
}, | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-disabled' must be exactly one of true or false", | ||
"start": { | ||
"line": 6, | ||
"column": 8, | ||
"character": 81 | ||
}, | ||
"end": { | ||
"line": 6, | ||
"column": 26, | ||
"character": 99 | ||
}, | ||
"pos": 81 | ||
} | ||
] |
7 changes: 7 additions & 0 deletions
7
test/validator/samples/a11y-aria-proptypes-integer/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div aria-level="yes" /> | ||
<div aria-level="no" /> | ||
<div aria-level={`abc`} /> | ||
<div aria-level={true} /> | ||
<div aria-level /> | ||
<div aria-level={"false"} /> | ||
<div aria-level={!"false"} /> |
47 changes: 47 additions & 0 deletions
47
test/validator/samples/a11y-aria-proptypes-integer/warnings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[ | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-level' must be of type integer", | ||
"start": { | ||
"line": 1, | ||
"column": 5, | ||
"character": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 21, | ||
"character": 21 | ||
}, | ||
"pos": 5 | ||
}, | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-level' must be of type integer", | ||
"start": { | ||
"line": 2, | ||
"column": 5, | ||
"character": 30 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 20, | ||
"character": 45 | ||
}, | ||
"pos": 30 | ||
}, | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-level' must be of type integer", | ||
"start": { | ||
"line": 5, | ||
"column": 5, | ||
"character": 107 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 15, | ||
"character": 117 | ||
}, | ||
"pos": 107 | ||
} | ||
] |
7 changes: 7 additions & 0 deletions
7
test/validator/samples/a11y-aria-proptypes-number/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div aria-valuemax="yes" /> | ||
<div aria-valuemax="no" /> | ||
<div aria-valuemax={`abc`} /> | ||
<div aria-valuemax={true} /> | ||
<div aria-valuemax /> | ||
<div aria-valuemax={'false'} /> | ||
<div aria-valuemax={!'false'} /> |
47 changes: 47 additions & 0 deletions
47
test/validator/samples/a11y-aria-proptypes-number/warnings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[ | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-valuemax' must be of type number", | ||
"start": { | ||
"line": 1, | ||
"column": 5, | ||
"character": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 24, | ||
"character": 24 | ||
}, | ||
"pos": 5 | ||
}, | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-valuemax' must be of type number", | ||
"start": { | ||
"line": 2, | ||
"column": 5, | ||
"character": 33 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 23, | ||
"character": 51 | ||
}, | ||
"pos": 33 | ||
}, | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-valuemax' must be of type number", | ||
"start": { | ||
"line": 5, | ||
"column": 5, | ||
"character": 119 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 18, | ||
"character": 132 | ||
}, | ||
"pos": 119 | ||
} | ||
] |
5 changes: 5 additions & 0 deletions
5
test/validator/samples/a11y-aria-proptypes-string/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div aria-label /> | ||
<div aria-label={true} /> | ||
<div aria-label={false} /> | ||
<div aria-label={1234} /> | ||
<div aria-label={!true} /> |
17 changes: 17 additions & 0 deletions
17
test/validator/samples/a11y-aria-proptypes-string/warnings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[ | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-label' must be of type string", | ||
"start": { | ||
"line": 1, | ||
"column": 5, | ||
"character": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 15, | ||
"character": 15 | ||
}, | ||
"pos": 5 | ||
} | ||
] |
6 changes: 6 additions & 0 deletions
6
test/validator/samples/a11y-aria-proptypes-token/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div aria-sort="" /> | ||
<div aria-sort="descnding" /> | ||
<div aria-sort /> | ||
<div aria-sort={true} /> | ||
<div aria-sort={"false"} /> | ||
<div aria-sort="ascending descending" /> |
62 changes: 62 additions & 0 deletions
62
test/validator/samples/a11y-aria-proptypes-token/warnings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
[ | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", | ||
"start": { | ||
"line": 1, | ||
"column": 5, | ||
"character": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 17, | ||
"character": 17 | ||
}, | ||
"pos": 5 | ||
}, | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", | ||
"start": { | ||
"line": 2, | ||
"column": 5, | ||
"character": 26 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 26, | ||
"character": 47 | ||
}, | ||
"pos": 26 | ||
}, | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", | ||
"start": { | ||
"line": 3, | ||
"column": 5, | ||
"character": 56 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 14, | ||
"character": 65 | ||
}, | ||
"pos": 56 | ||
}, | ||
{ | ||
"code": "a11y-incorrect-aria-attribute-type", | ||
"message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", | ||
"start": { | ||
"line": 6, | ||
"column": 5, | ||
"character": 127 | ||
}, | ||
"end": { | ||
"line": 6, | ||
"column": 37, | ||
"character": 159 | ||
}, | ||
"pos": 127 | ||
} | ||
] |
7 changes: 7 additions & 0 deletions
7
test/validator/samples/a11y-aria-proptypes-tokenlist/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div aria-relevant="" /> | ||
<div aria-relevant="foobar" /> | ||
<div aria-relevant /> | ||
<div aria-relevant={true} /> | ||
<div aria-relevant={"false"} /> | ||
<div aria-relevant="additions removalss" /> | ||
<div aria-relevant="additions removalss " /> |
Oops, something went wrong.