@jskit-ai/jskit-catalog 0.2.120 → 0.2.121

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": "@jskit-ai/jskit-catalog",
3
- "version": "0.2.120",
3
+ "version": "0.2.121",
4
4
  "description": "Published metadata catalog for JSKIT package metadata.",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,27 +1,21 @@
1
1
  import { readdir, realpath } from "node:fs/promises";
2
- import { createRequire } from "node:module";
3
2
  import path from "node:path";
4
- import { fileURLToPath, pathToFileURL } from "node:url";
5
3
  import { toPosixPath } from "./files.mjs";
4
+ import { lintSkipped } from "./lint-ignores.mjs";
6
5
 
7
- // The files `jskit check`'s data part (data-access.mjs) reads: the app's own source, but what its ESLint config ignores
8
- // outside server source (SERVER_FILE), which no lint reads either; and the source of its installed @jskit-ai packages.
9
- // With them, each app file's ESLint config, which data/lint-config judges, and the paths it skipped, which it lists.
6
+ // The files `jskit check`'s data part (data-access.mjs) reads: the app's own source and Vue components, but what its
7
+ // ESLint config ignores outside server source (lint-ignores.mjs), which no lint reads either; and the source of its
8
+ // installed @jskit-ai packages. With them, each app source file's ESLint config, which data/lint-config judges, and the
9
+ // paths it skipped, which it lists.
10
10
 
11
- // The root of the app or of one of its packages, where a folder's name says what the whole tree is: a migrations/ or
12
- // test/ folder deeper in server code is server code (as in @jskit-ai/config-eslint's dataAccess.js).
13
- const ROOT = String.raw`(?:(?:packages|tooling)/[^/]+/)?`;
14
- // Server source, which the app's ESLint config may not ignore, as @jskit-ai/config-eslint's base.js and dataAccess.js
15
- // lint it: at a root (ROOT), its files (a root server.js) and its src/ (an app's whole src/, src/jobs/ and its server
16
- // code with it; a package's src/server and src/shared), server/, scripts/, bin/ and config/. Anything else the config
17
- // ignores, a vendored copy of old code or generated output, is not data-access code.
18
- const SERVER_FILE = new RegExp(`^${ROOT}(?:[^/]+$|(?:src|server|scripts|bin|config)/)`, "u");
19
11
  const FRAMEWORK_DIRECTORY = path.join("node_modules", "@jskit-ai");
20
12
  const SOURCE_FILE = /\.[cm]?js$/u;
21
13
  const VUE_FILE = /\.vue$/u;
14
+ const APP_FILE = /\.(?:[cm]?js|vue)$/u;
22
15
  const SKIPPED_FILE = /\.(?:test|spec|vitest)\.[cm]?js$/u;
