@fabriziosalmi/slopless 1.4.3 → 1.4.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriziosalmi/slopless",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -6,7 +6,7 @@ tags:
6
6
  - accessibility
7
7
  - html
8
8
  match:
9
- regex: <div[^>]*\s(onclick|onClick)=
9
+ regex: <div[^>]*\s(onclick|onClick)=(?!\{?\s*\(?\s*(?:e|ev|evt|event|_e)\s*\)?\s*=>\s*\{?\s*(?:e|ev|evt|event|_e)\.(?:stopPropagation|preventDefault)\(\)\s*\}?\s*\})
10
10
  file_types:
11
11
  - html
12
12
  - js
@@ -22,3 +22,5 @@ tests:
22
22
  - <div onClick={handleClick}>Save</div>
23
23
  quiet:
24
24
  - <button onClick={handleClick}>Save</button>
25
+ - <div className="row" onClick={(e) => e.stopPropagation()}>
26
+ - <div onClick={e => e.preventDefault()}>
@@ -6,7 +6,7 @@ tags:
6
6
  - security
7
7
  match:
8
8
  regex: >-
9
- http://(?!localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\]|test\b|example\.(?:com|org)|www\.w3\.org|schemas?\.|json-schema\.org|purl\.org|ns\.adobe|www\.apache\.org)
9
+ (?<!new URL\([^)]{0,200})http://(?!localhost|127\.|0\.0\.0\.0|169\.254\.|\[::1\]|test\b|example\.(?:com|org)|www\.w3\.org|schemas?\.|json-schema\.org|purl\.org|ns\.adobe|www\.apache\.org)
10
10
  scan: strings
11
11
  file_types:
12
12
  - js
@@ -38,4 +38,7 @@ tests:
38
38
  quiet:
39
39
  - const api = 'https://api.example.com/v1';
40
40
  - const dev = 'http://localhost:3000';
41
+ - const dev2 = 'http://127.0.0.1:8000';
42
+ - "refuse http://169.254.169.254 (cloud metadata) before connecting"
43
+ - const parsed = new URL(req.url, `http://${req.headers.host}`);
41
44
  - const svg = 'http://www.w3.org/2000/svg';
@@ -5,7 +5,8 @@ category: core
5
5
  tags:
6
6
  - security
7
7
  match:
8
- regex: \.innerHTML\s*=(?!=)
8
+ regex: >-
9
+ \.innerHTML\s*=(?!=)(?!\s*(['"])(?:(?!\1)[^\\])*\1\s*[;\n])
9
10
  file_types:
10
11
  - js
11
12
  - ts
@@ -14,6 +15,10 @@ message: >-
14
15
  tests:
15
16
  fire:
16
17
  - el.innerHTML = markup;
18
+ - el.innerHTML = "<b>" + name + "</b>";
19
+ - el.innerHTML = `<b>${name}</b>`;
17
20
  quiet:
18
21
  - el.textContent = text;
22
+ - alert.innerHTML = '<i class="fa-check"></i> <span id="t"></span>';
23
+ - el.innerHTML = "";
19
24
  - if (el.innerHTML === "") { init(); }
@@ -18,6 +18,13 @@ tests:
18
18
  this.cache.set(id, 1);
19
19
  return id;
20
20
  }
21
+ - |
22
+ class E {
23
+ getLevel() {
24
+ if (!this.buf) { this.hits = this.hits + 1; }
25
+ return this.buf;
26
+ }
27
+ }
21
28
  quiet:
22
29
  - |
23
30
  function getUser(id) {
@@ -27,6 +34,22 @@ tests:
27
34
  function getOffset(node) {
28
35
  return node.dataset.offset;
29
36
  }
37
+ - |
38
+ class E {
39
+ getMasterLevel() {
40
+ if (!this.buf || this.buf.length !== this.analyser.fftSize) {
41
+ this.buf = new Float32Array(this.analyser.fftSize);
42
+ }
43
+ return rms(this.buf);
44
+ }
45
+ }
46
+ - |
47
+ class R {
48
+ async fetchFromRemote(url) {
49
+ this.fetched = true;
50
+ return fetch(url);
51
+ }
52
+ }
30
53
  - |
31
54
  function getAll() {
32
55
  const out = [];
@@ -9,6 +9,22 @@ match:
9
9
  regex: >-
10
10
  outline:\s*(?:none|0)\b(?![\s\S]{0,400}?:focus-visible[\s\S]{0,140}?outline\s*:\s*(?!none|0|\s*;))
11
11
  multiline: true
12
+ # An outline only ever appears on focus, so removing one matters only where
13
+ # focus can land. `.card { outline: none }` on a div nobody can tab to removes
14
+ # nothing; the same line under `:focus-visible` removes the only thing telling
15
+ # a keyboard user where they are.
16
+ require_selectors:
17
+ - ':focus'
18
+ - ':active'
19
+ - a
20
+ - button
21
+ - input
22
+ - select
23
+ - textarea
24
+ - summary
25
+ - details
26
+ - '[tabindex]'
27
+ - '[contenteditable]'
12
28
  file_types:
13
29
  - css
14
30
  - scss
@@ -19,8 +35,12 @@ message: >-
19
35
  tests:
20
36
  fire:
21
37
  - 'a:focus { outline: none; }'
38
+ - 'input[type="range"]:focus-visible { outline: none; }'
39
+ - '.editor:focus-visible { outline: none !important; }'
22
40
  quiet:
23
41
  - 'a:focus { outline: 2px solid currentColor; }'
42
+ - '.card { cursor: default; outline: none; overflow: hidden; }'
43
+ - '.ProseMirror { outline: none; min-height: 100vh; }'
24
44
  - |
25
45
  *:focus {
26
46
  outline: none;