@shivaedev/quality 0.53.1 → 0.55.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/CHANGELOG.md +47 -0
- package/README.md +14 -9
- package/dist/adapters/compileCache.config.d.ts +2 -0
- package/dist/adapters/compileCache.config.d.ts.map +1 -0
- package/dist/adapters/compileCache.config.js +3 -0
- package/dist/adapters/compileCache.config.js.map +1 -0
- package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
- package/dist/adapters/knip/entryPointFindings.js +14 -8
- package/dist/adapters/knip/entryPointFindings.js.map +1 -1
- package/dist/adapters/manifestInventory.d.ts.map +1 -1
- package/dist/adapters/manifestInventory.js +3 -1
- package/dist/adapters/manifestInventory.js.map +1 -1
- package/dist/adapters/manifestReader.d.ts +2 -2
- package/dist/adapters/manifestReader.d.ts.map +1 -1
- package/dist/adapters/manifestReader.js +2 -1
- package/dist/adapters/manifestReader.js.map +1 -1
- package/dist/adapters/testProjects.d.ts.map +1 -1
- package/dist/adapters/testProjects.js +1 -0
- package/dist/adapters/testProjects.js.map +1 -1
- package/dist/biome/recognizeDiagnostics.d.ts.map +1 -1
- package/dist/biome/recognizeDiagnostics.js +4 -5
- package/dist/biome/recognizeDiagnostics.js.map +1 -1
- package/dist/biome/report.d.ts +2 -1
- package/dist/biome/report.d.ts.map +1 -1
- package/dist/biome/report.js +11 -5
- package/dist/biome/report.js.map +1 -1
- package/dist/cli/changedRanges.d.ts +2 -0
- package/dist/cli/changedRanges.d.ts.map +1 -0
- package/dist/cli/changedRanges.js +23 -0
- package/dist/cli/changedRanges.js.map +1 -0
- package/dist/cli/fix.d.ts.map +1 -1
- package/dist/cli/fix.js +12 -12
- package/dist/cli/fix.js.map +1 -1
- package/dist/cli/lint.d.ts.map +1 -1
- package/dist/cli/lint.js +3 -1
- package/dist/cli/lint.js.map +1 -1
- package/dist/config.d.ts +5 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/engine/runRules.d.ts.map +1 -1
- package/dist/engine/runRules.js +29 -6
- package/dist/engine/runRules.js.map +1 -1
- package/dist/engine/session.d.ts +3 -2
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +9 -6
- package/dist/engine/session.js.map +1 -1
- package/dist/exceptions/biomeFindings.d.ts +3 -0
- package/dist/exceptions/biomeFindings.d.ts.map +1 -1
- package/dist/exceptions/biomeFindings.js +21 -0
- package/dist/exceptions/biomeFindings.js.map +1 -1
- package/dist/hooks/preCommit.js +1 -1
- package/dist/hooks/preCommit.js.map +1 -1
- package/dist/imports/adminBindings.d.ts +8 -0
- package/dist/imports/adminBindings.d.ts.map +1 -0
- package/dist/imports/adminBindings.js +36 -0
- package/dist/imports/adminBindings.js.map +1 -0
- package/dist/imports/adminEvidence.d.ts +6 -0
- package/dist/imports/adminEvidence.d.ts.map +1 -0
- package/dist/imports/adminEvidence.js +46 -0
- package/dist/imports/adminEvidence.js.map +1 -0
- package/dist/imports/adminFindings.d.ts +4 -0
- package/dist/imports/adminFindings.d.ts.map +1 -0
- package/dist/imports/adminFindings.js +55 -0
- package/dist/imports/adminFindings.js.map +1 -0
- package/dist/imports/extract.d.ts +2 -1
- package/dist/imports/extract.d.ts.map +1 -1
- package/dist/imports/extract.js +11 -10
- package/dist/imports/extract.js.map +1 -1
- package/dist/imports/graph.d.ts +2 -1
- package/dist/imports/graph.d.ts.map +1 -1
- package/dist/imports/graph.js +4 -2
- package/dist/imports/graph.js.map +1 -1
- package/dist/imports/nodePlatformBarrels.d.ts +3 -0
- package/dist/imports/nodePlatformBarrels.d.ts.map +1 -0
- package/dist/imports/nodePlatformBarrels.js +46 -0
- package/dist/imports/nodePlatformBarrels.js.map +1 -0
- package/dist/imports/projects.d.ts +4 -1
- package/dist/imports/projects.d.ts.map +1 -1
- package/dist/imports/projects.js +42 -17
- package/dist/imports/projects.js.map +1 -1
- package/dist/imports/resolve.d.ts.map +1 -1
- package/dist/imports/resolve.js +5 -3
- package/dist/imports/resolve.js.map +1 -1
- package/dist/manifests/sorted.d.ts.map +1 -1
- package/dist/manifests/sorted.js +1 -1
- package/dist/manifests/sorted.js.map +1 -1
- package/dist/naming/ownExports.d.ts +1 -0
- package/dist/naming/ownExports.d.ts.map +1 -1
- package/dist/naming/ownExports.js +4 -1
- package/dist/naming/ownExports.js.map +1 -1
- package/dist/rules/builtIn.d.ts +2 -2
- package/dist/rules/builtIn.d.ts.map +1 -1
- package/dist/rules/builtIn.js +4 -0
- package/dist/rules/builtIn.js.map +1 -1
- package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
- package/dist/rules/files/namedAfterExport.js +6 -2
- package/dist/rules/files/namedAfterExport.js.map +1 -1
- package/dist/rules/imports/adminPaths.d.ts +2 -0
- package/dist/rules/imports/adminPaths.d.ts.map +1 -0
- package/dist/rules/imports/adminPaths.js +11 -0
- package/dist/rules/imports/adminPaths.js.map +1 -0
- package/dist/rules/imports/resolvable.d.ts.map +1 -1
- package/dist/rules/imports/resolvable.js +9 -6
- package/dist/rules/imports/resolvable.js.map +1 -1
- package/dist/rules/imports/runtime.d.ts.map +1 -1
- package/dist/rules/imports/runtime.js +3 -2
- package/dist/rules/imports/runtime.js.map +1 -1
- package/dist/rules/stories/collectionOrigins.d.ts +1 -1
- package/dist/rules/stories/collectionOrigins.d.ts.map +1 -1
- package/dist/rules/stories/collectionOrigins.js.map +1 -1
- package/dist/rules/stories/globalRetries.d.ts +2 -0
- package/dist/rules/stories/globalRetries.d.ts.map +1 -0
- package/dist/rules/stories/globalRetries.js +45 -0
- package/dist/rules/stories/globalRetries.js.map +1 -0
- package/dist/rules/stories/httpStatus.d.ts.map +1 -1
- package/dist/rules/stories/httpStatus.js +11 -2
- package/dist/rules/stories/httpStatus.js.map +1 -1
- package/dist/rules/stories/importOrigin.d.ts +3 -1
- package/dist/rules/stories/importOrigin.d.ts.map +1 -1
- package/dist/rules/stories/importOrigin.js +15 -0
- package/dist/rules/stories/importOrigin.js.map +1 -1
- package/dist/rules/stories/origins.d.ts.map +1 -1
- package/dist/rules/stories/origins.js +14 -12
- package/dist/rules/stories/origins.js.map +1 -1
- package/dist/rules/stories/retryOption.d.ts +3 -0
- package/dist/rules/stories/retryOption.d.ts.map +1 -0
- package/dist/rules/stories/retryOption.js +37 -0
- package/dist/rules/stories/retryOption.js.map +1 -0
- package/package.json +4 -4
- package/src/adapters/compileCache.config.ts +3 -0
- package/src/adapters/knip/entryPointFindings.ts +15 -8
- package/src/adapters/manifestInventory.ts +3 -1
- package/src/adapters/manifestReader.ts +4 -3
- package/src/adapters/testProjects.ts +1 -0
- package/src/biome/recognizeDiagnostics.ts +6 -7
- package/src/biome/report.ts +11 -5
- package/src/cli/changedRanges.ts +24 -0
- package/src/cli/fix.ts +13 -14
- package/src/cli/lint.ts +3 -0
- package/src/config.ts +7 -5
- package/src/engine/runRules.ts +31 -11
- package/src/engine/session.ts +14 -13
- package/src/exceptions/biomeFindings.ts +29 -0
- package/src/hooks/preCommit.ts +1 -1
- package/src/imports/adminBindings.ts +45 -0
- package/src/imports/adminEvidence.ts +52 -0
- package/src/imports/adminFindings.ts +65 -0
- package/src/imports/extract.ts +12 -10
- package/src/imports/graph.ts +7 -4
- package/src/imports/nodePlatformBarrels.ts +51 -0
- package/src/imports/projects.ts +61 -27
- package/src/imports/resolve.ts +5 -3
- package/src/manifests/sorted.ts +3 -3
- package/src/naming/ownExports.ts +5 -1
- package/src/rules/builtIn.ts +4 -0
- package/src/rules/files/namedAfterExport.ts +6 -2
- package/src/rules/imports/adminPaths.ts +12 -0
- package/src/rules/imports/resolvable.ts +9 -6
- package/src/rules/imports/runtime.ts +3 -2
- package/src/rules/stories/collectionOrigins.ts +13 -1
- package/src/rules/stories/globalRetries.ts +50 -0
- package/src/rules/stories/httpStatus.ts +13 -2
- package/src/rules/stories/importOrigin.ts +17 -0
- package/src/rules/stories/origins.ts +14 -13
- package/src/rules/stories/retryOption.ts +41 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
|
-
import { Effect, type FileSystem } from "effect";
|
|
2
|
+
import { Effect, type FileSystem, type Scope } from "effect";
|
|
3
3
|
import { readOptionalText } from "#inventory/filesystem.ts";
|
|
4
4
|
import type { RuleInputs } from "#rule.ts";
|
|
5
5
|
|
|
6
6
|
export const manifestReader = Effect.fn("Manifests.manifestReader")(function* (
|
|
7
7
|
root: string,
|
|
8
|
-
): Effect.fn.Return<RuleInputs["readText"], never, FileSystem.FileSystem> {
|
|
8
|
+
): Effect.fn.Return<RuleInputs["readText"], never, FileSystem.FileSystem | Scope.Scope> {
|
|
9
9
|
const services = yield* Effect.context<FileSystem.FileSystem>();
|
|
10
|
-
|
|
10
|
+
const signal = yield* Effect.abortSignal;
|
|
11
|
+
return (path) => Effect.runPromiseWith(services)(readOptionalText(resolve(root, path)), { signal });
|
|
11
12
|
});
|
|
@@ -44,6 +44,7 @@ export function testProjects(options: TestProjectsOptions = {}): TestUserConfig
|
|
|
44
44
|
const { coverage = false } = options;
|
|
45
45
|
const output = Effect.runSync(TestOutput.pipe(Effect.provide(TestOutput.layer)));
|
|
46
46
|
return {
|
|
47
|
+
execArgv: ["--import", fileURLToPath(import.meta.resolve("#adapters/compileCache.config.ts"))],
|
|
47
48
|
maxWorkers: workerCount(options),
|
|
48
49
|
...(coverage === false
|
|
49
50
|
? {}
|
|
@@ -21,17 +21,16 @@ function generatorParameter(node: ts.Node): boolean {
|
|
|
21
21
|
|
|
22
22
|
function tagHandler(node: ts.Node, syntax: Syntax): boolean {
|
|
23
23
|
const property = node.parent;
|
|
24
|
-
if (
|
|
24
|
+
if (
|
|
25
|
+
!(ts.isPropertyAssignment(property) || ts.isMethodDeclaration(property))
|
|
26
|
+
|| property.name !== node
|
|
27
|
+
|| !ts.isObjectLiteralExpression(property.parent)
|
|
28
|
+
) {
|
|
25
29
|
return false;
|
|
26
30
|
}
|
|
27
31
|
const handlers = property.parent;
|
|
28
32
|
const call = handlers.parent;
|
|
29
|
-
return (
|
|
30
|
-
nativeEffectCall(call, "catchTags", syntax)
|
|
31
|
-
&& call.arguments.includes(handlers)
|
|
32
|
-
&& ts.isArrowFunction(property.initializer)
|
|
33
|
-
&& nativeEffectCall(property.initializer.body, "fail", syntax)
|
|
34
|
-
);
|
|
33
|
+
return nativeEffectCall(call, "catchTags", syntax) && call.arguments.includes(handlers);
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
function misclassified(diagnostic: Diagnostic, syntax: Syntax): boolean {
|
package/src/biome/report.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type Diagnostic = typeof Diagnostic.Type;
|
|
|
19
19
|
|
|
20
20
|
const Report = Schema.Struct({
|
|
21
21
|
diagnostics: Schema.Array(Diagnostic),
|
|
22
|
-
summary: Schema.Struct({ changed: Schema.Int }),
|
|
22
|
+
summary: Schema.Struct({ changed: Schema.Int, unchanged: Schema.Int }),
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
export type Report = typeof Report.Type;
|
|
@@ -32,7 +32,6 @@ function failure(args: readonly string[], run: BiomeRun, missing: string, output
|
|
|
32
32
|
return new SetupFailure({ message: `biome ${args.join(" ")} exited ${run.code} without ${missing}:\n${output.trim()}` });
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
// Biome exits with an error but prints an empty report when no file was processed, so only a failing diagnostic explains a failed run.
|
|
36
35
|
function unexplained(run: BiomeRun, report: Report): boolean {
|
|
37
36
|
return run.code !== 0 && !report.diagnostics.some((diagnostic) => FAILING.has(diagnostic.severity));
|
|
38
37
|
}
|
|
@@ -49,6 +48,11 @@ const reportFor = Effect.fn("Biome.reportFor")(function* (
|
|
|
49
48
|
if (report._tag === "None") {
|
|
50
49
|
return yield* Effect.fail(failure(command, run, "a report", [run.stdout, run.stderr].join("\n")));
|
|
51
50
|
}
|
|
51
|
+
if (report.value.summary.changed + report.value.summary.unchanged === 0 && !args.includes("--no-errors-on-unmatched")) {
|
|
52
|
+
return yield* new SetupFailure({
|
|
53
|
+
message: `biome ${command.join(" ")} processed no files. Check files.includes in biome.json or biome.jsonc so Quality has files to check.`,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
52
56
|
if (unexplained(run, report.value)) {
|
|
53
57
|
return yield* Effect.fail(failure(command, run, "a failing diagnostic", run.stderr));
|
|
54
58
|
}
|
|
@@ -59,15 +63,17 @@ export const biomeReport = Effect.fn("Biome.biomeReport")(function* (
|
|
|
59
63
|
root: string,
|
|
60
64
|
args: readonly string[],
|
|
61
65
|
exceptions: readonly ExceptionDeclaration[] = [],
|
|
66
|
+
files: readonly string[] = ["."],
|
|
62
67
|
) {
|
|
63
|
-
const [report, tracked] = yield* Effect.all([reportFor(root, args,
|
|
68
|
+
const [report, tracked] = yield* Effect.all([reportFor(root, args, files, exceptions), ignoredTrackedPaths(root)], {
|
|
64
69
|
concurrency: "unbounded",
|
|
65
70
|
});
|
|
66
71
|
const paths = tracked
|
|
67
72
|
.map((path) => relative(root, path))
|
|
73
|
+
.filter((path) => files.includes(".") || files.includes(path))
|
|
68
74
|
.filter((path) => !path.split(sep).some((part) => part === ".git" || part === ".worktrees" || part === "node_modules"));
|
|
69
|
-
const
|
|
70
|
-
|
|
75
|
+
const extraArgs = [...args, "--vcs-enabled=false", ...(args.includes("--no-errors-on-unmatched") ? [] : ["--no-errors-on-unmatched"])];
|
|
76
|
+
const extra = paths.length === 0 ? undefined : yield* reportFor(root, extraArgs, paths, exceptions);
|
|
71
77
|
const diagnostics = [...report.diagnostics, ...(extra?.diagnostics ?? [])];
|
|
72
78
|
const unique = [...new Map(diagnostics.map((diagnostic) => [JSON.stringify(diagnostic), diagnostic])).values()];
|
|
73
79
|
return {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function position(text: string, offset: number): string {
|
|
2
|
+
const lines = text.slice(0, offset).split("\n");
|
|
3
|
+
return `${lines.length}:${[...(lines.at(-1) ?? "")].length + 1}`;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function range(before: string, after: string): string {
|
|
7
|
+
let start = 0;
|
|
8
|
+
while (start < before.length && start < after.length && before[start] === after[start]) {
|
|
9
|
+
start += 1;
|
|
10
|
+
}
|
|
11
|
+
let end = before.length;
|
|
12
|
+
let otherEnd = after.length;
|
|
13
|
+
while (end > start && otherEnd > start && before[end - 1] === after[otherEnd - 1]) {
|
|
14
|
+
end -= 1;
|
|
15
|
+
otherEnd -= 1;
|
|
16
|
+
}
|
|
17
|
+
return `${position(before, start)}-${position(before, end)}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function changedRanges(before: ReadonlyMap<string, string>, after: ReadonlyMap<string, string>, pass: string): readonly string[] {
|
|
21
|
+
return [...new Set([...before.keys(), ...after.keys()])]
|
|
22
|
+
.filter((path) => before.get(path) !== after.get(path))
|
|
23
|
+
.map((path) => `${path}:${range(before.get(path) ?? "", after.get(path) ?? "")} (${pass})`);
|
|
24
|
+
}
|
package/src/cli/fix.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { relative } from "node:path";
|
|
2
2
|
import { Console, Effect, FileSystem } from "effect";
|
|
3
3
|
import { biomeReport } from "#biome/report.ts";
|
|
4
|
+
import { changedRanges } from "#cli/changedRanges.ts";
|
|
4
5
|
import { loadConfig } from "#config/load.ts";
|
|
5
6
|
import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
|
|
6
7
|
import { SetupFailure } from "#failure.ts";
|
|
@@ -66,7 +67,7 @@ function biomePasses(root: string, exceptions: readonly ExceptionDeclaration[]):
|
|
|
66
67
|
const round = Effect.fn("Cli.round")(function* <TFailure, TRequirements>(
|
|
67
68
|
passes: readonly Pass<TFailure, TRequirements>[],
|
|
68
69
|
index: number,
|
|
69
|
-
afterEachPass: Effect.Effect<void, TFailure, TRequirements>,
|
|
70
|
+
afterEachPass: (label: string) => Effect.Effect<void, TFailure, TRequirements>,
|
|
70
71
|
): Effect.fn.Return<number, TFailure, TRequirements> {
|
|
71
72
|
let total = 0;
|
|
72
73
|
const parts: string[] = [];
|
|
@@ -74,22 +75,18 @@ const round = Effect.fn("Cli.round")(function* <TFailure, TRequirements>(
|
|
|
74
75
|
const changed = yield* pass.run;
|
|
75
76
|
total += changed;
|
|
76
77
|
parts.push(`${plural(changed, "file")} ${pass.label}`);
|
|
77
|
-
yield* afterEachPass;
|
|
78
|
+
yield* afterEachPass(pass.label);
|
|
78
79
|
}
|
|
79
80
|
yield* Console.log(`quality: Biome round ${index} rewrote ${parts.join(" and ")}.`);
|
|
80
81
|
return total;
|
|
81
82
|
});
|
|
82
83
|
|
|
83
|
-
function changedBetween(before: ReadonlyMap<string, string>, after: ReadonlyMap<string, string>): readonly string[] {
|
|
84
|
-
return [...new Set([...before.keys(), ...after.keys()])].filter((path) => before.get(path) !== after.get(path));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
84
|
function unsettled(changed: ReadonlySet<string>): SetupFailure {
|
|
88
85
|
const paths = [...changed].sort((left, right) => left.localeCompare(right));
|
|
89
86
|
const stopped = `Biome still rewrote files after ${MAX_FIX_ROUNDS} rounds, so quality fix stopped.`;
|
|
90
87
|
const named =
|
|
91
88
|
paths.length > 0
|
|
92
|
-
? [`${stopped} These
|
|
89
|
+
? [`${stopped} These ranges changed in the last round (before each pass):`, ...paths.map((path) => ` ${path}`)]
|
|
93
90
|
: [
|
|
94
91
|
`${stopped} The files it changed in the last round are ones quality fix does not read, such as files .gitignore lists.`,
|
|
95
92
|
"Run `biome check --write --unsafe --verbose` to name them.",
|
|
@@ -104,18 +101,20 @@ export const settle = Effect.fn("Cli.settle")(function* <TFailure, TRequirements
|
|
|
104
101
|
snapshot,
|
|
105
102
|
}: Settling<TFailure, TRequirements>): Effect.fn.Return<void, TFailure | SetupFailure, TRequirements> {
|
|
106
103
|
for (let index = 1; index < MAX_FIX_ROUNDS; index += 1) {
|
|
107
|
-
if ((yield* round(passes, index, Effect.void)) === 0) {
|
|
104
|
+
if ((yield* round(passes, index, () => Effect.void)) === 0) {
|
|
108
105
|
return;
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
108
|
const changed = new Set<string>();
|
|
112
109
|
let previous = yield* snapshot;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
function record(label: string) {
|
|
111
|
+
return Effect.map(snapshot, (current) => {
|
|
112
|
+
for (const path of changedRanges(previous, current, label)) {
|
|
113
|
+
changed.add(path);
|
|
114
|
+
}
|
|
115
|
+
previous = current;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
119
118
|
if ((yield* round(passes, MAX_FIX_ROUNDS, record)) === 0) {
|
|
120
119
|
return;
|
|
121
120
|
}
|
package/src/cli/lint.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { relative } from "node:path";
|
|
2
|
+
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
|
|
2
3
|
import * as NodePath from "@effect/platform-node/NodePath";
|
|
3
4
|
import { Console, Effect } from "effect";
|
|
4
5
|
import { withHeavyLock } from "@shivaedev/heavy-lock/withHeavyLock.ts";
|
|
@@ -20,6 +21,7 @@ export const lint = Effect.fn("Cli.lint")(
|
|
|
20
21
|
...evaluated,
|
|
21
22
|
looseBaseline: evaluated.looseBaseline.filter(({ entry }) => !rejected.has(keyOf(entry.rule, entry.file))),
|
|
22
23
|
staleBaseline: [...evaluated.staleBaseline, ...loose],
|
|
24
|
+
staleRegistry: [...evaluated.staleRegistry, ...session.staleRegistry],
|
|
23
25
|
};
|
|
24
26
|
yield* Console.log(
|
|
25
27
|
render(outcome, {
|
|
@@ -37,6 +39,7 @@ export const lint = Effect.fn("Cli.lint")(
|
|
|
37
39
|
(effect) =>
|
|
38
40
|
withHeavyLock(effect, { command: "quality lint" }).pipe(
|
|
39
41
|
Effect.catchTag("HeavyLockError", (cause) => new SetupFailure({ cause, message: cause.message })),
|
|
42
|
+
Effect.provide(NodeCrypto.layer),
|
|
40
43
|
Effect.provide(NodePath.layer),
|
|
41
44
|
),
|
|
42
45
|
);
|
package/src/config.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
|
|
2
|
+
import type { Rule } from "#rule.ts";
|
|
2
3
|
import type { builtInRules } from "#rules/builtIn.ts";
|
|
3
|
-
import type { Rule } from "./rule.ts";
|
|
4
4
|
|
|
5
5
|
export type Level = "error";
|
|
6
6
|
|
|
7
7
|
export type RuleSetting<TInput> = "error" | { readonly level?: "error"; readonly options?: TInput };
|
|
8
8
|
|
|
9
|
-
type InputOf<TCandidate> = TCandidate extends Rule<string, infer TInput> ? TInput : never;
|
|
9
|
+
type InputOf<TCandidate> = TCandidate extends Rule<string, infer TInput, unknown> ? TInput : never;
|
|
10
10
|
|
|
11
|
-
export type RuleSettings<TRules extends readonly Rule[]> = {
|
|
11
|
+
export type RuleSettings<TRules extends readonly Rule<string, unknown, unknown>[]> = {
|
|
12
12
|
readonly [TCandidate in TRules[number] as TCandidate["id"]]?: RuleSetting<InputOf<TCandidate>>;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export type BuiltInRules = typeof builtInRules;
|
|
16
16
|
|
|
17
|
-
export interface QualityConfig<TLocal extends readonly Rule[] = readonly Rule[]> {
|
|
17
|
+
export interface QualityConfig<TLocal extends readonly Rule<string, unknown, unknown>[] = readonly Rule<string, unknown, unknown>[]> {
|
|
18
18
|
readonly baseline?: string;
|
|
19
19
|
readonly exceptions?: readonly ExceptionDeclaration[];
|
|
20
20
|
readonly extensions?: readonly string[];
|
|
@@ -24,6 +24,8 @@ export interface QualityConfig<TLocal extends readonly Rule[] = readonly Rule[]>
|
|
|
24
24
|
readonly sources?: readonly string[];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export function defineConfig<const TLocal extends readonly Rule[] = readonly []>(
|
|
27
|
+
export function defineConfig<const TLocal extends readonly Rule<string, unknown, unknown>[] = readonly []>(
|
|
28
|
+
config: QualityConfig<TLocal>,
|
|
29
|
+
): QualityConfig<TLocal> {
|
|
28
30
|
return config;
|
|
29
31
|
}
|
package/src/engine/runRules.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { isAbsolute, relative } from "node:path";
|
|
1
|
+
import { basename, isAbsolute, relative } from "node:path";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { ManifestFailure } from "#adapters/manifestInventory.ts";
|
|
4
4
|
import { SetupFailure } from "#failure.ts";
|
|
5
|
+
import { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
5
6
|
import { posix } from "#inventory/ignoreScope.ts";
|
|
6
7
|
import type { Finding, RuleCheck, RuleInputs, RuleServices } from "#rule.ts";
|
|
7
8
|
import type { ActiveLevel, Violation } from "./violation.ts";
|
|
@@ -49,19 +50,38 @@ function violationOf(rule: ActiveRule, root: string, finding: Finding, exception
|
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
function expectedFailure(rule: ActiveRule, root: string, cause: unknown): readonly Violation[] | undefined {
|
|
54
|
+
if (cause instanceof ManifestFailure || cause instanceof FilesystemFailure) {
|
|
55
|
+
const manifest = cause instanceof ManifestFailure || basename(cause.path) === "package.json";
|
|
56
|
+
return [
|
|
57
|
+
{
|
|
58
|
+
file: repositoryPath(root, cause.path),
|
|
59
|
+
level: rule.level,
|
|
60
|
+
message: cause.message,
|
|
61
|
+
rule: manifest ? "manifests/valid" : rule.id,
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
52
68
|
function runRule(rule: ActiveRule, inputs: RuleInputs, exceptionFile: string): Effect.Effect<readonly Violation[], SetupFailure, RuleServices> {
|
|
53
69
|
return Effect.suspend(() => rule.check(inputs)).pipe(
|
|
54
|
-
Effect.catch((cause) =>
|
|
55
|
-
cause instanceof SetupFailure
|
|
56
|
-
? Effect.fail(new SetupFailure({ cause, message: `rule ${rule.id} failed: ${cause.message}` }))
|
|
57
|
-
: Effect.die(cause),
|
|
58
|
-
),
|
|
59
70
|
Effect.map((findings) => findings.map((finding) => violationOf(rule, inputs.root, finding, exceptionFile))),
|
|
60
|
-
Effect.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
Effect.catch((cause) => {
|
|
72
|
+
const findings = expectedFailure(rule, inputs.root, cause);
|
|
73
|
+
if (findings !== undefined) {
|
|
74
|
+
return Effect.succeed(findings);
|
|
75
|
+
}
|
|
76
|
+
if (cause instanceof SetupFailure) {
|
|
77
|
+
return Effect.fail(new SetupFailure({ cause, message: `rule ${rule.id} failed: ${cause.message}` }));
|
|
78
|
+
}
|
|
79
|
+
return Effect.die(cause);
|
|
80
|
+
}),
|
|
81
|
+
Effect.catchDefect((cause) => {
|
|
82
|
+
const findings = expectedFailure(rule, inputs.root, cause);
|
|
83
|
+
return findings === undefined ? Effect.die(new Error(`rule ${rule.id} failed: ${messageOf(cause)}`, { cause })) : Effect.succeed(findings);
|
|
84
|
+
}),
|
|
65
85
|
);
|
|
66
86
|
}
|
|
67
87
|
|
package/src/engine/session.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { relative } from "node:path";
|
|
2
|
-
import { Effect } from "effect";
|
|
2
|
+
import { Effect, type Scope } from "effect";
|
|
3
3
|
import { setManifestFiles } from "#adapters/manifestInventory.ts";
|
|
4
4
|
import { manifestReader } from "#adapters/manifestReader.ts";
|
|
5
5
|
import { loadConfig, type ResolvedConfig } from "#config/load.ts";
|
|
6
|
-
import
|
|
6
|
+
import { staleBiomeExceptions } from "#exceptions/biomeFindings.ts";
|
|
7
|
+
import type { RegistryEntry, StaleRegistryEntry } from "#exceptions/registry.ts";
|
|
7
8
|
import { registryEntries } from "#exceptions/registryEntries.ts";
|
|
8
9
|
import { SetupFailure } from "#failure.ts";
|
|
9
10
|
import { collectInventory, type Inventory } from "#inventory/collect.ts";
|
|
10
|
-
import type { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
11
11
|
import type { RuleServices } from "#rule.ts";
|
|
12
12
|
import { type BaselineFile, readBaseline, readInput } from "./baselineFile.ts";
|
|
13
13
|
import { runRules } from "./runRules.ts";
|
|
@@ -18,12 +18,11 @@ export interface Session {
|
|
|
18
18
|
readonly config: ResolvedConfig;
|
|
19
19
|
readonly inventory: Inventory;
|
|
20
20
|
readonly registry: readonly RegistryEntry[];
|
|
21
|
+
readonly staleRegistry: readonly StaleRegistryEntry[];
|
|
21
22
|
readonly violations: readonly Violation[];
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
function setup<TValue, TRequirements>(
|
|
25
|
-
effect: Effect.Effect<TValue, FilesystemFailure | SetupFailure, TRequirements>,
|
|
26
|
-
): Effect.Effect<TValue, SetupFailure, TRequirements> {
|
|
25
|
+
function setup<TValue, TRequirements>(effect: Effect.Effect<TValue, Error, TRequirements>): Effect.Effect<TValue, SetupFailure, TRequirements> {
|
|
27
26
|
return Effect.mapError(effect, (failure) =>
|
|
28
27
|
failure instanceof SetupFailure ? failure : new SetupFailure({ cause: failure, message: failure.message }),
|
|
29
28
|
);
|
|
@@ -31,20 +30,22 @@ function setup<TValue, TRequirements>(
|
|
|
31
30
|
|
|
32
31
|
export const scan = Effect.fn("Engine.scan")(function* (
|
|
33
32
|
config: ResolvedConfig,
|
|
34
|
-
): Effect.fn.Return<Pick<Session, "inventory" | "violations">, SetupFailure, RuleServices> {
|
|
33
|
+
): Effect.fn.Return<Pick<Session, "inventory" | "staleRegistry" | "violations">, SetupFailure, RuleServices | Scope.Scope> {
|
|
35
34
|
const inventory = yield* setup(collectInventory(config.root, config));
|
|
36
35
|
const readText = yield* manifestReader(config.root);
|
|
37
36
|
setManifestFiles(readText, inventory.manifestFiles);
|
|
38
|
-
const
|
|
37
|
+
const inputs = {
|
|
39
38
|
configFile: relative(config.root, config.file),
|
|
40
39
|
exceptions: config.exceptions,
|
|
41
40
|
files: inventory.files,
|
|
42
41
|
readText,
|
|
43
42
|
root: config.root,
|
|
44
43
|
sources: inventory.sources,
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
};
|
|
45
|
+
const violations = yield* runRules(config.active, inputs);
|
|
46
|
+
const staleRegistry = yield* setup(staleBiomeExceptions(inputs));
|
|
47
|
+
return { inventory, staleRegistry, violations };
|
|
48
|
+
}, Effect.scoped);
|
|
48
49
|
|
|
49
50
|
export const openSession = Effect.fn("Engine.openSession")(function* (
|
|
50
51
|
cwd: string,
|
|
@@ -60,6 +61,6 @@ export const openSession = Effect.fn("Engine.openSession")(function* (
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
const baseline = yield* readBaseline(config);
|
|
63
|
-
const
|
|
64
|
-
return { baseline, config,
|
|
64
|
+
const scanned = yield* scan(config);
|
|
65
|
+
return { ...scanned, baseline, config, registry: registryEntries(config.exceptions) };
|
|
65
66
|
});
|
|
@@ -1,5 +1,34 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { biomeReport } from "#biome/report.ts";
|
|
3
|
+
import { withoutEntryPointImports } from "#biome/withoutEntryPointImports.ts";
|
|
4
|
+
import type { StaleRegistryEntry } from "#exceptions/registry.ts";
|
|
1
5
|
import type { Finding, RuleInputs } from "#rule.ts";
|
|
2
6
|
|
|
7
|
+
export const staleBiomeExceptions = Effect.fn("Exceptions.staleBiomeExceptions")(function* (inputs: RuleInputs) {
|
|
8
|
+
const declarations = inputs.exceptions ?? [];
|
|
9
|
+
const declared = declarations.flatMap(({ files, reason, rules }) =>
|
|
10
|
+
rules.filter((rule) => /^biome\/(?:lint|assist)\//u.test(rule)).flatMap((rule) => files.map((file) => ({ file, reason, rule }))),
|
|
11
|
+
);
|
|
12
|
+
const texts = yield* Effect.forEach(declared, ({ file }) => Effect.promise(() => inputs.readText(file)), { concurrency: "unbounded" });
|
|
13
|
+
const entries = declared.filter((_, index) => texts[index] !== undefined);
|
|
14
|
+
if (entries.length === 0) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
const exclusions = declarations.flatMap((entry) =>
|
|
18
|
+
entry.rules.includes("biome/files/includes") ? [{ ...entry, rules: ["biome/files/includes"] as const }] : [],
|
|
19
|
+
);
|
|
20
|
+
const report = yield* biomeReport(inputs.root, ["check", "--no-errors-on-unmatched"], exclusions, [...new Set(entries.map(({ file }) => file))]);
|
|
21
|
+
const diagnostics = yield* Effect.promise(() => withoutEntryPointImports(inputs.readText, report.diagnostics));
|
|
22
|
+
return entries
|
|
23
|
+
.filter(({ file, rule }) => !diagnostics.some((diagnostic) => diagnostic.location.path === file && `biome/${diagnostic.category}` === rule))
|
|
24
|
+
.map(
|
|
25
|
+
(entry): StaleRegistryEntry => ({
|
|
26
|
+
entry,
|
|
27
|
+
problem: `matches no finding. Remove this file/rule pair from exceptions in ${inputs.configFile ?? "quality.config.ts"}`,
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
3
32
|
export async function missingBiomeFiles(inputs: RuleInputs): Promise<readonly Finding[]> {
|
|
4
33
|
const paths = (inputs.exceptions ?? [])
|
|
5
34
|
.filter((entry) => entry.rules.some((rule) => rule.startsWith("biome/") && rule !== "biome/files/includes"))
|
package/src/hooks/preCommit.ts
CHANGED
|
@@ -25,7 +25,7 @@ const commitScripts = Effect.fnUntraced(function* (root: string) {
|
|
|
25
25
|
return yield* new SetupFailure({ message: `${file}: unsupported packageManager "${manager}". Use npm, pnpm, yarn or bun.` });
|
|
26
26
|
}
|
|
27
27
|
return { manager, scripts: ["typecheck", "quality:commit"].filter((script) => manifest.scripts?.[script] !== undefined) };
|
|
28
|
-
});
|
|
28
|
+
}, Effect.scoped);
|
|
29
29
|
|
|
30
30
|
const runScript = Effect.fnUntraced(
|
|
31
31
|
function* (root: string, manager: string, script: string) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
export interface AdminBindings {
|
|
4
|
+
readonly factories: ReadonlySet<string>;
|
|
5
|
+
readonly guards: ReadonlySet<string>;
|
|
6
|
+
readonly permissions: ReadonlySet<string>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function namedImports(source: ts.SourceFile) {
|
|
10
|
+
return source.statements.filter(ts.isImportDeclaration).flatMap((statement) => {
|
|
11
|
+
const bindings = statement.importClause?.namedBindings;
|
|
12
|
+
if (
|
|
13
|
+
!(ts.isStringLiteral(statement.moduleSpecifier) && bindings !== undefined && ts.isNamedImports(bindings))
|
|
14
|
+
|| statement.importClause?.isTypeOnly
|
|
15
|
+
) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const origin = statement.moduleSpecifier.text;
|
|
19
|
+
return bindings.elements
|
|
20
|
+
.filter((element) => !element.isTypeOnly)
|
|
21
|
+
.map((binding) => ({
|
|
22
|
+
local: binding.name.text,
|
|
23
|
+
name: (binding.propertyName ?? binding.name).text,
|
|
24
|
+
origin,
|
|
25
|
+
}));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function adminBindings(source: ts.SourceFile): AdminBindings {
|
|
30
|
+
const factories = new Set<string>();
|
|
31
|
+
const permissions = new Set<string>();
|
|
32
|
+
const guards = new Set<string>(["middleware"]);
|
|
33
|
+
for (const { local, name, origin } of namedImports(source)) {
|
|
34
|
+
if (origin.startsWith("@shivaedev/admin/") && ["adminPage", "registerAdmin"].includes(name)) {
|
|
35
|
+
factories.add(local);
|
|
36
|
+
}
|
|
37
|
+
if (/(?:^|[/#])admin\//u.test(origin)) {
|
|
38
|
+
permissions.add(local);
|
|
39
|
+
}
|
|
40
|
+
if (origin.startsWith("@shivaedev/") && ["requirePermission", "permissionMiddleware", "permissionReadPolicy"].includes(name)) {
|
|
41
|
+
guards.add(local);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return { factories, guards, permissions };
|
|
45
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { SourceFile } from "#rule.ts";
|
|
3
|
+
import { parse } from "#rules/parse.ts";
|
|
4
|
+
import { type AdminBindings, adminBindings } from "./adminBindings.ts";
|
|
5
|
+
|
|
6
|
+
export function sourceRoot(path: string): string | undefined {
|
|
7
|
+
return /^(?:.*\/)?src\//u.exec(path)?.[0];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function adminPath(path: string): boolean {
|
|
11
|
+
const root = sourceRoot(path);
|
|
12
|
+
return root !== undefined && path.slice(root.length).split("/").includes("admin");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function composition(path: string): boolean {
|
|
16
|
+
return /(?:^|\/)(?:registration|modules)\.[cm]?[jt]sx?$/u.test(path);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function adminCall(node: ts.CallExpression, bindings: AdminBindings): boolean {
|
|
20
|
+
if (ts.isIdentifier(node.expression) && bindings.factories.has(node.expression.text)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
const expression = ts.isCallExpression(node.expression) ? node.expression.expression : node.expression;
|
|
24
|
+
const callee = ts.isPropertyAccessExpression(expression) ? expression.name.text : expression.getText();
|
|
25
|
+
return bindings.guards.has(callee) && node.arguments.some((argument) => ts.isIdentifier(argument) && bindings.permissions.has(argument.text));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function exportedRegistration(node: ts.Node): boolean {
|
|
29
|
+
if (!(ts.isFunctionDeclaration(node) || ts.isVariableStatement(node))) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const exported = node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword);
|
|
33
|
+
const names = ts.isFunctionDeclaration(node)
|
|
34
|
+
? [node.name?.text]
|
|
35
|
+
: node.declarationList.declarations.map((declaration) => declaration.name.getText());
|
|
36
|
+
return exported === true && names.includes("adminRegistration");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function adminEvidence(file: SourceFile): boolean {
|
|
40
|
+
const source = parse(file);
|
|
41
|
+
if (source === undefined) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const bindings = adminBindings(source);
|
|
45
|
+
let found = false;
|
|
46
|
+
function visit(node: ts.Node): void {
|
|
47
|
+
found ||= (ts.isCallExpression(node) && adminCall(node, bindings)) || exportedRegistration(node);
|
|
48
|
+
ts.forEachChild(node, visit);
|
|
49
|
+
}
|
|
50
|
+
visit(source);
|
|
51
|
+
return found;
|
|
52
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
2
|
+
import { isTestCode } from "#naming/testName.ts";
|
|
3
|
+
import type { Finding, SourceFile } from "#rule.ts";
|
|
4
|
+
import { adminEvidence, adminPath, composition, sourceRoot } from "./adminEvidence.ts";
|
|
5
|
+
import type { ImportGraph } from "./graph.ts";
|
|
6
|
+
|
|
7
|
+
function reachable(seeds: readonly string[], next: (file: string) => readonly string[]): Set<string> {
|
|
8
|
+
const reached = new Set<string>();
|
|
9
|
+
const pending = [...seeds];
|
|
10
|
+
for (const file of pending) {
|
|
11
|
+
if (!reached.has(file)) {
|
|
12
|
+
reached.add(file);
|
|
13
|
+
pending.push(...next(file));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return reached;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function destination(file: string, admin: boolean): string {
|
|
20
|
+
if (!admin) {
|
|
21
|
+
const root = sourceRoot(file) ?? "";
|
|
22
|
+
return posix.dirname(root + file.slice(root.length).replace(/(?:^|\/)admin\//u, (segment) => (segment.startsWith("/") ? "/" : "")));
|
|
23
|
+
}
|
|
24
|
+
const runtime = /^(?<root>.*\/(?:client|server))\/(?<local>.*)$/u.exec(file)?.groups;
|
|
25
|
+
if (runtime?.root !== undefined && runtime.local !== undefined) {
|
|
26
|
+
return posix.dirname(`${runtime.root}/admin/${runtime.local}`);
|
|
27
|
+
}
|
|
28
|
+
return `${posix.dirname(file)}/admin`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function adminFindings(graph: ImportGraph, sources: readonly SourceFile[]): readonly Finding[] {
|
|
32
|
+
const files = sources.filter((file) => sourceRoot(file.path) !== undefined && !isTestCode(file.path));
|
|
33
|
+
const paths = new Set(files.map((file) => file.path));
|
|
34
|
+
const seeds = new Set(files.filter((file) => adminPath(file.path) || adminEvidence(file)).map((file) => file.path));
|
|
35
|
+
const edges = graph.edges.filter((edge) => edge.kind === "import" && paths.has(edge.from));
|
|
36
|
+
const adjacency = new Map<string, string[]>();
|
|
37
|
+
const imported = new Set<string>();
|
|
38
|
+
for (const edge of edges) {
|
|
39
|
+
if (edge.to.kind === "file" && paths.has(edge.to.path) && sourceRoot(edge.from) === sourceRoot(edge.to.path)) {
|
|
40
|
+
adjacency.set(edge.from, [...(adjacency.get(edge.from) ?? []), edge.to.path]);
|
|
41
|
+
imported.add(edge.to.path);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function next(file: string): readonly string[] {
|
|
45
|
+
return adjacency.get(file) ?? [];
|
|
46
|
+
}
|
|
47
|
+
const admin = reachable([...seeds], next);
|
|
48
|
+
const members = files.filter(({ path }) => !seeds.has(path) && (!(admin.has(path) && imported.has(path)) || composition(path)));
|
|
49
|
+
const member = reachable(
|
|
50
|
+
members.map((file) => file.path),
|
|
51
|
+
(file) =>
|
|
52
|
+
next(file).filter(
|
|
53
|
+
(target) => !(composition(file) && seeds.has(target) && /\/(?:[^/]*[Rr]egistration|pages|make)\.[cm]?[jt]sx?$/u.test(target)),
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
return files.flatMap(({ path }): Finding[] => {
|
|
57
|
+
if (adminPath(path) && member.has(path)) {
|
|
58
|
+
return [{ file: path, message: `Member code reaches this admin/ file. Move it to ${destination(path, false)}/.` }];
|
|
59
|
+
}
|
|
60
|
+
if (!adminPath(path) && admin.has(path) && !member.has(path)) {
|
|
61
|
+
return [{ file: path, message: `Only admin permissions or registrations reach this file. Move it to ${destination(path, true)}/.` }];
|
|
62
|
+
}
|
|
63
|
+
return [];
|
|
64
|
+
});
|
|
65
|
+
}
|