23
- // Code that defines no table resource or system scope an app runs: dependencies, anywhere; and, at a root (ROOT), build
24
- // output, tests and fixtures, migrations and seeds, and the examples, templates and documentation JSKIT packages carry.
16
+ // Code that defines no table resource or system scope an app runs: dependencies, anywhere; and, at the root of the app or
17
+ // of one of its packages (PACKAGE_DIRECTORY), build output, tests and fixtures, migrations and seeds, and the examples,
18
+ // templates and documentation JSKIT packages carry.
25
19
  const SKIPPED_ROOT_DIRECTORIES = new Set([
26
20
  "dist", "build", "coverage", "test", "tests", "__tests__", "e2e", "fixtures", "test-results", "migrations", "seed",
27
21
  "seeds", "templates", "patterns", "examples", "docs", "site", "skills", "test-support", "src/test"
@@ -69,117 +63,28 @@ async function frameworkPackages(root) {
69
63
  return packages;
70
64
  }
71
65
 
72
- // A file directly in a directory, for asking ESLint about the directory: its API judges files, not directories.
73
- const DIRECTORY_PROBE = "jskit-directory-probe.js";
74
-
75
- // The app's ESLint, from the app or else beside this check, set to find each file's config as `eslint` does, with
76
- // its ESLint class; null when neither has one, or the app has no config: then the lint itself cannot run, which fails
77
- // on its own.
78
- async function appEslint(root) {
79
- for (const base of [path.join(root, "package.json"), fileURLToPath(import.meta.url)]) {
80
- let resolved;
81
- try {
82
- resolved = createRequire(base).resolve("eslint");
83
- } catch {
84
- continue;
85
- }
86
- const api = await import(pathToFileURL(resolved).href);
87
- const { ESLint } = api.ESLint ? api : api.default;
88
- const eslint = new ESLint({ cwd: root });
89
- return await eslint.findConfigFile(path.join(root, "package.json")) ? { eslint, ESLint } : null;
90
- }
91
- return null;
92
- }
93
-
94
- // For a config file, the config whose ignores keep `eslint .`, run at the app's root, out of its directory; undefined
95
- // when it enters it. ESLint enters a directory unless the config of the directory above ignores it, so a parent config
96
- // ignores a nested config's directory whole, and past it the nested config alone judges what it holds. The directory's
97
- // verdict is that of a file directly in it, asked of an ESLint bound to the config above alone.
98
- function configIgnoredBy(root, { eslint, ESLint }) {
99
- const verdicts = new Map();
100
- const bound = new Map();
101
- const boundTo = (configFile) => {
102
- if (!bound.has(configFile)) bound.set(configFile, new ESLint({ cwd: path.dirname(configFile), overrideConfigFile: configFile }));
103
- return bound.get(configFile);
104
- };
105
- async function verdict(configFile) {
106
- const directory = path.dirname(configFile);
107
- const inside = path.relative(root, directory);
108
- if (!inside || inside.startsWith("..") || path.isAbsolute(inside)) return undefined;
109
- // The config of the directory above, which ESLint asks before entering this one.
110
- const above = await eslint.findConfigFile(directory);
111
- if (!above) return undefined;
112
- return await ignoredBy(above) ??
113
- (await boundTo(above).isPathIgnored(path.join(directory, DIRECTORY_PROBE)) ? above : undefined);
114
- }
115
- function ignoredBy(configFile) {
116
- if (!verdicts.has(configFile)) verdicts.set(configFile, verdict(configFile));
117
- return verdicts.get(configFile);
118
- }
119
- return ignoredBy;
120
- }
121
-
122
- // The ESLint config of each app file that one governs, read as `eslint .` reads it: each { file, governed, config },
123
- // `governed` the file's path from that config's directory and `config` undefined when the config ignores the file, or
124
- // when a config above ignores the directory of the file's nested config (configIgnoredBy), as `eslint .` never reaches
125
- // it: `governed` is then told from the directory of the config that ignores it. And the first error reading one, after
126
- // which no more are read. None when the app has no ESLint config (appEslint).
127
- async function lintConfigs(root, files) {
128
- const configs = [];
129
- const app = await appEslint(root);
130
- const ignoredBy = app && configIgnoredBy(root, app);
131
- for (const file of app ? files : []) {
132
- const absolute = path.join(root, file);
133
- try {
134
- const configFile = await app.eslint.findConfigFile(absolute);
135
- if (!configFile) continue;
136
- const outer = await ignoredBy(configFile);
137
- const governed = toPosixPath(path.relative(path.dirname(outer ?? configFile), absolute));
138
- configs.push({ file, governed, config: outer ? undefined : await app.eslint.calculateConfigForFile(absolute) });
139
- } catch (error) {
140
- return { configs, error: { file, message: String(error?.message || error).split("\n")[0] } };
141
- }
142
- }
143
- return { configs };
144
- }
145
-
146
- // Code the app's ESLint config ignores that is not server source: no lint reads it, so neither does this check.
147
- const lintIgnores = ({ governed, config }) => !config && !SERVER_FILE.test(governed);
148
-
149
- // The fewest paths that name the app files skipped: for each, the highest directory holding no file that is read, written
150
- // with a trailing "/", or else the file itself.
151
- function skippedPaths(files, skipped) {
152
- const directories = (file) => file.split("/").slice(0, -1).map((_, index, parts) => parts.slice(0, index + 1).join("/"));
153
- const read = new Set(files.filter((file) => !skipped.has(file)).flatMap(directories));
154
- return [...new Set([...skipped].map((file) => {
155
- const directory = directories(file).find((name) => !read.has(name));
156
- return directory ? `${directory}/` : file;
157
- }))].sort();
158
- }
159
-
160
- // The app's source files but those its ESLint config ignores outside server source (lintIgnores), and those of its
161
- // installed @jskit-ai packages (framework: true), each { file, absolute, framework }; with each app file's ESLint config
162
- // (lintConfigs) and the paths of the files skipped (skippedPaths).
66
+ // The app's source files and Vue components but those its ESLint config ignores outside server source (lintSkipped),
67
+ // and the source files of its installed @jskit-ai packages (framework: true): `sources`, each { file, absolute,
68
+ // framework }, and `vue`, each { file, absolute }, which data/search-q reads for the list screens they show. With each
69
+ // app source file's ESLint config (`lint`, lintConfigs) and the paths of the files skipped (`skipped`, skippedPaths).
163
70
  async function sourceFiles(root) {
164
71
  const appFiles = [];
165
- await walk(root, "", appFiles);
72
+ await walk(root, "", appFiles, APP_FILE);
166
73
  const names = appFiles.map(toPosixPath);
167
- const lint = await lintConfigs(root, names);
168
- const skipped = new Set(lint.configs.filter(lintIgnores).map(({ file }) => file));
169
- const sources = names.filter((file) => !skipped.has(file)).map((file) => ({ file, absolute: path.join(root, file), framework: false }));
74
+ const { lint, skipped, paths } = await lintSkipped(root, names);
75
+ const read = names.filter((file) => !skipped.has(file)).map((file) => ({ file, absolute: path.join(root, file) }));
76
+ const sources = read.filter(({ file }) => SOURCE_FILE.test(file)).map((entry) => ({ ...entry, framework: false }));
170
77
  for (const { directory, real } of await frameworkPackages(root)) {
171
78
  const files = [];
172
79
  await walk(real, "", files);
173
80
  sources.push(...files.map((file) => ({ file: path.join(directory, file), absolute: path.join(real, file), framework: true })));
174
81
  }
175
- return { sources, lint, skipped: skippedPaths(names, skipped) };
176
- }
177
-
178
- // The app's own Vue components, which data/search-q reads for the list screens they show.
179
- async function vueFiles(root) {
180
- const files = [];
181
- await walk(root, "", files, VUE_FILE);
182
- return files.map((file) => ({ file: toPosixPath(file), absolute: path.join(root, file) }));
82
+ return {
83
+ sources,
84
+ vue: read.filter(({ file }) => VUE_FILE.test(file)),
85
+ lint: { ...lint, configs: lint.configs.filter(({ file }) => SOURCE_FILE.test(file)) },
86
+ skipped: paths
87
+ };
183
88
  }
184
89
 
185
- export { ROOT, lintIgnores, sourceFiles, vueFiles };
90
+ export { sourceFiles };
@@ -1,7 +1,8 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { ROOT, lintIgnores, sourceFiles, vueFiles } from "./data-access-files.mjs";
3
+ import { sourceFiles } from "./data-access-files.mjs";
4
4
  import { toPosixPath } from "./files.mjs";
5
+ import { ROOT, formatSkipped, lintIgnores } from "./lint-ignores.mjs";
5
6
  import {
6
7
  assignedVariable, blank, closingOffset, enclosingObject, identifierAt, keyValue, nextCodeOffset, objectArgument, objectAt,
7
8
  objectKeys, readSourceFile, readValue, topLevelKeys
@@ -545,7 +546,7 @@ async function readTableResourceSources({ projectRoot = process.cwd() } = {}) {
545
546
  */
546
547
  async function checkDataAccess({ projectRoot = process.cwd() } = {}) {
547
548
  const root = path.resolve(projectRoot);
548
- const { sources, lint, skipped } = await sourceFiles(root);
549
+ const { sources, vue, lint, skipped } = await sourceFiles(root);
549
550
  const resources = [];
550
551
  const contracts = [];
551
552
  const scopes = [];
@@ -574,7 +575,7 @@ async function checkDataAccess({ projectRoot = process.cwd() } = {}) {
574
575
  : disable.rules.length > 0 ? `eslint-disable turns off ${disable.rules.join(", ")}` : "eslint-disable names no rule");
575
576
  }
576
577
  }
577
- for (const { file, absolute } of await vueFiles(root)) {
578
+ for (const { file, absolute } of vue) {
578
579
  const source = await readFile(absolute, "utf8");
579
580
  if (source.includes("useCrudListScreen")) searches.push(readSearches(file, readSourceFile(vueScripts(source))));
580
581
  }
@@ -620,10 +621,7 @@ function formatDataAccessReport(result) {
620
621
  `name one in a contract's fields to offer it (data/unnamed-fields; ${GUIDE}#${SECTIONS["data/unnamed-fields"]}):`);
621
622
  for (const { file, line, name, fields } of result.unnamedFields) lines.push(` ${file}:${line} ${name}: ${fields.join(", ")}`);
622
623
  }
623
- if (result.skipped.length > 0) {
624
- lines.push(`Skipped, as the app's ESLint config ignores them and they hold no server code (${result.skipped.length}):`);
625
- for (const skipped of result.skipped) lines.push(` ${skipped}`);
626
- }
624
+ lines.push(...formatSkipped(result.skipped));
627
625
  const listed = `${result.systemScopes.length} system scope(s) and ${result.excuses.length} infrastructure exception(s) listed for review`;
628
626
  lines.push(result.ok
629
627
  ? `JSKIT data access: ${result.resources} table resource(s), each table and name defined once; ${listed}.`
@@ -0,0 +1,131 @@
1
+ import { createRequire } from "node:module";
2
+ import path from "node:path";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+ import { toPosixPath } from "./files.mjs";
5
+
6
+ // What the app's ESLint config ignores, read as `eslint .` reads it, for the parts of `jskit check` that read the app's
7
+ // own files: the data part (data-access-files.mjs) and the test-source part (test-sources.mjs). Each leaves out what the
8
+ // config ignores outside server source (lintIgnores), which no lint reads either, such as a vendored copy of old code
9
+ // kept beside the app, and lists the paths it left out (formatSkipped).
10
+
11
+ // The root of the app or of one of its packages, where a folder's name says what the whole tree is: a migrations/ or
12
+ // test/ folder deeper in server code is server code (as in @jskit-ai/config-eslint's dataAccess.js).
13
+ const ROOT = String.raw`(?:(?:packages|tooling)/[^/]+/)?`;
14
+ // Server source, which the app's ESLint config may not ignore, as @jskit-ai/config-eslint's base.js and dataAccess.js
15
+ // lint it: at a root (ROOT), its files (a root server.js) and its src/ (an app's whole src/, src/jobs/ and its server
16
+ // code with it; a package's src/server and src/shared), server/, scripts/, bin/ and config/. Anything else the config
17
+ // ignores, a vendored copy of old code or generated output, is not the app's code.
18
+ const SERVER_FILE = new RegExp(`^${ROOT}(?:[^/]+$|(?:src|server|scripts|bin|config)/)`, "u");
19
+
20
+ // A file directly in a directory, for asking ESLint about the directory: its API judges files, not directories.
21
+ const DIRECTORY_PROBE = "jskit-directory-probe.js";
22
+ // Every file with an extension, as one ESLint lints, so that ESLint gives no config only for a file its config ignores:
23
+ // without it, a file type the config has no config for, such as .ts, .vue or package.json, gets none either.
24
+ const EVERY_FILE = Object.freeze({ files: ["**/*.*"] });
25
+
26
+ // The app's ESLint, from the app or else beside this check, set to find each file's config as `eslint` does, with
27
+ // its ESLint class; null when neither has one, or the app has no config: then the lint itself cannot run, which fails
28
+ // on its own.
29
+ async function appEslint(root) {
30
+ for (const base of [path.join(root, "package.json"), fileURLToPath(import.meta.url)]) {
31
+ let resolved;
32
+ try {
33
+ resolved = createRequire(base).resolve("eslint");
34
+ } catch {
35
+ continue;
36
+ }
37
+ const api = await import(pathToFileURL(resolved).href);
38
+ const { ESLint } = api.ESLint ? api : api.default;
39
+ const eslint = new ESLint({ cwd: root, overrideConfig: EVERY_FILE });
40
+ return await eslint.findConfigFile(path.join(root, "package.json")) ? { eslint, ESLint } : null;
41
+ }
42
+ return null;
43
+ }
44
+
45
+ // For a config file, the config whose ignores keep `eslint .`, run at the app's root, out of its directory; undefined
46
+ // when it enters it. ESLint enters a directory unless the config of the directory above ignores it, so a parent config
47
+ // ignores a nested config's directory whole, and past it the nested config alone judges what it holds. The directory's
48
+ // verdict is that of a file directly in it, asked of an ESLint bound to the config above alone.
49
+ function configIgnoredBy(root, { eslint, ESLint }) {
50
+ const verdicts = new Map();
51
+ const bound = new Map();
52
+ const boundTo = (configFile) => {
53
+ if (!bound.has(configFile)) {
54
+ bound.set(configFile, new ESLint({ cwd: path.dirname(configFile), overrideConfigFile: configFile, overrideConfig: EVERY_FILE }));
55
+ }
56
+ return bound.get(configFile);
57
+ };
58
+ async function verdict(configFile) {
59
+ const directory = path.dirname(configFile);
60
+ const inside = path.relative(root, directory);
61
+ if (!inside || inside.startsWith("..") || path.isAbsolute(inside)) return undefined;
62
+ // The config of the directory above, which ESLint asks before entering this one.
63
+ const above = await eslint.findConfigFile(directory);
64
+ if (!above) return undefined;
65
+ return await ignoredBy(above) ??
66
+ (await boundTo(above).isPathIgnored(path.join(directory, DIRECTORY_PROBE)) ? above : undefined);
67
+ }
68
+ function ignoredBy(configFile) {
69
+ if (!verdicts.has(configFile)) verdicts.set(configFile, verdict(configFile));
70
+ return verdicts.get(configFile);
71
+ }
72
+ return ignoredBy;
73
+ }
74
+
75
+ // The ESLint config of each app file that one governs, read as `eslint .` reads it: each { file, governed, config },
76
+ // `governed` the file's path from that config's directory and `config` undefined when the config ignores the file, or
77
+ // when a config above ignores the directory of the file's nested config (configIgnoredBy), as `eslint .` never reaches
78
+ // it: `governed` is then told from the directory of the config that ignores it. And the first error reading one, after
79
+ // which no more are read. None when the app has no ESLint config (appEslint).
80
+ async function lintConfigs(root, files) {
81
+ const configs = [];
82
+ const app = await appEslint(root);
83
+ const ignoredBy = app && configIgnoredBy(root, app);
84
+ for (const file of app ? files : []) {
85
+ const absolute = path.join(root, file);
86
+ try {
87
+ const configFile = await app.eslint.findConfigFile(absolute);
88
+ if (!configFile) continue;
89
+ const outer = await ignoredBy(configFile);
90
+ const governed = toPosixPath(path.relative(path.dirname(outer ?? configFile), absolute));
91
+ configs.push({ file, governed, config: outer ? undefined : await app.eslint.calculateConfigForFile(absolute) });
92
+ } catch (error) {
93
+ return { configs, error: { file, message: String(error?.message || error).split("\n")[0] } };
94
+ }
95
+ }
96
+ return { configs };
97
+ }
98
+
99
+ // Code the app's ESLint config ignores that is not server source: no lint reads it, so neither does `jskit check`.
100
+ const lintIgnores = ({ governed, config }) => !config && !SERVER_FILE.test(governed);
101
+
102
+ // The fewest paths that name the app files skipped: for each, the highest directory holding no file that is read, written
103
+ // with a trailing "/", or else the file itself.
104
+ function skippedPaths(files, skipped) {
105
+ const directories = (file) => file.split("/").slice(0, -1).map((_, index, parts) => parts.slice(0, index + 1).join("/"));
106
+ const read = new Set(files.filter((file) => !skipped.has(file)).flatMap(directories));
107
+ return [...new Set([...skipped].map((file) => {
108
+ const directory = directories(file).find((name) => !read.has(name));
109
+ return directory ? `${directory}/` : file;
110
+ }))].sort();
111
+ }
112
+
113
+ /**
114
+ * Of the app files a part reads (relative to root, POSIX), those its ESLint config ignores outside server source
115
+ * (lintIgnores), with each file's config (lintConfigs) and the fewest paths naming the files skipped (skippedPaths).
116
+ * @param {string} root
117
+ * @param {string[]} files
118
+ */
119
+ async function lintSkipped(root, files) {
120
+ const lint = await lintConfigs(root, files);
121
+ const skipped = new Set(lint.configs.filter(lintIgnores).map(({ file }) => file));
122
+ return { lint, skipped, paths: skippedPaths(files, skipped) };
123
+ }
124
+
125
+ // The lines a part's report lists the paths it skipped with (lintSkipped), none when it skipped none.
126
+ const formatSkipped = (paths) => (paths.length < 1 ? [] : [
127
+ `Skipped, as the app's ESLint config ignores them and they hold no server code (${paths.length}):`,
128
+ ...paths.map((skipped) => ` ${skipped}`)
129
+ ]);
130
+
131
+ export { ROOT, formatSkipped, lintIgnores, lintSkipped };
@@ -1,6 +1,7 @@
1
1
  import { readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { fileExists } from "./files.mjs";
4
+ import { formatSkipped, lintSkipped } from "./lint-ignores.mjs";
4
5
  import { DEFAULT_PATTERN, findTestFiles } from "./test-command.mjs";
5
6
  import { excusedWait, scanSource } from "./test-sources-scan.mjs";
6
7
 
@@ -22,7 +23,8 @@ import { excusedWait, scanSource } from "./test-sources-scan.mjs";
22
23
  // for a reason.
23
24
  // - test/generated-into-src: the app's Vite config writes a generated file (`dts`) into src, which the browser tests'
24
25
  // frontend build reads, so a build is never kept for reuse.
25
- // No other comment excuses them.
26
+ // No other comment excuses them. Like the data part, it reads none of what the app's ESLint config ignores outside server
27
+ // source (lint-ignores.mjs), such as a vendored copy of old code kept beside the app, and lists what it skipped.
26
28
 
27
29
  const GUIDE = "https://mobily-enterprises.github.io/jskit-ai/guide/framework/typed-features#test-source-rules";
28
30
  const SKIPPED_DIRECTORIES = new Set(["node_modules", "dist", "coverage", "test-results", "playwright-report", "blob-report"]);
@@ -244,39 +246,53 @@ function checkViteConfig(file, contents, report) {
244
246
  }
245
247
  }
246
248
 
249
+ // What the rules read a file as: a CI workflow, a package manifest's scripts, the root Vite config, a runner config or a
250
+ // test file; null for a file they do not read.
251
+ function kindOf(file) {
252
+ const name = path.posix.basename(file);
253
+ if (WORKFLOW.test(file)) return "workflow";
254
+ if (name === "package.json") return "scripts";
255
+ if (VITE_CONFIG.test(file)) return "vite";
256
+ if (RUNNER_CONFIG.test(name)) return "runner";
257
+ return isTestFile(file) ? "test" : null;
258
+ }
259
+
247
260
  /**
248
261
  * @param {{ projectRoot: string }} input
249
- * @returns {Promise<{ ok: boolean, findings: Array<{ file: string, line: number, rule: string, message: string }>, files: number }>}
262
+ * @returns {Promise<{ ok: boolean, findings: Array<{ file: string, line: number, rule: string, message: string }>,
263
+ * files: number, skipped: string[] }>} `skipped` the paths left out as the app's ESLint config ignores them.
250
264
  */
251
265
  async function checkTestSources({ projectRoot }) {
252
266
  const root = path.resolve(projectRoot);
253
267
  const findings = [];
254
268
  const report = (finding) => findings.push(finding);
269
+ const candidates = [...await listFiles(root), ...await listWorkflows(root)].filter(kindOf);
270
+ const { skipped, paths } = await lintSkipped(root, candidates);
255
271
  let testFiles = 0;
256
- for (const file of [...await listFiles(root), ...await listWorkflows(root)]) {
257
- const name = path.posix.basename(file);
258
- const read = async () => readFile(path.join(root, file), "utf8");
259
- if (WORKFLOW.test(file)) {
260
- checkWorkflow(file, (await read()).split("\n"), report);
261
- } else if (name === "package.json") {
262
- checkScripts(root, file, await read(), report);
263
- } else if (VITE_CONFIG.test(file)) {
264
- checkViteConfig(file, await read(), report);
265
- } else if (RUNNER_CONFIG.test(name)) {
266
- checkDatabaseNames(file, (await read()).split("\n"), { configFile: true }, report);
267
- } else if (isTestFile(file)) {
272
+ for (const file of candidates.filter((candidate) => !skipped.has(candidate))) {
273
+ const text = await readFile(path.join(root, file), "utf8");
274
+ const kind = kindOf(file);
275
+ if (kind === "workflow") {
276
+ checkWorkflow(file, text.split("\n"), report);
277
+ } else if (kind === "scripts") {
278
+ checkScripts(root, file, text, report);
279
+ } else if (kind === "vite") {
280
+ checkViteConfig(file, text, report);
281
+ } else if (kind === "runner") {
282
+ checkDatabaseNames(file, text.split("\n"), { configFile: true }, report);
283
+ } else {
268
284
  testFiles += 1;
269
- const text = await read();
270
285
  checkFixedWaits(file, text, report);
271
286
  checkDatabaseNames(file, text.split("\n"), { configFile: false }, report);
272
287
  }
273
288
  }
274
289
  findings.sort((left, right) => left.file.localeCompare(right.file) || left.line - right.line);
275
- return { ok: findings.length < 1, findings, files: testFiles };
290
+ return { ok: findings.length < 1, findings, files: testFiles, skipped: paths };
276
291
  }
277
292
 
278
293
  function formatTestSourcesReport(result) {
279
294
  const lines = result.findings.flatMap(({ file, line, rule, message }) => [`${file}:${line} ${rule} ${message}`, ` ${GUIDE}`]);
295
+ lines.push(...formatSkipped(result.skipped));
280
296
  lines.push(result.ok
281
297
  ? "JSKIT test sources: no fixed waits, pinned test database names or generated files in src " +
282
298
  `(${result.files} test file(s) read).`