@fabriziosalmi/slopless 1.12.1 → 1.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine/api.js +2 -2
- package/dist/index.js +41 -41
- package/package.json +1 -1
- package/rules/VBC-035.yaml +23 -1
- package/rules/VBC-944.yaml +8 -1
package/package.json
CHANGED
package/rules/VBC-035.yaml
CHANGED
|
@@ -5,7 +5,11 @@ category: ux-dx
|
|
|
5
5
|
tags:
|
|
6
6
|
- accessibility
|
|
7
7
|
match:
|
|
8
|
-
|
|
8
|
+
# "Icon-only" is the whole claim: a button holding an icon *and* a visible
|
|
9
|
+
# label already has an accessible name, and that is how most toolbars are
|
|
10
|
+
# written. The svg has to be the only thing between the tags.
|
|
11
|
+
regex: >-
|
|
12
|
+
<button\b(?![^>]*(?:aria-label|aria-labelledby|title))[^>]*>\s*<svg\b[^>]*(?:/>|>(?:(?!</svg>)[\s\S])*?</svg>)\s*</button>
|
|
9
13
|
multiline: true
|
|
10
14
|
file_types:
|
|
11
15
|
- html
|
|
@@ -23,9 +27,27 @@ tests:
|
|
|
23
27
|
<button onClick={close}>
|
|
24
28
|
<svg viewBox="0 0 24 24" />
|
|
25
29
|
</button>
|
|
30
|
+
- file: fixture.tsx
|
|
31
|
+
code: |
|
|
32
|
+
<button onClick={close}>
|
|
33
|
+
<svg viewBox="0 0 24 24"><path d="M6 6l12 12"/></svg>
|
|
34
|
+
</button>
|
|
26
35
|
quiet:
|
|
27
36
|
- file: fixture.tsx
|
|
28
37
|
code: |
|
|
29
38
|
<button aria-label="Close" onClick={close}>
|
|
30
39
|
<svg viewBox="0 0 24 24" />
|
|
31
40
|
</button>
|
|
41
|
+
# A visible label is an accessible name.
|
|
42
|
+
- file: fixture.tsx
|
|
43
|
+
code: |
|
|
44
|
+
<button class="btn-primary" id="btn-download-zip">
|
|
45
|
+
<svg width="18" height="18" viewBox="0 0 24 24"><path d="M21 15v4"/></svg>
|
|
46
|
+
Download Project ZIP
|
|
47
|
+
</button>
|
|
48
|
+
- file: fixture.tsx
|
|
49
|
+
code: |
|
|
50
|
+
<button onClick={close}>
|
|
51
|
+
<svg viewBox="0 0 24 24" />
|
|
52
|
+
<span class="sr-only">Close</span>
|
|
53
|
+
</button>
|
package/rules/VBC-944.yaml
CHANGED
|
@@ -10,8 +10,12 @@ match:
|
|
|
10
10
|
# settles it first: `mailto:${addr}` and `/blog/${slug}` cannot become
|
|
11
11
|
# `javascript:` whatever the value is, and that is how a template builds
|
|
12
12
|
# every ordinary link.
|
|
13
|
+
#
|
|
14
|
+
# import.meta.env.X is replaced by the bundler before the page ever runs, so
|
|
15
|
+
# it is a literal by the time a request exists. Vite and Astro spell every
|
|
16
|
+
# base path that way.
|
|
13
17
|
regex: >-
|
|
14
|
-
href\s*=\s*\{[^}]*\+|href\s*=\s*[`'"]\s*\$\{|href\s*=\s*\{\s*[`'"]\s*\$\{
|
|
18
|
+
href\s*=\s*\{[^}]*\+|href\s*=\s*[`'"]\s*\$\{(?!\s*import\.meta\.env\.)|href\s*=\s*\{\s*[`'"]\s*\$\{(?!\s*import\.meta\.env\.)
|
|
15
19
|
scan: all
|
|
16
20
|
file_types:
|
|
17
21
|
- js
|
|
@@ -32,4 +36,7 @@ tests:
|
|
|
32
36
|
- '<a href={`mailto:${contact.email}`}>write to us</a>'
|
|
33
37
|
- '<a href={`/blog/${slug}`}>read on</a>'
|
|
34
38
|
- '<a href={`https://example.org/u/${user}`}>profile</a>'
|
|
39
|
+
# Replaced by the bundler before a request exists.
|
|
40
|
+
- '<link href={`${import.meta.env.BASE_URL}favicon.svg`} />'
|
|
41
|
+
- '<a href={`${import.meta.env.BASE_URL}docs/${slug}`}>docs</a>'
|
|
35
42
|
- <a href="/static/page">page</a>
|