Commit 86917b3
committed
fix(template-no-aria-label-misuse): specificity tiers, pre-indexed elementRoles, valueless-label, fixable meta (Copilot review)
- scoreMatch now uses three tiers: exact value (3) > set (2) > undefined (1).
Previously set and undefined both added +1, so a stricter 'set' constraint
could lose to a looser 'undefined' when both matched. Exact-value entries
still win over 'set' (e.g. <img alt=''> → presentation still beats the
generic alt-set entry).
- Pre-index elementRoles by tag name at module load (same pattern as PR #52's
template-no-unsupported-role-attributes). Turns a ~80-key scan per call
into a 1–5-key lookup.
- hasNonEmptyLabelAttr returns false when attr.value == null — a valueless
aria-label / aria-labelledby carries no accessible name, so it shouldn't
be treated as a non-empty (author-declared) label.
- Add meta.fixable: null — rule is not autofixable, be explicit.1 parent 599c116 commit 86917b3
1 file changed
Lines changed: 37 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
36 | | - | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
43 | | - | |
| 49 | + | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
| |||
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
58 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
59 | 86 | | |
60 | 87 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 88 | + | |
65 | 89 | | |
66 | 90 | | |
67 | 91 | | |
68 | 92 | | |
69 | 93 | | |
70 | 94 | | |
71 | | - | |
| 95 | + | |
72 | 96 | | |
73 | 97 | | |
74 | 98 | | |
| |||
106 | 130 | | |
107 | 131 | | |
108 | 132 | | |
109 | | - | |
110 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
111 | 138 | | |
112 | 139 | | |
113 | 140 | | |
| |||
145 | 172 | | |
146 | 173 | | |
147 | 174 | | |
| 175 | + | |
148 | 176 | | |
149 | 177 | | |
150 | 178 | | |
| |||
0 commit comments