@ploaness/config 1.12.0 → 1.14.0
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/a11y.d.ts +13 -5
- package/dist/a11y.d.ts.map +1 -1
- package/dist/a11y.js +20 -11
- package/dist/a11y.js.map +1 -1
- package/dist/clock-preload.d.ts +2 -0
- package/dist/clock-preload.d.ts.map +1 -0
- package/dist/clock-preload.js +37 -0
- package/dist/clock-preload.js.map +1 -0
- package/dist/eslint-library.d.ts.map +1 -1
- package/dist/eslint-library.js +6 -1
- package/dist/eslint-library.js.map +1 -1
- package/dist/eslint-runtime.d.ts +11 -0
- package/dist/eslint-runtime.d.ts.map +1 -0
- package/dist/eslint-runtime.js +68 -0
- package/dist/eslint-runtime.js.map +1 -0
- package/dist/eslint.d.ts.map +1 -1
- package/dist/eslint.js +6 -1
- package/dist/eslint.js.map +1 -1
- package/dist/layout.d.ts +34 -16
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +228 -56
- package/dist/layout.js.map +1 -1
- package/dist/payload-view.d.ts +16 -0
- package/dist/payload-view.d.ts.map +1 -0
- package/dist/payload-view.js +35 -0
- package/dist/payload-view.js.map +1 -0
- package/dist/playwright.d.ts.map +1 -1
- package/dist/playwright.js +115 -12
- package/dist/playwright.js.map +1 -1
- package/dist/scanner.d.ts +99 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +278 -0
- package/dist/scanner.js.map +1 -0
- package/dist/settle.d.ts +8 -6
- package/dist/settle.d.ts.map +1 -1
- package/dist/settle.js +55 -42
- package/dist/settle.js.map +1 -1
- package/dist/sweep-disclosures.d.ts +10 -0
- package/dist/sweep-disclosures.d.ts.map +1 -0
- package/dist/sweep-disclosures.js +179 -0
- package/dist/sweep-disclosures.js.map +1 -0
- package/dist/sweep-discovery.d.ts +15 -0
- package/dist/sweep-discovery.d.ts.map +1 -0
- package/dist/sweep-discovery.js +336 -0
- package/dist/sweep-discovery.js.map +1 -0
- package/dist/sweep-interaction.d.ts +19 -0
- package/dist/sweep-interaction.d.ts.map +1 -0
- package/dist/sweep-interaction.js +351 -0
- package/dist/sweep-interaction.js.map +1 -0
- package/dist/sweep-queue.d.ts +24 -0
- package/dist/sweep-queue.d.ts.map +1 -0
- package/dist/sweep-queue.js +56 -0
- package/dist/sweep-queue.js.map +1 -0
- package/dist/sweep-reflow.d.ts +17 -0
- package/dist/sweep-reflow.d.ts.map +1 -0
- package/dist/sweep-reflow.js +210 -0
- package/dist/sweep-reflow.js.map +1 -0
- package/dist/sweep-resting.d.ts +25 -0
- package/dist/sweep-resting.d.ts.map +1 -0
- package/dist/sweep-resting.js +98 -0
- package/dist/sweep-resting.js.map +1 -0
- package/dist/sweep-shared.d.ts +353 -0
- package/dist/sweep-shared.d.ts.map +1 -0
- package/dist/sweep-shared.js +434 -0
- package/dist/sweep-shared.js.map +1 -0
- package/dist/sweep.d.ts +14 -0
- package/dist/sweep.d.ts.map +1 -0
- package/dist/sweep.js +157 -0
- package/dist/sweep.js.map +1 -0
- package/dist/vitest-core.d.ts +1 -1
- package/dist/vitest-core.js +1 -1
- package/dist/vitest-library.d.ts.map +1 -1
- package/dist/vitest-library.js +2 -1
- package/dist/vitest-library.js.map +1 -1
- package/package.json +10 -2
package/dist/a11y.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export type { HitTargetClassification, HitTargetProbe, HitTargetVerdict, } from '@ploaness/governance';
|
|
2
2
|
export { classifyHitTarget, findDefiniteIncomplete } from '@ploaness/governance';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { LAYOUT_SCAN_VIEWPORTS } from './layout.js';
|
|
4
|
+
export { expectNoLayoutDefects, layoutDefectsOf } from './scanner.js';
|
|
5
|
+
export { type SettleOutcome, settleForScan } from './settle.js';
|
|
5
6
|
import { AxeBuilder } from '@axe-core/playwright';
|
|
6
7
|
import { type Page } from '@playwright/test';
|
|
8
|
+
import { type DeclaredRoute } from '@ploaness/governance';
|
|
7
9
|
export declare const SKIPPED_ROUTE_PREFIXES: readonly string[];
|
|
8
10
|
/** Whether the configured sweep excludes this path. Shared with its completeness check. */
|
|
9
11
|
export declare const isSkippedSweepRoute: (route: string) => boolean;
|
|
@@ -23,14 +25,20 @@ export declare const scopedAxe: (page: Page) => Promise<AxeBuilder>;
|
|
|
23
25
|
*/
|
|
24
26
|
export declare const expectNoAxeDefects: (scan: AxeResults, label: string) => void;
|
|
25
27
|
/**
|
|
26
|
-
* Run
|
|
28
|
+
* Run the sweep's resting scan on a page: axe, and the layout, text and media rules at every viewport.
|
|
27
29
|
*
|
|
28
30
|
* The one call a project's own specification needs for a page the crawl cannot reach. The route
|
|
29
|
-
* coverage check reads it as evidence of both scans.
|
|
31
|
+
* coverage check reads it as evidence of both scans. The page is resized in place rather than reloaded,
|
|
32
|
+
* so the state the specification drove it into is what is judged.
|
|
30
33
|
* @param page the page, already on the route and in the state to judge.
|
|
31
|
-
* @returns nothing; it fails the test
|
|
34
|
+
* @returns nothing; it fails the test with one line per defect.
|
|
32
35
|
*/
|
|
33
36
|
export declare const expectSweptPage: (page: Page) => Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* The routes this project's file tree declares, for grouping crawled routes by template.
|
|
39
|
+
* @returns every declared route, or none when the member declares no application routes.
|
|
40
|
+
*/
|
|
41
|
+
export declare const declaredRoutes: () => readonly DeclaredRoute[];
|
|
34
42
|
/**
|
|
35
43
|
* The pages this project declares that the sweep did not cover, each with what to do about it.
|
|
36
44
|
*
|
package/dist/a11y.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.d.ts","sourceRoot":"","sources":["../src/a11y.ts"],"names":[],"mappings":"AAkBA,YAAY,EACV,uBAAuB,EACvB,cAAc,EACd,gBAAgB,GACjB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAChF,OAAO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,eAAO,MAAM,cAAc,QAAO,SAAS,aAAa,EAIvD,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GACxB,eAAe,SAAS,MAAM,EAAE,EAChC,gBAAgB,SAAS,MAAM,EAAE,KAChC,SAAS,MAAM,EAiBjB,CAAA"}
|
package/dist/a11y.js
CHANGED
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
// - an unlinked page, a page behind a sign-in, a custom admin view - and two definitions of a scan would
|
|
17
17
|
// drift. `expectSweptPage` runs both of the sweep's scans, so one call covers such a page.
|
|
18
18
|
export { classifyHitTarget, findDefiniteIncomplete } from '@ploaness/governance';
|
|
19
|
-
export {
|
|
19
|
+
export { LAYOUT_SCAN_VIEWPORTS } from './layout.js';
|
|
20
|
+
export { expectNoLayoutDefects, layoutDefectsOf } from './scanner.js';
|
|
20
21
|
export { settleForScan } from './settle.js';
|
|
21
22
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
22
23
|
import path from 'node:path';
|
|
23
24
|
import { AxeBuilder } from '@axe-core/playwright';
|
|
24
25
|
import { expect } from '@playwright/test';
|
|
25
|
-
import { appRootOf, declaredRoutesOf, findDefiniteIncomplete, findUnsweptRoutes, isSkippedRoute, } from '@ploaness/governance';
|
|
26
|
-
import { expectNoLayoutDefects } from './layout.js';
|
|
26
|
+
import { appRootOf, declaredRoutesOf, findDefiniteIncomplete, findingLine, findUnsweptRoutes, isSkippedRoute, } from '@ploaness/governance';
|
|
27
27
|
import { projectSettings } from './project-settings.js';
|
|
28
|
-
import {
|
|
28
|
+
import { locationOf, scanPageInPlace } from './scanner.js';
|
|
29
29
|
export const SKIPPED_ROUTE_PREFIXES = projectSettings.accessibilitySkipRoutes;
|
|
30
30
|
/** Whether the configured sweep excludes this path. Shared with its completeness check. */
|
|
31
31
|
export const isSkippedSweepRoute = (route) => isSkippedRoute(route, SKIPPED_ROUTE_PREFIXES, projectSettings.accessibilityCustomSkipRoutes);
|
|
@@ -50,18 +50,18 @@ export const expectNoAxeDefects = (scan, label) => {
|
|
|
50
50
|
expect(findDefiniteIncomplete(scan.incomplete), `${label} (undecidable-but-definite)`).toEqual([]);
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
|
-
* Run
|
|
53
|
+
* Run the sweep's resting scan on a page: axe, and the layout, text and media rules at every viewport.
|
|
54
54
|
*
|
|
55
55
|
* The one call a project's own specification needs for a page the crawl cannot reach. The route
|
|
56
|
-
* coverage check reads it as evidence of both scans.
|
|
56
|
+
* coverage check reads it as evidence of both scans. The page is resized in place rather than reloaded,
|
|
57
|
+
* so the state the specification drove it into is what is judged.
|
|
57
58
|
* @param page the page, already on the route and in the state to judge.
|
|
58
|
-
* @returns nothing; it fails the test
|
|
59
|
+
* @returns nothing; it fails the test with one line per defect.
|
|
59
60
|
*/
|
|
60
61
|
export const expectSweptPage = async (page) => {
|
|
61
|
-
await
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
await expectNoLayoutDefects(page);
|
|
62
|
+
const scanned = await scanPageInPlace(page, true);
|
|
63
|
+
const findings = scanned.map((finding) => findingLine(finding));
|
|
64
|
+
expect(findings, `defects on ${locationOf(page)}`).toEqual([]);
|
|
65
65
|
};
|
|
66
66
|
// What the sweep cannot work out from inside the browser: which pages this project declares.
|
|
67
67
|
//
|
|
@@ -103,6 +103,15 @@ const readSpecs = (root, paths) => paths
|
|
|
103
103
|
path: file,
|
|
104
104
|
source: readFileSync(path.join(root, file), 'utf8'),
|
|
105
105
|
}));
|
|
106
|
+
/**
|
|
107
|
+
* The routes this project's file tree declares, for grouping crawled routes by template.
|
|
108
|
+
* @returns every declared route, or none when the member declares no application routes.
|
|
109
|
+
*/
|
|
110
|
+
export const declaredRoutes = () => {
|
|
111
|
+
const paths = projectFiles(process.cwd());
|
|
112
|
+
const appRoot = appRootOf(paths);
|
|
113
|
+
return appRoot === undefined ? [] : declaredRoutesOf(paths, appRoot);
|
|
114
|
+
};
|
|
106
115
|
/**
|
|
107
116
|
* The pages this project declares that the sweep did not cover, each with what to do about it.
|
|
108
117
|
*
|
package/dist/a11y.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.js","sourceRoot":"","sources":["../src/a11y.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,gCAAgC;AAChC,EAAE;AACF,oGAAoG;AACpG,qGAAqG;AACrG,6FAA6F;AAC7F,aAAa;AACb,EAAE;AACF,sGAAsG;AACtG,mGAAmG;AACnG,2FAA2F;AAC3F,EAAE;AACF,wGAAwG;AACxG,oGAAoG;AACpG,wGAAwG;AACxG,yGAAyG;AACzG,2FAA2F;AAO3F,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"a11y.js","sourceRoot":"","sources":["../src/a11y.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,gCAAgC;AAChC,EAAE;AACF,oGAAoG;AACpG,qGAAqG;AACrG,6FAA6F;AAC7F,aAAa;AACb,EAAE;AACF,sGAAsG;AACtG,mGAAmG;AACnG,2FAA2F;AAC3F,EAAE;AACF,wGAAwG;AACxG,oGAAoG;AACpG,wGAAwG;AACxG,yGAAyG;AACzG,2FAA2F;AAO3F,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACrE,OAAO,EAAsB,aAAa,EAAE,MAAM,aAAa,CAAA;AAE/D,OAAO,EAAe,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OA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,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,aAAgC,EAChC,cAAiC,EACd,EAAE;IACrB,MAAM,IAAI,GAAW,OAAO,CAAC,GAAG,EAAE,CAAA;IAClC,MAAM,KAAK,GAAsB,YAAY,CAAC,IAAI,CAAC,CAAA;IACnD,MAAM,OAAO,GAAuB,SAAS,CAAC,KAAK,CAAC,CAAA;IACpD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,KAAK,GAA0B,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAC3D,OAAO,iBAAiB,CAAC;QACvB,cAAc,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC;QAChD,aAAa;QACb,cAAc;QACd,eAAe,EAAE,sBAAsB;QACvC,qBAAqB,EAAE,eAAe,CAAC,6BAA6B;QACpE,KAAK;QACL,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC,GAAG,CAAC,CAAC,OAAqB,EAAU,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;AAClG,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock-preload.d.ts","sourceRoot":"","sources":["../src/clock-preload.ts"],"names":[],"mappings":"AA0CA,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// The application's clock during verification: started at one fixed instant, then advancing normally.
|
|
2
|
+
//
|
|
3
|
+
// Loaded through `NODE_OPTIONS=--import`, so it reaches every process of the verification tree - the
|
|
4
|
+
// build, the seeding command, every application server and every worker they start - before any of
|
|
5
|
+
// their own code runs. A page prerendered by the build and the same page rendered by the server then
|
|
6
|
+
// read the same date on every machine and every day, while sessions, cookie expiry and revalidation keep
|
|
7
|
+
// working because time still passes.
|
|
8
|
+
//
|
|
9
|
+
// Self-contained on purpose. It is evaluated at the start of every process in the tree, and loading the
|
|
10
|
+
// governance package for one subtraction would cost each of them that package's whole import graph.
|
|
11
|
+
// The `it/` clock contracts hold the variable name to the one governance declares: the CLI sets that
|
|
12
|
+
// variable, and a mismatch leaves the fixture's pages at today's year.
|
|
13
|
+
/** The variable naming the instant, `CLOCK_ENVIRONMENT_VARIABLE` in `@ploaness/governance`. */
|
|
14
|
+
const CLOCK_VARIABLE = 'PLOANESS_CLOCK';
|
|
15
|
+
// Set once the clock is shifted. A process can reach this module twice - through `NODE_OPTIONS` and
|
|
16
|
+
// through the Playwright config, which loads it for the test workers `NODE_OPTIONS` does not reach -
|
|
17
|
+
// and the second load must not restart the clock at the instant.
|
|
18
|
+
const SHIFTED = Symbol.for('ploaness.clock.shifted');
|
|
19
|
+
const declared = process.env[CLOCK_VARIABLE];
|
|
20
|
+
const instant = declared === undefined ? Number.NaN : Date.parse(declared);
|
|
21
|
+
if (!(Number.isNaN(instant) || Object.hasOwn(globalThis, SHIFTED))) {
|
|
22
|
+
Object.defineProperty(globalThis, SHIFTED, { value: true });
|
|
23
|
+
const RealDate = Date;
|
|
24
|
+
const startedAt = RealDate.now();
|
|
25
|
+
const now = () => instant + (RealDate.now() - startedAt);
|
|
26
|
+
// A proxy rather than a subclass, so `Date()` called as a function still answers a string and
|
|
27
|
+
// `instanceof Date` still holds for every date created before or after the shift.
|
|
28
|
+
const shifted = new Proxy(RealDate, {
|
|
29
|
+
construct: (target, parameters, newTarget) => Reflect.construct(target, parameters.length === 0 ? [now()] : parameters, newTarget),
|
|
30
|
+
apply: () => new RealDate(now()).toString(),
|
|
31
|
+
get: (target, property, receiver) => property === 'now' ? now : Reflect.get(target, property, receiver),
|
|
32
|
+
});
|
|
33
|
+
// Redefined rather than assigned, keeping the global's own writable and non-enumerable attributes.
|
|
34
|
+
Object.defineProperty(globalThis, 'Date', { value: shifted });
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=clock-preload.js.map
|
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E,CACzG,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,SAAS,CAAW;QAChG,KAAK,EAAE,GAAW,EAAE,CAAC,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;QACnD,GAAG,EAAE,CAAC,MAAuB,EAAE,QAAyB,EAAE,QAAiB,EAAW,EAAE,CACtF,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC;KACrE,CAAC,CAAA;IACF,mGAAmG;IACnG,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AAC/D,CAAC;AAED,OAAO,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-library.d.ts","sourceRoot":"","sources":["../src/eslint-library.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"eslint-library.d.ts","sourceRoot":"","sources":["../src/eslint-library.ts"],"names":[],"mappings":"AAcA,OAAO,EAKL,OAAO,EAaR,MAAM,kBAAkB,CAAA;AAwBzB,QAAA,MAAM,MAAM,EAAE,UAAU,CAAC,OAAO,OAAO,CAmDtC,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/dist/eslint-library.js
CHANGED
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
// the centralised environment module. Those are not relaxations a library is being granted; they are
|
|
6
6
|
// carve-outs for files it does not contain, and applying them would have it judged against a layout it
|
|
7
7
|
// never claimed. Every cap, ban and suppression rule in `eslint-core.ts` still applies in full.
|
|
8
|
-
import { JAVASCRIPT_EXTENSIONS, REEXPORT_CONFIG_FILES, TYPESCRIPT_SOURCE_EXTENSIONS } from '@ploaness/governance';
|
|
8
|
+
import { CLOUDFRONT_RUNTIME, JAVASCRIPT_EXTENSIONS, REEXPORT_CONFIG_FILES, rolesFor, TYPESCRIPT_SOURCE_EXTENSIONS, } from '@ploaness/governance';
|
|
9
9
|
import { allowlistedJavaScript, baseLayers, commonJavaScriptBlock, commonTypeScriptBlock, compose, guidelineRules, immutabilityBlock, javascriptBlock, prettierLast, processConfigBlock, specEnvironmentBlock, testIdiomRules, testIntegrityRules, testSuiteSyntaxRules, typeAwareParsing, vitestPlugin, } from './eslint-core.js';
|
|
10
|
+
import { cloudFrontBlock } from './eslint-runtime.js';
|
|
10
11
|
import { projectDirectory, projectSettings as settings } from './project-settings.js';
|
|
12
|
+
// The allowlisted files whose entry declares the CloudFront runtime.
|
|
13
|
+
const isCloudFrontFile = allowlistedJavaScript(rolesFor(settings.javascriptRuntimes, CLOUDFRONT_RUNTIME), projectDirectory);
|
|
11
14
|
const IGNORED = ['dist/**', 'node_modules/**', 'coverage/**', '.next/**'];
|
|
12
15
|
// `unicorn/prefer-export-from` rewrites `import x from 'y'` + `export default x` into
|
|
13
16
|
// `export { default } from 'y'` - and it AUTOFIXES, so `ploaness format` turned a correctly wired
|
|
@@ -34,6 +37,8 @@ specEnvironmentBlock(),
|
|
|
34
37
|
// The JavaScript a library may carry is what its allowlist admits, its own flat ESLint config among
|
|
35
38
|
// the defaults, so the file the conventions gate lets be JavaScript is linted as JavaScript here.
|
|
36
39
|
javascriptBlock([allowlistedJavaScript(settings.javascriptAllowlist, projectDirectory)]),
|
|
40
|
+
// A file whose entry declares the CloudFront runtime is also held to what that engine supports.
|
|
41
|
+
cloudFrontBlock([isCloudFrontFile]),
|
|
37
42
|
// A library's specs are held to the same integrity rules as an application's: the suite is a gate, so
|
|
38
43
|
// a test that cannot fail is a gate that cannot fail.
|
|
39
44
|
//
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-library.js","sourceRoot":"","sources":["../src/eslint-library.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,mGAAmG;AACnG,sGAAsG;AACtG,qGAAqG;AACrG,uGAAuG;AACvG,gGAAgG;AAChG,OAAO,
|
|
1
|
+
{"version":3,"file":"eslint-library.js","sourceRoot":"","sources":["../src/eslint-library.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,mGAAmG;AACnG,sGAAsG;AACtG,qGAAqG;AACrG,uGAAuG;AACvG,gGAAgG;AAChG,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,EACR,4BAA4B,GAC7B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,OAAO,EAEP,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,GACb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,eAAe,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAErF,qEAAqE;AACrE,MAAM,gBAAgB,GAAkC,qBAAqB,CAC3E,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,EACzD,gBAAgB,CACjB,CAAA;AAED,MAAM,OAAO,GAAsB,CAAC,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,CAAC,CAAA;AAE5F,sFAAsF;AACtF,kGAAkG;AAClG,oGAAoG;AACpG,0EAA0E;AAC1E,EAAE;AACF,oGAAoG;AACpG,sEAAsE;AACtE,MAAM,mBAAmB,GAAoB;IAC3C,KAAK,EAAE,CAAC,GAAG,qBAAqB,CAAC;IACjC,KAAK,EAAE,EAAE,4BAA4B,EAAE,KAAK,EAAE;CA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gB,CAAC,EACrE,qBAAqB,EAAE,EACvB,YAAY,CACb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FileMatcher, type FlatConfigBlock } from './eslint-core.js';
|
|
2
|
+
/**
|
|
3
|
+
* The restrictions of the `cloudfront-js-2.0` runtime, for the files whose allowlist entry declares it.
|
|
4
|
+
*
|
|
5
|
+
* Placed after the general JavaScript block. It restates the shared `no-restricted-syntax` entries, because
|
|
6
|
+
* a block that sets that rule replaces the setting rather than adding to it.
|
|
7
|
+
* @param files the matchers for files declared to run in CloudFront.
|
|
8
|
+
* @returns a flat-config block.
|
|
9
|
+
*/
|
|
10
|
+
export declare const cloudFrontBlock: (files: readonly FileMatcher[]) => FlatConfigBlock;
|
|
11
|
+
//# sourceMappingURL=eslint-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-runtime.d.ts","sourceRoot":"","sources":["../src/eslint-runtime.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAkB,MAAM,kBAAkB,CAAA;AAmDzF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,WAAW,EAAE,KAAG,eAS9D,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// What an allowlisted file may use when the engine its entry declares is not Node.js.
|
|
2
|
+
//
|
|
3
|
+
// A CloudFront Function runs in AWS's `cloudfront-js-2.0` engine: ES 5.1 plus the later features AWS
|
|
4
|
+
// lists in "JavaScript runtime 2.0 features for CloudFront Functions". Node.js parses everything that
|
|
5
|
+
// engine rejects, so a file declared for it is linted against that list as well, in this block and for
|
|
6
|
+
// that file only. Arrow functions, `const`, template literals, rest parameters, `Object.keys`,
|
|
7
|
+
// `Object.entries`, `Object.assign` and `Array.prototype.includes` are on the list and stay legal.
|
|
8
|
+
//
|
|
9
|
+
// Each restriction below is something the list leaves out and that is known to fail there. A
|
|
10
|
+
// destructured parameter makes the engine reject the whole function with a misleading
|
|
11
|
+
// `Unexpected token "=>"`, and the function then fails every request it serves. Passing these rules lowers
|
|
12
|
+
// that risk without proving the file runs. Only executing it in CloudFront proves that.
|
|
13
|
+
import { CLOUDFRONT_RUNTIME } from '@ploaness/governance';
|
|
14
|
+
import { NO_INHERITANCE } from './eslint-core.js';
|
|
15
|
+
import { SECURITY_RESTRICTIONS } from './eslint-security.js';
|
|
16
|
+
const unsupported = (construct, instead) => `${construct} is not supported by runtime ${CLOUDFRONT_RUNTIME}; ${instead}`;
|
|
17
|
+
const DESTRUCTURING = unsupported('destructuring', 'read each property or index by name, for example parts[0] and parts.slice(1)');
|
|
18
|
+
// AST node types rather than text, so a string or a comment never matches. A pattern is a binding or an
|
|
19
|
+
// assignment target, never a literal. A rest parameter is a `RestElement` directly under a function,
|
|
20
|
+
// which neither pattern selector reaches, while `[tag, ...rest]` is an `ArrayPattern` and is reported.
|
|
21
|
+
// Spread is reported only inside an object literal: AWS lists rest parameters, and array and call spread
|
|
22
|
+
// are not restricted here.
|
|
23
|
+
const CLOUDFRONT_SYNTAX = [
|
|
24
|
+
{ selector: 'ObjectPattern', message: DESTRUCTURING },
|
|
25
|
+
{ selector: 'ArrayPattern', message: DESTRUCTURING },
|
|
26
|
+
{
|
|
27
|
+
selector: 'ObjectExpression > SpreadElement',
|
|
28
|
+
message: unsupported('object spread', 'copy with Object.assign({}, source, { key: value })'),
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
const restrictedGlobal = (name, instead) => ({
|
|
32
|
+
name,
|
|
33
|
+
message: unsupported(name, instead),
|
|
34
|
+
});
|
|
35
|
+
// Matched through scope analysis, so a local binding with one of these names is not a use of the global.
|
|
36
|
+
// The collections and reflection objects are absent from AWS's list. The process and the timers are
|
|
37
|
+
// on its list of restricted features, because a function must run synchronously to completion.
|
|
38
|
+
const CLOUDFRONT_GLOBALS = [
|
|
39
|
+
restrictedGlobal('Set', 'use an array and includes'),
|
|
40
|
+
restrictedGlobal('Map', 'use a plain object and Object.keys'),
|
|
41
|
+
restrictedGlobal('WeakSet', 'use an array and includes'),
|
|
42
|
+
restrictedGlobal('WeakMap', 'use a plain object'),
|
|
43
|
+
restrictedGlobal('Proxy', 'read the object directly'),
|
|
44
|
+
restrictedGlobal('Reflect', 'use the Object methods the runtime lists'),
|
|
45
|
+
restrictedGlobal('process', 'the runtime has no process; read configuration from the event or a key value store'),
|
|
46
|
+
restrictedGlobal('setTimeout', 'a function must run synchronously to completion'),
|
|
47
|
+
restrictedGlobal('setImmediate', 'a function must run synchronously to completion'),
|
|
48
|
+
restrictedGlobal('clearTimeout', 'a function must run synchronously to completion'),
|
|
49
|
+
];
|
|
50
|
+
/**
|
|
51
|
+
* The restrictions of the `cloudfront-js-2.0` runtime, for the files whose allowlist entry declares it.
|
|
52
|
+
*
|
|
53
|
+
* Placed after the general JavaScript block. It restates the shared `no-restricted-syntax` entries, because
|
|
54
|
+
* a block that sets that rule replaces the setting rather than adding to it.
|
|
55
|
+
* @param files the matchers for files declared to run in CloudFront.
|
|
56
|
+
* @returns a flat-config block.
|
|
57
|
+
*/
|
|
58
|
+
export const cloudFrontBlock = (files) => ({
|
|
59
|
+
files,
|
|
60
|
+
rules: {
|
|
61
|
+
'no-restricted-syntax': [...NO_INHERITANCE, ...SECURITY_RESTRICTIONS, ...CLOUDFRONT_SYNTAX],
|
|
62
|
+
'no-restricted-globals': ['error', ...CLOUDFRONT_GLOBALS],
|
|
63
|
+
// It demands the `Set` this runtime lacks for every array only searched with `includes`, which is
|
|
64
|
+
// the replacement named above, so no file could satisfy both.
|
|
65
|
+
'unicorn/prefer-set-has': 'off',
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=eslint-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-runtime.js","sourceRoot":"","sources":["../src/eslint-runtime.ts"],"names":[],"mappings":"AAAA,sF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CAAC,SAAS,EAAE,oBAAoB,CAAC;IACjD,gBAAgB,CAAC,OAAO,EAAE,0BAA0B,CAAC;IACrD,gBAAgB,CAAC,SAAS,EAAE,0CAA0C,CAAC;IACvE,gBAAgB,CAAC,SAAS,EAAE,oFAAoF,CAAC;IACjH,gBAAgB,CAAC,YAAY,EAAE,iDAAiD,CAAC;IACjF,gBAAgB,CAAC,cAAc,EAAE,iDAAiD,CAAC;IACnF,gBAAgB,CAAC,cAAc,EAAE,iDAAiD,CAAC;CACpF,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA6B,EAAmB,EAAE,CAAC,CAAC;IAClF,KAAK;IACL,KAAK,EAAE;QACL,sBAAsB,EAAE,CAAC,GAAG,cAAc,EAAE,GAAG,qBAAqB,EAAE,GAAG,iBAAiB,CAAC;QAC3F,uBAAuB,EAAE,CAAC,OAAO,EAAE,GAAG,kBAAkB,CAAC;QACzD,kGAAkG;QAClG,8DAA8D;QAC9D,wBAAwB,EAAE,KAAK;KAChC;CACF,CAAC,CAAA"}
|
package/dist/eslint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../src/eslint.ts"],"names":[],"mappings":"AAuBA,OAAO,EAKL,OAAO,EAkBR,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../src/eslint.ts"],"names":[],"mappings":"AAuBA,OAAO,EAKL,OAAO,EAkBR,MAAM,kBAAkB,CAAA;AAczB,yGAAyG;AACzG,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAIlD,CAAA;AAoBD,QAAA,MAAM,MAAM,EAAE,UAAU,CAAC,OAAO,OAAO,CAmVtC,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/dist/eslint.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JAVASCRIPT_EXTENSIONS, TYPESCRIPT_SOURCE_EXTENSIONS } from '@ploaness/governance';
|
|
1
|
+
import { CLOUDFRONT_RUNTIME, JAVASCRIPT_EXTENSIONS, rolesFor, TYPESCRIPT_SOURCE_EXTENSIONS } from '@ploaness/governance';
|
|
2
2
|
// @ts-check
|
|
3
3
|
//
|
|
4
4
|
// Type-aware ESLint flat config - the second enforcement layer, alongside Biome.
|
|
@@ -21,8 +21,11 @@ import { APPLICATION_JSX_IGNORES, ENVIRONMENT_READ_EXEMPTIONS, REEXPORT_CONFIG_F
|
|
|
21
21
|
import playwright from 'eslint-plugin-playwright';
|
|
22
22
|
import testingLibrary from 'eslint-plugin-testing-library';
|
|
23
23
|
import { allowlistedJavaScript, baseLayers, commonJavaScriptBlock, commonTypeScriptBlock, compose, guidelineRules, hookContextBlock, immutabilityBlock, javascriptBlock, NO_INHERITANCE, NO_MOCK_PROPERTIES, NO_NETWORK_GUARD_ESCAPE, prettierLast, processConfigBlock, specEnvironmentBlock, testIdiomRules, testIntegrityRules, testSuiteSyntaxRules, typeAwareParsing, vitestPlugin, withoutWarnings, } from './eslint-core.js';
|
|
24
|
+
import { cloudFrontBlock } from './eslint-runtime.js';
|
|
24
25
|
import { SECURITY_RESTRICTIONS } from './eslint-security.js';
|
|
25
26
|
import { projectDirectory, projectSettings as settings } from './project-settings.js';
|
|
27
|
+
// The allowlisted files whose entry declares the CloudFront runtime.
|
|
28
|
+
const isCloudFrontFile = allowlistedJavaScript(rolesFor(settings.javascriptRuntimes, CLOUDFRONT_RUNTIME), projectDirectory);
|
|
26
29
|
// Where a Payload project writes its hooks, and therefore the one place `req.context` is written.
|
|
27
30
|
const PAYLOAD_HOOK_FILES = ['src/hooks/**'];
|
|
28
31
|
/** The assertion helpers `ploaness/a11y` ships, each of which fails the test it runs in on a finding. */
|
|
@@ -92,6 +95,8 @@ specEnvironmentBlock(),
|
|
|
92
95
|
// The JavaScript the allowlist admits is linted as JavaScript, because the type-aware parser knows only
|
|
93
96
|
// the TypeScript project. The allowlisted configs ignored above stay ignored.
|
|
94
97
|
javascriptBlock([allowlistedJavaScript(settings.javascriptAllowlist, projectDirectory)]),
|
|
98
|
+
// A file whose entry declares the CloudFront runtime is also held to what that engine supports.
|
|
99
|
+
cloudFrontBlock([isCloudFrontFile]),
|
|
95
100
|
// The hook directories, where Payload's per-request state is written. `src/hooks` is the layer the
|
|
96
101
|
// project layout names for hooks; a hook written into `src/lib` is the pure floor claiming to be pure
|
|
97
102
|
// and is held to the full rule.
|
package/dist/eslint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../src/eslint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../src/eslint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;AACxH,YAAY;AACZ,EAAE;AACF,iFAAiF;AACjF,EAAE;AACF,+FAA+F;AAC/F,gGAAgG;AAChG,mGAAmG;AACnG,0FAA0F;AAC1F,4FAA4F;AAC5F,EAAE;AACF,oGAAoG;AACpG,4DAA4D;AAE5D,OAAO,UAAU,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAClH,EAAE;AACF,iGAAiG;AACjG,wGAAwG;AACxG,kGAAkG;AAClG,4FAA4F;AAC5F,OAAO,UAAU,MAAM,0BAA0B,CAAA;AACjD,OAAO,cAAc,MAAM,+BAA+B,CAAA;AAC1D,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,OAAO,EAEP,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EAC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2
|
-
import { type LayoutViewport } from '@ploaness/governance';
|
|
1
|
+
import type { Page } from '@playwright/test';
|
|
2
|
+
import { type LayoutSnapshot, type LayoutViewport } from '@ploaness/governance';
|
|
3
3
|
/** The viewports every layout scan runs at, the harness's own first. */
|
|
4
4
|
export declare const LAYOUT_SCAN_VIEWPORTS: readonly LayoutViewport[];
|
|
5
|
+
/** An exemption on an element a finding names, or on one of its ancestors. */
|
|
6
|
+
export interface TargetExemption {
|
|
7
|
+
readonly key: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
/** The raw attribute value: the rule names. */
|
|
10
|
+
readonly rules: string;
|
|
11
|
+
readonly reason: string;
|
|
12
|
+
}
|
|
13
|
+
/** One element a finding names, as the page describes it. */
|
|
14
|
+
export interface TargetFacts {
|
|
15
|
+
readonly label: string;
|
|
16
|
+
readonly key: string;
|
|
17
|
+
/** Every exemption on it or an ancestor, nearest first. */
|
|
18
|
+
readonly exemptions: readonly TargetExemption[];
|
|
19
|
+
}
|
|
5
20
|
/**
|
|
6
|
-
* Measure the page as it stands at
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
11
|
-
* @returns one line per layout defect, empty when there is none.
|
|
21
|
+
* Measure the page as it stands, at its current viewport.
|
|
22
|
+
* @param page the page, settled on the route and in the state to measure.
|
|
23
|
+
* @param route the location to record the snapshot under.
|
|
24
|
+
* @param isMinimal whether to measure geometry alone, without media and fonts.
|
|
25
|
+
* @returns the snapshot.
|
|
12
26
|
*/
|
|
13
|
-
export declare const
|
|
27
|
+
export declare const measurePage: (page: Page, route: string, isMinimal?: boolean) => Promise<LayoutSnapshot>;
|
|
14
28
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* or one whose address exists only once a record does - after driving the page into the state to judge.
|
|
19
|
-
* @param page the page to measure.
|
|
20
|
-
* @returns nothing; it fails the test with one line per defect.
|
|
29
|
+
* Outline the measured elements a failure names, for the screenshot that shows them.
|
|
30
|
+
* @param page the page, unchanged since it was measured.
|
|
31
|
+
* @param indices the measured-node indices.
|
|
21
32
|
*/
|
|
22
|
-
export declare const
|
|
33
|
+
export declare const outlineElements: (page: Page, indices: readonly number[]) => Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Describe one element for a finding: the focused element, or the first matching a selector.
|
|
36
|
+
* @param page the page.
|
|
37
|
+
* @param selector the element to describe, or null for the focused element.
|
|
38
|
+
* @returns its label, key and exemptions, or undefined when there is no such element.
|
|
39
|
+
*/
|
|
40
|
+
export declare const targetFacts: (page: Page, selector: string | null) => Promise<TargetFacts | undefined>;
|
|
23
41
|
//# sourceMappingURL=layout.d.ts.map
|
package/dist/layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAYA,OAAO,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,cAAc,EAGpB,MAAM,sBAAsB,CAAA;AAG7B,wEAAwE;AACxE,eAAO,MAAM,qBAAqB,EAAE,SAAS,cAAc,EAAyD,CAAA;AAwHpH,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,6DAA6D;AAC7D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,CAAA;CAChD;AAuZD;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAU,MAAM,IAAI,EAAE,OAAO,MAAM,EAAE,YAAW,OAAe,KAAG,OAAO,CAAC,cAAc,CAG/G,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAU,MAAM,IAAI,EAAE,SAAS,SAAS,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAG1F,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAU,MAAM,IAAI,EAAE,UAAU,MAAM,GAAG,IAAI,KAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAGpG,CAAA"}
|