@accesslint/storybook-addon 0.8.9 → 0.8.11
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/README.md +26 -30
- package/dist/chunk-pbuEa-1d.js +13 -0
- package/dist/index.cjs +6 -116
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +6 -6
- package/dist/manager.d.ts +1 -0
- package/dist/manager.js +404 -395
- package/dist/matchers.cjs +10 -10
- package/dist/matchers.d.cts +2 -1
- package/dist/matchers.d.ts +2 -1
- package/dist/matchers.js +2 -1
- package/dist/portable.cjs +146 -105
- package/dist/portable.d.cts +37 -54
- package/dist/portable.d.ts +37 -54
- package/dist/portable.js +130 -104
- package/dist/preview-B3suakeJ.js +118 -0
- package/dist/preview-B8cvp9pY.cjs +148 -0
- package/dist/preview.cjs +6 -102
- package/dist/preview.d.cts +32 -17
- package/dist/preview.d.ts +32 -17
- package/dist/preview.js +2 -1
- package/dist/vitest-plugin.cjs +15 -27
- package/dist/vitest-plugin.d.cts +15 -14
- package/dist/vitest-plugin.d.ts +15 -14
- package/dist/vitest-plugin.js +14 -24
- package/dist/vitest-setup.cjs +131 -108
- package/dist/vitest-setup.d.cts +1 -2
- package/dist/vitest-setup.d.ts +1 -2
- package/dist/vitest-setup.js +127 -103
- package/package.json +86 -24
- package/dist/chunk-XTEGJNR3.js +0 -110
package/dist/vitest-setup.js
CHANGED
|
@@ -1,116 +1,140 @@
|
|
|
1
|
-
import { expect } from
|
|
2
|
-
import { expect as expect$1 } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { accesslintMatchers } from
|
|
6
|
-
|
|
1
|
+
import { expect } from "storybook/test";
|
|
2
|
+
import { expect as expect$1 } from "vitest";
|
|
3
|
+
import { addons, composeConfigs } from "storybook/preview-api";
|
|
4
|
+
import { createChunkedAudit, getActiveRules, getRuleById } from "@accesslint/core";
|
|
5
|
+
import { accesslintMatchers } from "@accesslint/vitest/matchers";
|
|
6
|
+
//#region \0rolldown/runtime.js
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
var __exportAll = (all, no_symbols) => {
|
|
9
|
+
let target = {};
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
15
|
+
return target;
|
|
11
16
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const RESULT_EVENT = `accesslint/a11y/result`;
|
|
18
|
+
const HIGHLIGHT_ADDON_ID = "storybook/highlight";
|
|
19
|
+
`${HIGHLIGHT_ADDON_ID}`;
|
|
20
|
+
`${HIGHLIGHT_ADDON_ID}`;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/preview.ts
|
|
23
|
+
var preview_exports = /* @__PURE__ */ __exportAll({
|
|
24
|
+
afterEach: () => afterEach,
|
|
25
|
+
initialGlobals: () => initialGlobals,
|
|
26
|
+
parameters: () => parameters,
|
|
27
|
+
setAuditOptions: () => setAuditOptions
|
|
19
28
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
29
|
+
const initialGlobals = { accesslint: {} };
|
|
30
|
+
const parameters = { accesslint: {} };
|
|
31
|
+
let AUDIT_OPTIONS = { disabledRules: ["accesslint-045"] };
|
|
32
|
+
/**
|
|
33
|
+
* Merge additional audit options (disabledRules, additionalRules, includeAAA,
|
|
34
|
+
* componentMode, locale) into the options used for every Storybook audit.
|
|
35
|
+
* Call from your `.storybook/preview.ts` after importing the addon.
|
|
36
|
+
*/
|
|
37
|
+
function setAuditOptions(options) {
|
|
38
|
+
AUDIT_OPTIONS = {
|
|
39
|
+
...AUDIT_OPTIONS,
|
|
40
|
+
...options,
|
|
41
|
+
disabledRules: [...AUDIT_OPTIONS.disabledRules ?? [], ...options.disabledRules ?? []],
|
|
42
|
+
additionalRules: [...AUDIT_OPTIONS.additionalRules ?? [], ...options.additionalRules ?? []]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const BUDGET_MS = 12;
|
|
36
46
|
function yieldToMain() {
|
|
37
|
-
|
|
47
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
38
48
|
}
|
|
39
49
|
function scopeViolations(violations) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
const root = document.getElementById("storybook-root");
|
|
51
|
+
if (!root) return violations;
|
|
52
|
+
return violations.filter((v) => {
|
|
53
|
+
const local = v.selector.replace(/^.*>>>\s*iframe>\s*/, "");
|
|
54
|
+
try {
|
|
55
|
+
const el = document.querySelector(local);
|
|
56
|
+
return el && root.contains(el);
|
|
57
|
+
} catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
51
61
|
}
|
|
52
62
|
function enrichViolations(violations) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
63
|
+
return violations.map((v) => {
|
|
64
|
+
const rule = getRuleById(v.ruleId);
|
|
65
|
+
return {
|
|
66
|
+
...v,
|
|
67
|
+
element: void 0,
|
|
68
|
+
description: rule?.description,
|
|
69
|
+
wcag: rule?.wcag,
|
|
70
|
+
level: rule?.level,
|
|
71
|
+
guidance: rule?.guidance
|
|
72
|
+
};
|
|
73
|
+
});
|
|
65
74
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
75
|
+
const afterEach = async ({ reporting, parameters, viewMode, tags, id }) => {
|
|
76
|
+
const accesslintParam = parameters?.accesslint;
|
|
77
|
+
if (accesslintParam?.disable === true || accesslintParam?.test === "off") return;
|
|
78
|
+
if (viewMode !== "story") return;
|
|
79
|
+
const allSkipTags = ["skip-accesslint", ...typeof __ACCESSLINT_SKIP_TAGS__ !== "undefined" ? __ACCESSLINT_SKIP_TAGS__ : []];
|
|
80
|
+
const matchedTag = tags?.find((t) => allSkipTags.includes(t));
|
|
81
|
+
if (matchedTag) {
|
|
82
|
+
const result = {
|
|
83
|
+
skipped: true,
|
|
84
|
+
reason: matchedTag
|
|
85
|
+
};
|
|
86
|
+
addons.getChannel().emit(RESULT_EVENT, {
|
|
87
|
+
storyId: id,
|
|
88
|
+
result
|
|
89
|
+
});
|
|
90
|
+
reporting.addReport({
|
|
91
|
+
type: "accesslint",
|
|
92
|
+
version: 1,
|
|
93
|
+
result,
|
|
94
|
+
status: "passed"
|
|
95
|
+
});
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const audit = createChunkedAudit(document, AUDIT_OPTIONS);
|
|
99
|
+
while (audit.processChunk(BUDGET_MS)) await yieldToMain();
|
|
100
|
+
const enriched = enrichViolations(scopeViolations(audit.getViolations()));
|
|
101
|
+
const hasViolations = enriched.length > 0;
|
|
102
|
+
const mode = accesslintParam?.test === "todo" ? "warning" : "failed";
|
|
103
|
+
const status = hasViolations ? mode : "passed";
|
|
104
|
+
const result = {
|
|
105
|
+
violations: enriched,
|
|
106
|
+
ruleCount: getActiveRules(AUDIT_OPTIONS).length
|
|
107
|
+
};
|
|
108
|
+
addons.getChannel().emit(RESULT_EVENT, {
|
|
109
|
+
storyId: id,
|
|
110
|
+
result,
|
|
111
|
+
status
|
|
112
|
+
});
|
|
113
|
+
reporting.addReport({
|
|
114
|
+
type: "accesslint",
|
|
115
|
+
version: 1,
|
|
116
|
+
result,
|
|
117
|
+
status
|
|
118
|
+
});
|
|
111
119
|
};
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/vitest-setup.ts
|
|
122
|
+
/**
|
|
123
|
+
* Vitest setup file added by the accesslintTest() plugin.
|
|
124
|
+
*
|
|
125
|
+
* Merges the AccessLint preview annotations (afterEach, decorators) into
|
|
126
|
+
* globalProjectAnnotations so that AccessLint runs during vitest story tests
|
|
127
|
+
* and reports results as sidebar badges.
|
|
128
|
+
*
|
|
129
|
+
* Also registers the toBeAccessible() custom matcher with Storybook's expect
|
|
130
|
+
* and Vitest's expect for generic tests.
|
|
131
|
+
*
|
|
132
|
+
* This file runs AFTER the user's vitest.setup.js (which calls
|
|
133
|
+
* setProjectAnnotations), so globalProjectAnnotations is already set.
|
|
134
|
+
*/
|
|
112
135
|
expect.extend(accesslintMatchers);
|
|
113
136
|
expect$1.extend(accesslintMatchers);
|
|
114
|
-
|
|
115
|
-
|
|
137
|
+
const g = globalThis;
|
|
138
|
+
const existing = g.globalProjectAnnotations;
|
|
116
139
|
g.globalProjectAnnotations = existing ? composeConfigs([existing, preview_exports]) : composeConfigs([preview_exports]);
|
|
140
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@accesslint/storybook-addon",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.11",
|
|
4
4
|
"description": "Catch accessibility violations in your Storybook stories as you develop",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -9,43 +9,104 @@
|
|
|
9
9
|
"homepage": "https://www.accesslint.com/storybook?ref=npm_storybook",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/AccessLint/
|
|
12
|
+
"url": "git+https://github.com/AccessLint/accesslint.git",
|
|
13
|
+
"directory": "storybook-addon"
|
|
13
14
|
},
|
|
14
15
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/AccessLint/
|
|
16
|
+
"url": "https://github.com/AccessLint/accesslint/issues"
|
|
16
17
|
},
|
|
17
18
|
"type": "module",
|
|
18
19
|
"exports": {
|
|
19
20
|
".": {
|
|
20
|
-
"import":
|
|
21
|
-
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/index.d.cts",
|
|
27
|
+
"default": "./dist/index.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"./manager": {
|
|
31
|
+
"types": "./dist/manager.d.ts",
|
|
32
|
+
"default": "./dist/manager.js"
|
|
22
33
|
},
|
|
23
|
-
"./manager": "./dist/manager.js",
|
|
24
34
|
"./preview": {
|
|
25
|
-
"import":
|
|
26
|
-
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/preview.d.ts",
|
|
37
|
+
"default": "./dist/preview.js"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/preview.d.cts",
|
|
41
|
+
"default": "./dist/preview.cjs"
|
|
42
|
+
}
|
|
27
43
|
},
|
|
28
44
|
"./vitest-plugin": {
|
|
29
|
-
"import":
|
|
30
|
-
|
|
45
|
+
"import": {
|
|
46
|
+
"types": "./dist/vitest-plugin.d.ts",
|
|
47
|
+
"default": "./dist/vitest-plugin.js"
|
|
48
|
+
},
|
|
49
|
+
"require": {
|
|
50
|
+
"types": "./dist/vitest-plugin.d.cts",
|
|
51
|
+
"default": "./dist/vitest-plugin.cjs"
|
|
52
|
+
}
|
|
31
53
|
},
|
|
32
54
|
"./vitest-setup": {
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
55
|
+
"import": {
|
|
56
|
+
"types": "./dist/vitest-setup.d.ts",
|
|
57
|
+
"default": "./dist/vitest-setup.js"
|
|
58
|
+
},
|
|
59
|
+
"require": {
|
|
60
|
+
"types": "./dist/vitest-setup.d.cts",
|
|
61
|
+
"default": "./dist/vitest-setup.cjs"
|
|
62
|
+
}
|
|
36
63
|
},
|
|
37
64
|
"./matchers": {
|
|
38
|
-
"import":
|
|
39
|
-
|
|
65
|
+
"import": {
|
|
66
|
+
"types": "./dist/matchers.d.ts",
|
|
67
|
+
"default": "./dist/matchers.js"
|
|
68
|
+
},
|
|
69
|
+
"require": {
|
|
70
|
+
"types": "./dist/matchers.d.cts",
|
|
71
|
+
"default": "./dist/matchers.cjs"
|
|
72
|
+
}
|
|
40
73
|
},
|
|
41
74
|
"./portable": {
|
|
42
|
-
"import":
|
|
43
|
-
|
|
75
|
+
"import": {
|
|
76
|
+
"types": "./dist/portable.d.ts",
|
|
77
|
+
"default": "./dist/portable.js"
|
|
78
|
+
},
|
|
79
|
+
"require": {
|
|
80
|
+
"types": "./dist/portable.d.cts",
|
|
81
|
+
"default": "./dist/portable.cjs"
|
|
82
|
+
}
|
|
44
83
|
}
|
|
45
84
|
},
|
|
46
85
|
"main": "dist/index.cjs",
|
|
47
86
|
"module": "dist/index.js",
|
|
48
|
-
"types": "dist/index.d.
|
|
87
|
+
"types": "dist/index.d.cts",
|
|
88
|
+
"typesVersions": {
|
|
89
|
+
"*": {
|
|
90
|
+
"manager": [
|
|
91
|
+
"./dist/manager.d.ts"
|
|
92
|
+
],
|
|
93
|
+
"preview": [
|
|
94
|
+
"./dist/preview.d.ts"
|
|
95
|
+
],
|
|
96
|
+
"vitest-plugin": [
|
|
97
|
+
"./dist/vitest-plugin.d.ts"
|
|
98
|
+
],
|
|
99
|
+
"vitest-setup": [
|
|
100
|
+
"./dist/vitest-setup.d.ts"
|
|
101
|
+
],
|
|
102
|
+
"matchers": [
|
|
103
|
+
"./dist/matchers.d.ts"
|
|
104
|
+
],
|
|
105
|
+
"portable": [
|
|
106
|
+
"./dist/portable.d.ts"
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
},
|
|
49
110
|
"files": [
|
|
50
111
|
"dist/**/*",
|
|
51
112
|
"README.md",
|
|
@@ -53,13 +114,14 @@
|
|
|
53
114
|
"*.d.ts"
|
|
54
115
|
],
|
|
55
116
|
"scripts": {
|
|
56
|
-
"build": "
|
|
57
|
-
"build:watch": "
|
|
58
|
-
"typecheck": "tsc --noEmit"
|
|
117
|
+
"build": "tsdown",
|
|
118
|
+
"build:watch": "tsdown --watch",
|
|
119
|
+
"typecheck": "tsc --noEmit",
|
|
120
|
+
"prepublishOnly": "bun run build"
|
|
59
121
|
},
|
|
60
122
|
"dependencies": {
|
|
61
|
-
"@accesslint/core": "
|
|
62
|
-
"@accesslint/vitest": "
|
|
123
|
+
"@accesslint/core": "0.9.0",
|
|
124
|
+
"@accesslint/vitest": "0.3.0"
|
|
63
125
|
},
|
|
64
126
|
"devDependencies": {
|
|
65
127
|
"@types/react": "^19.2.14",
|
|
@@ -67,7 +129,7 @@
|
|
|
67
129
|
"react": "^18.2.0",
|
|
68
130
|
"react-dom": "^18.2.0",
|
|
69
131
|
"storybook": "^10.2.0",
|
|
70
|
-
"
|
|
132
|
+
"tsdown": "^0.21.9",
|
|
71
133
|
"typescript": "^5.7.0",
|
|
72
134
|
"vitest": "^4.0.18"
|
|
73
135
|
},
|
package/dist/chunk-XTEGJNR3.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { configureRules, createChunkedAudit, getActiveRules, getRuleById } from '@accesslint/core';
|
|
2
|
-
import { addons } from 'storybook/preview-api';
|
|
3
|
-
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
// src/preview.ts
|
|
11
|
-
var preview_exports = {};
|
|
12
|
-
__export(preview_exports, {
|
|
13
|
-
afterEach: () => afterEach,
|
|
14
|
-
initialGlobals: () => initialGlobals,
|
|
15
|
-
parameters: () => parameters
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// src/constants.ts
|
|
19
|
-
var ADDON_ID = "accesslint/a11y";
|
|
20
|
-
var RESULT_EVENT = `${ADDON_ID}/result`;
|
|
21
|
-
|
|
22
|
-
// src/preview.ts
|
|
23
|
-
var initialGlobals = {
|
|
24
|
-
accesslint: {}
|
|
25
|
-
};
|
|
26
|
-
var parameters = {
|
|
27
|
-
accesslint: {}
|
|
28
|
-
};
|
|
29
|
-
configureRules({
|
|
30
|
-
disabledRules: ["accesslint-045"]
|
|
31
|
-
});
|
|
32
|
-
var BUDGET_MS = 12;
|
|
33
|
-
function yieldToMain() {
|
|
34
|
-
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
35
|
-
}
|
|
36
|
-
function scopeViolations(violations) {
|
|
37
|
-
const root = document.getElementById("storybook-root");
|
|
38
|
-
if (!root) return violations;
|
|
39
|
-
return violations.filter((v) => {
|
|
40
|
-
const local = v.selector.replace(/^.*>>>\s*iframe>\s*/, "");
|
|
41
|
-
try {
|
|
42
|
-
const el = document.querySelector(local);
|
|
43
|
-
return el && root.contains(el);
|
|
44
|
-
} catch {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function enrichViolations(violations) {
|
|
50
|
-
return violations.map((v) => {
|
|
51
|
-
const rule = getRuleById(v.ruleId);
|
|
52
|
-
return {
|
|
53
|
-
...v,
|
|
54
|
-
element: void 0,
|
|
55
|
-
// not serializable
|
|
56
|
-
description: rule?.description,
|
|
57
|
-
wcag: rule?.wcag,
|
|
58
|
-
level: rule?.level,
|
|
59
|
-
guidance: rule?.guidance
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
var afterEach = async ({
|
|
64
|
-
reporting,
|
|
65
|
-
parameters: parameters2,
|
|
66
|
-
viewMode,
|
|
67
|
-
tags,
|
|
68
|
-
id
|
|
69
|
-
}) => {
|
|
70
|
-
const accesslintParam = parameters2?.accesslint;
|
|
71
|
-
if (accesslintParam?.disable === true || accesslintParam?.test === "off") return;
|
|
72
|
-
if (viewMode !== "story") return;
|
|
73
|
-
const skipTags = typeof __ACCESSLINT_SKIP_TAGS__ !== "undefined" ? __ACCESSLINT_SKIP_TAGS__ : [];
|
|
74
|
-
const allSkipTags = ["skip-accesslint", ...skipTags];
|
|
75
|
-
const matchedTag = tags?.find((t) => allSkipTags.includes(t));
|
|
76
|
-
if (matchedTag) {
|
|
77
|
-
const result2 = { skipped: true, reason: matchedTag };
|
|
78
|
-
addons.getChannel().emit(RESULT_EVENT, { storyId: id, result: result2 });
|
|
79
|
-
reporting.addReport({
|
|
80
|
-
type: "accesslint",
|
|
81
|
-
version: 1,
|
|
82
|
-
result: result2,
|
|
83
|
-
status: "passed"
|
|
84
|
-
});
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const audit = createChunkedAudit(document);
|
|
88
|
-
while (audit.processChunk(BUDGET_MS)) {
|
|
89
|
-
await yieldToMain();
|
|
90
|
-
}
|
|
91
|
-
const violations = audit.getViolations();
|
|
92
|
-
const scoped = scopeViolations(violations);
|
|
93
|
-
const enriched = enrichViolations(scoped);
|
|
94
|
-
const hasViolations = enriched.length > 0;
|
|
95
|
-
const mode = accesslintParam?.test === "todo" ? "warning" : "failed";
|
|
96
|
-
const status = hasViolations ? mode : "passed";
|
|
97
|
-
const result = {
|
|
98
|
-
violations: enriched,
|
|
99
|
-
ruleCount: getActiveRules().length
|
|
100
|
-
};
|
|
101
|
-
addons.getChannel().emit(RESULT_EVENT, { storyId: id, result, status });
|
|
102
|
-
reporting.addReport({
|
|
103
|
-
type: "accesslint",
|
|
104
|
-
version: 1,
|
|
105
|
-
result,
|
|
106
|
-
status
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export { afterEach, initialGlobals, parameters, preview_exports };
|