@starci/eslint-canon-be 3.5.0 → 3.6.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 +15 -0
- package/README.md +11 -2
- package/dist/ambient-id.d.ts +9 -0
- package/{ambient-id.mjs → dist/ambient-id.js} +43 -39
- package/dist/app-composition.d.ts +21 -0
- package/{app-composition.mjs → dist/app-composition.js} +396 -300
- package/dist/async-discipline.d.ts +9 -0
- package/dist/async-discipline.js +77 -0
- package/dist/authorization.d.ts +12 -0
- package/{authorization.mjs → dist/authorization.js} +53 -59
- package/dist/boundary-schema.d.ts +15 -0
- package/{boundary-schema.mjs → dist/boundary-schema.js} +120 -105
- package/dist/builders.d.ts +21 -0
- package/{builders.mjs → dist/builders.js} +162 -146
- package/dist/cli.d.ts +15 -0
- package/{cli.mjs → dist/cli.js} +97 -82
- package/dist/comments.d.ts +52 -0
- package/dist/comments.js +412 -0
- package/dist/config-owner.d.ts +24 -0
- package/{config-owner.mjs → dist/config-owner.js} +256 -219
- package/dist/connections.d.ts +12 -0
- package/{connections.mjs → dist/connections.js} +138 -140
- package/dist/cookies.d.ts +9 -0
- package/{cookies.mjs → dist/cookies.js} +58 -58
- package/dist/cqrs.d.ts +27 -0
- package/{cqrs.mjs → dist/cqrs.js} +341 -282
- package/dist/data-access.d.ts +50 -0
- package/{data-access.mjs → dist/data-access.js} +238 -243
- package/dist/default-deny.d.ts +15 -0
- package/{default-deny.mjs → dist/default-deny.js} +103 -88
- package/dist/e2e-flow.d.ts +25 -0
- package/{e2e-flow.mjs → dist/e2e-flow.js} +113 -112
- package/dist/edge-hardening.d.ts +10 -0
- package/dist/edge-hardening.js +173 -0
- package/dist/error-handling.d.ts +21 -0
- package/{error-handling.mjs → dist/error-handling.js} +289 -239
- package/dist/event-bus.d.ts +14 -0
- package/{event-bus.mjs → dist/event-bus.js} +146 -129
- package/dist/feature-thin.d.ts +12 -0
- package/{feature-thin.mjs → dist/feature-thin.js} +208 -191
- package/dist/function-budget.d.ts +7 -0
- package/{function-budget.mjs → dist/function-budget.js} +24 -27
- package/dist/health-ready.d.ts +10 -0
- package/dist/health-ready.js +703 -0
- package/dist/idempotency.d.ts +10 -0
- package/{idempotency.mjs → dist/idempotency.js} +296 -226
- package/dist/index.d.ts +54 -0
- package/{index.mjs → dist/index.js} +91 -109
- package/dist/infra-owner.d.ts +18 -0
- package/{infra-owner.mjs → dist/infra-owner.js} +58 -51
- package/dist/injection.d.ts +30 -0
- package/{injection.mjs → dist/injection.js} +397 -344
- package/dist/input-bounds.d.ts +15 -0
- package/{input-bounds.mjs → dist/input-bounds.js} +143 -132
- package/dist/jobs.d.ts +17 -0
- package/{jobs.mjs → dist/jobs.js} +116 -99
- package/dist/jwt-alg.d.ts +6 -0
- package/dist/jwt-alg.js +49 -0
- package/dist/lib/app-roles.d.ts +25 -0
- package/{lib/app-roles.mjs → dist/lib/app-roles.js} +15 -17
- package/dist/lib/ast.d.ts +40 -0
- package/dist/lib/ast.js +100 -0
- package/dist/lib/client-idempotency.d.ts +3 -0
- package/{lib/client-idempotency.mjs → dist/lib/client-idempotency.js} +316 -268
- package/dist/lib/config.d.ts +36 -0
- package/{lib/config.mjs → dist/lib/config.js} +24 -27
- package/dist/lib/db-writes.d.ts +29 -0
- package/{lib/db-writes.mjs → dist/lib/db-writes.js} +27 -27
- package/dist/lib/declared.d.ts +77 -0
- package/{lib/declared.mjs → dist/lib/declared.js} +83 -78
- package/dist/lib/doors.d.ts +50 -0
- package/{lib/doors.mjs → dist/lib/doors.js} +45 -50
- package/dist/lib/edition.d.ts +25 -0
- package/{lib/edition.mjs → dist/lib/edition.js} +15 -20
- package/dist/lib/entity-writes.d.ts +7 -0
- package/{lib/entity-writes.mjs → dist/lib/entity-writes.js} +31 -22
- package/dist/lib/hfs.d.ts +34 -0
- package/{lib/hfs.mjs → dist/lib/hfs.js} +31 -29
- package/dist/lib/import-source.d.ts +63 -0
- package/dist/lib/import-source.js +134 -0
- package/dist/lib/path.d.ts +8 -0
- package/{lib/path.mjs → dist/lib/path.js} +4 -7
- package/dist/lib/persistence.d.ts +115 -0
- package/{lib/persistence.mjs → dist/lib/persistence.js} +55 -66
- package/dist/lib/ports.d.ts +70 -0
- package/{lib/ports.mjs → dist/lib/ports.js} +62 -66
- package/dist/lib/rule.d.ts +31 -0
- package/dist/lib/rule.js +2 -0
- package/dist/lib/runtime-root.d.ts +4 -0
- package/dist/lib/runtime-root.js +10 -0
- package/dist/lib/schema-values.d.ts +13 -0
- package/{lib/schema-values.mjs → dist/lib/schema-values.js} +67 -59
- package/dist/lib/specifier.d.ts +12 -0
- package/dist/lib/specifier.js +29 -0
- package/dist/lib/subject-values.d.ts +4 -0
- package/dist/lib/subject-values.js +61 -0
- package/dist/lib/transactions.d.ts +18 -0
- package/{lib/transactions.mjs → dist/lib/transactions.js} +17 -15
- package/dist/lib/transport-slots.d.ts +17 -0
- package/{lib/transport-slots.mjs → dist/lib/transport-slots.js} +2 -4
- package/dist/lib/types.d.ts +96 -0
- package/dist/lib/types.js +150 -0
- package/dist/lib/unit-spec.d.ts +48 -0
- package/{lib/unit-spec.mjs → dist/lib/unit-spec.js} +35 -44
- package/dist/lib/webhook-ack.d.ts +4 -0
- package/{lib/webhook-ack.mjs → dist/lib/webhook-ack.js} +78 -62
- package/dist/lib/webhook-handoff-inbox.d.ts +3 -0
- package/{lib/webhook-handoff-inbox.mjs → dist/lib/webhook-handoff-inbox.js} +195 -167
- package/dist/lib/webhook-handoff-intake.d.ts +4 -0
- package/{lib/webhook-handoff-intake.mjs → dist/lib/webhook-handoff-intake.js} +125 -102
- package/dist/lib/webhook-handoff.d.ts +15 -0
- package/{lib/webhook-handoff.mjs → dist/lib/webhook-handoff.js} +107 -100
- package/dist/lib/webhook-verifiers.d.ts +20 -0
- package/{lib/webhook-verifiers.mjs → dist/lib/webhook-verifiers.js} +108 -104
- package/dist/lib/why.d.ts +9 -0
- package/{lib/why.mjs → dist/lib/why.js} +6 -6
- package/dist/log-safety.d.ts +20 -0
- package/dist/log-safety.js +308 -0
- package/dist/module-layering.d.ts +42 -0
- package/dist/module-layering.js +257 -0
- package/dist/module-shape.d.ts +47 -0
- package/{module-shape.mjs → dist/module-shape.js} +278 -236
- package/dist/naming.d.ts +49 -0
- package/dist/naming.js +246 -0
- package/dist/observability.d.ts +25 -0
- package/dist/observability.js +245 -0
- package/dist/operations.d.ts +23 -0
- package/{operations.mjs → dist/operations.js} +410 -332
- package/dist/project-graph.d.ts +9 -0
- package/{project-graph.mjs → dist/project-graph.js} +8 -13
- package/dist/projections.d.ts +11 -0
- package/{projections.mjs → dist/projections.js} +60 -57
- package/dist/query-safety.d.ts +21 -0
- package/{query-safety.mjs → dist/query-safety.js} +92 -108
- package/dist/realtime.d.ts +15 -0
- package/{realtime.mjs → dist/realtime.js} +108 -106
- package/dist/resilience.d.ts +15 -0
- package/dist/resilience.js +319 -0
- package/dist/schema-authority.d.ts +15 -0
- package/{schema-authority.mjs → dist/schema-authority.js} +256 -220
- package/dist/service-deps.d.ts +17 -0
- package/{service-deps.mjs → dist/service-deps.js} +133 -130
- package/dist/service-isolation.d.ts +8 -0
- package/dist/service-isolation.js +76 -0
- package/dist/size-budget.d.ts +9 -0
- package/{size-budget.mjs → dist/size-budget.js} +27 -27
- package/dist/sonar-parity.d.ts +5 -0
- package/{sonar-parity.mjs → dist/sonar-parity.js} +7 -7
- package/dist/spec-no-skip.d.ts +9 -0
- package/dist/spec-no-skip.js +81 -0
- package/dist/spec-quality.d.ts +10 -0
- package/{spec-quality.mjs → dist/spec-quality.js} +103 -87
- package/dist/suppression.d.ts +26 -0
- package/{suppression.mjs → dist/suppression.js} +30 -45
- package/dist/temporal.d.ts +9 -0
- package/{temporal.mjs → dist/temporal.js} +75 -65
- package/dist/test-world.d.ts +28 -0
- package/{test-world.mjs → dist/test-world.js} +102 -83
- package/dist/testing.d.ts +51 -0
- package/dist/testing.js +368 -0
- package/dist/third-party-owner.d.ts +8 -0
- package/{third-party-owner.mjs → dist/third-party-owner.js} +105 -91
- package/dist/transport.d.ts +24 -0
- package/{transport.mjs → dist/transport.js} +279 -240
- package/dist/type-safety.d.ts +25 -0
- package/dist/type-safety.js +297 -0
- package/dist/unit-spec.d.ts +30 -0
- package/{unit-spec.mjs → dist/unit-spec.js} +473 -399
- package/dist/uploads.d.ts +9 -0
- package/{uploads.mjs → dist/uploads.js} +62 -54
- package/dist/user-copy.d.ts +9 -0
- package/{user-copy.mjs → dist/user-copy.js} +76 -67
- package/dist/webhooks.d.ts +16 -0
- package/{webhooks.mjs → dist/webhooks.js} +243 -231
- package/package.json +17 -8
- package/runtime/knowledge/hfs/canon-pins.yaml +17 -10
- package/async-discipline.mjs +0 -83
- package/comments.mjs +0 -416
- package/edge-hardening.mjs +0 -139
- package/health-ready.mjs +0 -539
- package/jwt-alg.mjs +0 -45
- package/lib/ast.mjs +0 -88
- package/lib/import-source.mjs +0 -104
- package/lib/specifier.mjs +0 -27
- package/lib/subject-values.mjs +0 -55
- package/lib/types.mjs +0 -133
- package/log-safety.mjs +0 -303
- package/module-layering.mjs +0 -270
- package/naming.mjs +0 -251
- package/observability.mjs +0 -241
- package/resilience.mjs +0 -304
- package/service-isolation.mjs +0 -75
- package/spec-no-skip.mjs +0 -85
- package/testing.mjs +0 -384
- package/type-safety.mjs +0 -323
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Recommended, RuleModule } from "./lib/rule.js";
|
|
2
|
+
/** An `async` function awaits something. */
|
|
3
|
+
export declare const asyncNeedsAwait: RuleModule;
|
|
4
|
+
/** The rules this law contributes to the plugin. */
|
|
5
|
+
export declare const rules: {
|
|
6
|
+
"async-needs-await": RuleModule;
|
|
7
|
+
};
|
|
8
|
+
/** Starts at error: no baseline exists, and the repositories' fix lanes clear the debt. */
|
|
9
|
+
export declare const recommended: Recommended;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { walk } from "./lib/ast.js";
|
|
2
|
+
import { isDeclarationFile } from "./lib/path.js";
|
|
3
|
+
/** Whether the function body awaits, ignoring nested functions (each is judged alone). */
|
|
4
|
+
const awaits = (fn) => {
|
|
5
|
+
let found = false;
|
|
6
|
+
walk(fn.body, (node) => {
|
|
7
|
+
if (found)
|
|
8
|
+
return;
|
|
9
|
+
if (node.type === "AwaitExpression")
|
|
10
|
+
found = true;
|
|
11
|
+
else if (node.type === "ForOfStatement" && node.await)
|
|
12
|
+
found = true;
|
|
13
|
+
}, { intoFunctions: false });
|
|
14
|
+
return found;
|
|
15
|
+
};
|
|
16
|
+
/** Whether the function is a method whose `async` a base class, interface or decorator fixes. */
|
|
17
|
+
const asyncIsContractual = (fn) => {
|
|
18
|
+
const method = fn.parent?.type === "MethodDefinition" ? fn.parent : null;
|
|
19
|
+
if (!method)
|
|
20
|
+
return false;
|
|
21
|
+
if (method.decorators?.length > 0)
|
|
22
|
+
return true;
|
|
23
|
+
if (method.override)
|
|
24
|
+
return true;
|
|
25
|
+
const klass = method.parent?.parent;
|
|
26
|
+
if (klass && (klass.superClass || (klass.implements && klass.implements.length > 0)))
|
|
27
|
+
return true;
|
|
28
|
+
return false;
|
|
29
|
+
};
|
|
30
|
+
/** An `async` function awaits something. */
|
|
31
|
+
export const asyncNeedsAwait = {
|
|
32
|
+
meta: {
|
|
33
|
+
type: "problem",
|
|
34
|
+
docs: { description: "An `async` function contains an `await`, or it is not `async`." },
|
|
35
|
+
schema: [],
|
|
36
|
+
messages: {
|
|
37
|
+
noAwait: "This `async` function never awaits. It promises asynchronous work and does none, so a thrown error becomes a rejected promise for no reason and a reader looks for a suspension that is not there. Remove `async` and return the value or the promise the body already holds; where the signature must return a `Promise`, return `Promise.resolve(value)`.",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
create(context) {
|
|
41
|
+
const filename = context.filename || context.getFilename();
|
|
42
|
+
if (isDeclarationFile(filename))
|
|
43
|
+
return {};
|
|
44
|
+
const check = (node) => {
|
|
45
|
+
if (!node.async || node.generator || !node.body)
|
|
46
|
+
return;
|
|
47
|
+
if (node.body.type !== "BlockStatement" && node.type === "ArrowFunctionExpression") {
|
|
48
|
+
// an expression body has no statements to await inside; `async () => x` is judged by the expression itself
|
|
49
|
+
let has = false;
|
|
50
|
+
walk(node.body, (child) => {
|
|
51
|
+
if (child.type === "AwaitExpression")
|
|
52
|
+
has = true;
|
|
53
|
+
}, { intoFunctions: false });
|
|
54
|
+
if (!has)
|
|
55
|
+
context.report({ node, messageId: "noAwait" });
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (asyncIsContractual(node))
|
|
59
|
+
return;
|
|
60
|
+
if (!awaits(node))
|
|
61
|
+
context.report({ node, messageId: "noAwait" });
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
FunctionDeclaration: check,
|
|
65
|
+
FunctionExpression: check,
|
|
66
|
+
ArrowFunctionExpression: check,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
/** The rules this law contributes to the plugin. */
|
|
71
|
+
export const rules = {
|
|
72
|
+
"async-needs-await": asyncNeedsAwait,
|
|
73
|
+
};
|
|
74
|
+
/** Starts at error: no baseline exists, and the repositories' fix lanes clear the debt. */
|
|
75
|
+
export const recommended = {
|
|
76
|
+
"starci-be/async-needs-await": "error",
|
|
77
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Recommended, RuleModule } from "./lib/rule.js";
|
|
2
|
+
/** No route picks its own guard: the global APP_GUARD chain decides. */
|
|
3
|
+
export declare const noAuthUseGuards: RuleModule;
|
|
4
|
+
/** A guard never calls, extends or receives another guard: the app registers each one as its own APP_GUARD. */
|
|
5
|
+
export declare const noGuardInjectsGuard: RuleModule;
|
|
6
|
+
/** Every rule this module ships, by the name a config switches it on under. */
|
|
7
|
+
export declare const rules: {
|
|
8
|
+
"no-auth-use-guards": RuleModule;
|
|
9
|
+
"no-guard-injects-guard": RuleModule;
|
|
10
|
+
};
|
|
11
|
+
/** The level a consuming repository switches this on at. */
|
|
12
|
+
export declare const recommended: Recommended;
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
* This rule replaces `identity-needs-guard`, which asked a door that read the caller's identity to carry a guard: with
|
|
10
10
|
* default-deny the guard is global, so there is nothing left for the door to carry.
|
|
11
11
|
*/
|
|
12
|
-
import { importsFrom } from "./lib/declared.
|
|
13
|
-
|
|
12
|
+
import { importsFrom } from "./lib/declared.js";
|
|
13
|
+
import { isNode } from "./lib/rule.js";
|
|
14
14
|
/** True when the decorator expression names `UseGuards`, however it was imported. */
|
|
15
15
|
const isUseGuards = (decorator, aliases) => {
|
|
16
|
-
const expression = decorator.expression.type === "CallExpression" ? decorator.expression.callee : decorator.expression
|
|
17
|
-
if (expression.type === "Identifier")
|
|
16
|
+
const expression = decorator.expression.type === "CallExpression" ? decorator.expression.callee : decorator.expression;
|
|
17
|
+
if (expression.type === "Identifier")
|
|
18
|
+
return expression.name === "UseGuards" || aliases.get(expression.name) === "UseGuards";
|
|
18
19
|
if (expression.type === "MemberExpression" && !expression.computed && expression.property.type === "Identifier") {
|
|
19
|
-
return expression.property.name === "UseGuards" && expression.object.type === "Identifier" && aliases.get(expression.object.name) === "*"
|
|
20
|
+
return expression.property.name === "UseGuards" && expression.object.type === "Identifier" && aliases.get(expression.object.name) === "*";
|
|
20
21
|
}
|
|
21
|
-
return false
|
|
22
|
-
}
|
|
23
|
-
|
|
22
|
+
return false;
|
|
23
|
+
};
|
|
24
24
|
/** No route picks its own guard: the global APP_GUARD chain decides. */
|
|
25
25
|
export const noAuthUseGuards = {
|
|
26
26
|
meta: {
|
|
@@ -28,60 +28,56 @@ export const noAuthUseGuards = {
|
|
|
28
28
|
docs: { description: "`@UseGuards(...)` is not used: authentication and authorization are the global APP_GUARD chain." },
|
|
29
29
|
schema: [],
|
|
30
30
|
messages: {
|
|
31
|
-
useGuards:
|
|
32
|
-
"`@UseGuards(...)` picks a guard per door, so a door can forget it. Authentication and authorization are the global `APP_GUARD` chain of the app; delete this decorator, and open a door only with `@Public({ reason: PublicReason.X })`.",
|
|
31
|
+
useGuards: "`@UseGuards(...)` picks a guard per door, so a door can forget it. Authentication and authorization are the global `APP_GUARD` chain of the app; delete this decorator, and open a door only with `@Public({ reason: PublicReason.X })`.",
|
|
33
32
|
},
|
|
34
33
|
},
|
|
35
34
|
create(context) {
|
|
36
|
-
let aliases = new Map()
|
|
35
|
+
let aliases = new Map();
|
|
37
36
|
return {
|
|
38
37
|
Program(node) {
|
|
39
|
-
aliases = importsFrom(node, () => true)
|
|
38
|
+
aliases = importsFrom(node, () => true);
|
|
40
39
|
},
|
|
41
40
|
Decorator(node) {
|
|
42
|
-
if (isUseGuards(node, aliases))
|
|
41
|
+
if (isUseGuards(node, aliases))
|
|
42
|
+
context.report({ node, messageId: "useGuards" });
|
|
43
43
|
},
|
|
44
|
-
}
|
|
44
|
+
};
|
|
45
45
|
},
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const GUARD_NAME = /Guard$/
|
|
49
|
-
|
|
46
|
+
};
|
|
47
|
+
const GUARD_NAME = /Guard$/;
|
|
50
48
|
/** The identifier a type reference or expression ends in, or undefined. */
|
|
51
49
|
const nameOf = (node) => {
|
|
52
|
-
if (node === undefined || node === null)
|
|
53
|
-
|
|
54
|
-
if (node.type === "
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
if (node === undefined || node === null)
|
|
51
|
+
return undefined;
|
|
52
|
+
if (node.type === "Identifier")
|
|
53
|
+
return node.name;
|
|
54
|
+
if (node.type === "TSQualifiedName")
|
|
55
|
+
return node.right.name;
|
|
56
|
+
if (node.type === "MemberExpression" && !node.computed)
|
|
57
|
+
return node.property.name;
|
|
58
|
+
return undefined;
|
|
59
|
+
};
|
|
59
60
|
/** True when the class is a guard: it implements CanActivate or is named `...Guard`. */
|
|
60
|
-
const isGuardClass = (node) =>
|
|
61
|
-
GUARD_NAME.test(node.id?.name ?? "") || (node.implements ?? []).some((item) => nameOf(item.expression) === "CanActivate")
|
|
62
|
-
|
|
61
|
+
const isGuardClass = (node) => GUARD_NAME.test(node.id?.name ?? "") || (node.implements ?? []).some((item) => nameOf(item.expression) === "CanActivate");
|
|
63
62
|
/** True when the type mentions CanActivate or a `...Guard` class, directly or as `Type<...>` / a union member. */
|
|
64
63
|
const namesGuardType = (type) => {
|
|
65
|
-
if (type === undefined || type === null)
|
|
64
|
+
if (type === undefined || type === null)
|
|
65
|
+
return false;
|
|
66
66
|
if (type.type === "TSTypeReference") {
|
|
67
|
-
const name = nameOf(type.typeName)
|
|
68
|
-
if (name === "CanActivate" || GUARD_NAME.test(name ?? ""))
|
|
69
|
-
|
|
67
|
+
const name = nameOf(type.typeName);
|
|
68
|
+
if (name === "CanActivate" || GUARD_NAME.test(name ?? ""))
|
|
69
|
+
return true;
|
|
70
|
+
const legacy = Reflect.get(type, "typeParameters");
|
|
71
|
+
return (type.typeArguments ?? (isNode(legacy) && legacy.type === "TSTypeParameterInstantiation" ? legacy : undefined))?.params?.some(namesGuardType) ?? false;
|
|
70
72
|
}
|
|
71
|
-
if (type.type === "TSUnionType" || type.type === "TSIntersectionType")
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const parameterOf = (parameter) => (parameter.type === "TSParameterProperty" ? parameter.parameter : parameter)
|
|
76
|
-
|
|
73
|
+
if (type.type === "TSUnionType" || type.type === "TSIntersectionType")
|
|
74
|
+
return type.types.some(namesGuardType);
|
|
75
|
+
return false;
|
|
76
|
+
};
|
|
77
|
+
const parameterOf = (parameter) => (parameter.type === "TSParameterProperty" ? parameter.parameter : parameter);
|
|
77
78
|
/** True when an `@Inject(SomeGuard)` style decorator names a guard class. */
|
|
78
|
-
const injectsGuardToken = (parameter) =>
|
|
79
|
-
(
|
|
80
|
-
(decorator) =>
|
|
81
|
-
decorator.expression.type === "CallExpression" &&
|
|
82
|
-
decorator.expression.arguments.some((argument) => GUARD_NAME.test(nameOf(argument) ?? "")),
|
|
83
|
-
)
|
|
84
|
-
|
|
79
|
+
const injectsGuardToken = (parameter) => (parameter.decorators ?? []).some((decorator) => decorator.expression.type === "CallExpression" &&
|
|
80
|
+
decorator.expression.arguments.some((argument) => GUARD_NAME.test(nameOf(argument) ?? "")));
|
|
85
81
|
/** A guard never calls, extends or receives another guard: the app registers each one as its own APP_GUARD. */
|
|
86
82
|
export const noGuardInjectsGuard = {
|
|
87
83
|
meta: {
|
|
@@ -89,34 +85,32 @@ export const noGuardInjectsGuard = {
|
|
|
89
85
|
docs: { description: "A guard class has no constructor parameter that is another guard (no CanActivate-typed parameter)." },
|
|
90
86
|
schema: [],
|
|
91
87
|
messages: {
|
|
92
|
-
guardInGuard:
|
|
93
|
-
"A guard must not inject another guard (found a `{{name}}` constructor parameter). Each guard is its own global `APP_GUARD` in the fixed order RateLimitGuard, OriginGuard, CredentialGuard, AuthGuard; share logic through a service or a port, and let metadata (`@Credential`, `@Public`) select the behavior.",
|
|
88
|
+
guardInGuard: "A guard must not inject another guard (found a `{{name}}` constructor parameter). Each guard is its own global `APP_GUARD` in the fixed order RateLimitGuard, OriginGuard, CredentialGuard, AuthGuard; share logic through a service or a port, and let metadata (`@Credential`, `@Public`) select the behavior.",
|
|
94
89
|
},
|
|
95
90
|
},
|
|
96
91
|
create(context) {
|
|
97
92
|
const check = (node) => {
|
|
98
|
-
if (!isGuardClass(node))
|
|
99
|
-
|
|
93
|
+
if (!isGuardClass(node))
|
|
94
|
+
return;
|
|
95
|
+
const constructor = node.body.body.find((member) => member.type === "MethodDefinition" && member.kind === "constructor");
|
|
100
96
|
for (const raw of constructor?.value.params ?? []) {
|
|
101
|
-
const parameter = parameterOf(raw)
|
|
102
|
-
const annotation = parameter.typeAnnotation?.typeAnnotation
|
|
97
|
+
const parameter = parameterOf(raw);
|
|
98
|
+
const annotation = parameter.typeAnnotation?.typeAnnotation;
|
|
103
99
|
if (namesGuardType(annotation) || injectsGuardToken(raw) || injectsGuardToken(parameter)) {
|
|
104
|
-
context.report({ node: raw, messageId: "guardInGuard", data: { name: parameter.name ?? "guard" } })
|
|
100
|
+
context.report({ node: raw, messageId: "guardInGuard", data: { name: ("name" in parameter ? parameter.name : undefined) ?? "guard" } });
|
|
105
101
|
}
|
|
106
102
|
}
|
|
107
|
-
}
|
|
108
|
-
return { ClassDeclaration: check, ClassExpression: check }
|
|
103
|
+
};
|
|
104
|
+
return { ClassDeclaration: check, ClassExpression: check };
|
|
109
105
|
},
|
|
110
|
-
}
|
|
111
|
-
|
|
106
|
+
};
|
|
112
107
|
/** Every rule this module ships, by the name a config switches it on under. */
|
|
113
108
|
export const rules = {
|
|
114
109
|
"no-auth-use-guards": noAuthUseGuards,
|
|
115
110
|
"no-guard-injects-guard": noGuardInjectsGuard,
|
|
116
|
-
}
|
|
117
|
-
|
|
111
|
+
};
|
|
118
112
|
/** The level a consuming repository switches this on at. */
|
|
119
113
|
export const recommended = {
|
|
120
114
|
"starci-be/no-auth-use-guards": "error",
|
|
121
115
|
"starci-be/no-guard-injects-guard": "error",
|
|
122
|
-
}
|
|
116
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Recommended, RuleModule } from "./lib/rule.js";
|
|
2
|
+
/** Every schema built by this file is bounded and none accepts anything. */
|
|
3
|
+
export declare const schemaBounded: RuleModule;
|
|
4
|
+
/** Where a schema may live, and what shares a file with it. */
|
|
5
|
+
export declare const schemaPlace: RuleModule;
|
|
6
|
+
/** What a schema file holds: zod values and types, nothing that runs. */
|
|
7
|
+
export declare const schemaFileValuesOnly: RuleModule;
|
|
8
|
+
/** The rules this law contributes to the plugin. */
|
|
9
|
+
export declare const rules: {
|
|
10
|
+
"schema-bounded": RuleModule;
|
|
11
|
+
"schema-place": RuleModule;
|
|
12
|
+
"schema-file-values-only": RuleModule;
|
|
13
|
+
};
|
|
14
|
+
/** Both start at error: no baseline exists. */
|
|
15
|
+
export declare const recommended: Recommended;
|
|
@@ -14,73 +14,75 @@
|
|
|
14
14
|
* `z.unknown()` and `z.json()` are refused: an unbounded array whose elements all fail validation allocates an issue each
|
|
15
15
|
* (GHSA-mrhx-c7xc-m3w5), and an unbounded string is an unbounded cost whatever the zod version.
|
|
16
16
|
*/
|
|
17
|
-
import { hfsOf } from "./lib/hfs.
|
|
18
|
-
import { normalizePath } from "./lib/path.
|
|
19
|
-
import { isTransportSlot } from "./lib/transport-slots.
|
|
20
|
-
import { SCHEMA_TIERS, schemaFileProblems } from "./lib/schema-values.
|
|
21
|
-
|
|
22
|
-
const ZOD = /^zod(?:\/|$)/
|
|
17
|
+
import { hfsOf } from "./lib/hfs.js";
|
|
18
|
+
import { normalizePath } from "./lib/path.js";
|
|
19
|
+
import { isTransportSlot } from "./lib/transport-slots.js";
|
|
20
|
+
import { SCHEMA_TIERS, schemaFileProblems } from "./lib/schema-values.js";
|
|
21
|
+
const ZOD = /^zod(?:\/|$)/;
|
|
23
22
|
/** The imports of the other validation layer, which never share a file with a schema. */
|
|
24
|
-
const MIXED = new Set(["class-validator", "class-transformer", "@nestjs/graphql"])
|
|
25
|
-
const SCHEMA_FILE = /\.schema(?:\.spec)?\.ts
|
|
26
|
-
|
|
23
|
+
const MIXED = new Set(["class-validator", "class-transformer", "@nestjs/graphql"]);
|
|
24
|
+
const SCHEMA_FILE = /\.schema(?:\.spec)?\.ts$/;
|
|
27
25
|
/** Constructors that build a string-valued schema and owe a `.max(n)` or `.length(n)`. */
|
|
28
|
-
const STRINGY = new Set(["string", "email", "url", "httpUrl", "hostname", "base64", "base64url", "jwt", "emoji", "hex", "iso.datetime", "iso.date", "iso.time", "iso.duration"])
|
|
26
|
+
const STRINGY = new Set(["string", "email", "url", "httpUrl", "hostname", "base64", "base64url", "jwt", "emoji", "hex", "iso.datetime", "iso.date", "iso.time", "iso.duration"]);
|
|
29
27
|
/** The ISO namespace constructs strings; `z.date()` instead constructs a Date-valued schema. */
|
|
30
|
-
const ISO_STRINGY = new Set(["datetime", "date", "time", "duration"])
|
|
28
|
+
const ISO_STRINGY = new Set(["datetime", "date", "time", "duration"]);
|
|
31
29
|
/** Constructors that build a counted container: bounded by `.max(n)`, `.length(n)` or `.size(n)`. */
|
|
32
|
-
const COUNTED = new Set(["array", "set"])
|
|
30
|
+
const COUNTED = new Set(["array", "set"]);
|
|
33
31
|
/** Constructors whose entry count only a refinement can bound. */
|
|
34
|
-
const REFINED = new Set(["record", "looseRecord", "partialRecord", "map"])
|
|
32
|
+
const REFINED = new Set(["record", "looseRecord", "partialRecord", "map"]);
|
|
35
33
|
/** Constructors that accept anything: refused outright. */
|
|
36
|
-
const OPEN = new Set(["any", "unknown", "json"])
|
|
34
|
+
const OPEN = new Set(["any", "unknown", "json"]);
|
|
37
35
|
/** The chain members that bound a string or a counted container. */
|
|
38
|
-
const BOUNDING = new Set(["max", "length", "size"])
|
|
39
|
-
const REFINING = new Set(["refine", "superRefine", "check"])
|
|
40
|
-
|
|
36
|
+
const BOUNDING = new Set(["max", "length", "size"]);
|
|
37
|
+
const REFINING = new Set(["refine", "superRefine", "check"]);
|
|
41
38
|
/** The member names a `z.coerce.string()` style callee passes through before its constructor. */
|
|
42
|
-
const PASS_THROUGH = new Set(["coerce"])
|
|
43
|
-
|
|
39
|
+
const PASS_THROUGH = new Set(["coerce"]);
|
|
44
40
|
/** True for a bound argument that is not a way to say "no bound": absent, `Infinity`, `NaN`, a non-positive literal, `Number.MAX_*`. */
|
|
45
41
|
const isRealBound = (argument) => {
|
|
46
|
-
if (argument === undefined)
|
|
47
|
-
|
|
48
|
-
if (argument.type === "
|
|
42
|
+
if (argument === undefined)
|
|
43
|
+
return false;
|
|
44
|
+
if (argument.type === "Identifier")
|
|
45
|
+
return argument.name !== "Infinity" && argument.name !== "NaN" && argument.name !== "undefined";
|
|
46
|
+
if (argument.type === "Literal")
|
|
47
|
+
return typeof argument.value === "number" && Number.isFinite(argument.value) && argument.value > 0;
|
|
49
48
|
if (argument.type === "MemberExpression" && !argument.computed && argument.object.type === "Identifier" && argument.object.name === "Number") {
|
|
50
|
-
return !/^(?:MAX_|POSITIVE_INFINITY)/.test(argument.property.name ?? "")
|
|
49
|
+
return !/^(?:MAX_|POSITIVE_INFINITY)/.test(argument.property.name ?? "");
|
|
51
50
|
}
|
|
52
|
-
return true
|
|
53
|
-
}
|
|
54
|
-
|
|
51
|
+
return true;
|
|
52
|
+
};
|
|
55
53
|
/** The methods chained on `node` (`z.string().trim().max(5)` gives `trim`, `max` with their calls), outermost last. */
|
|
56
54
|
const chainOf = (node) => {
|
|
57
|
-
const calls = []
|
|
58
|
-
let current = node
|
|
55
|
+
const calls = [];
|
|
56
|
+
let current = node;
|
|
59
57
|
for (;;) {
|
|
60
|
-
const member = current.parent
|
|
61
|
-
if (member?.type !== "MemberExpression" || member.object !== current || member.computed || member.property.type !== "Identifier")
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
const member = current.parent;
|
|
59
|
+
if (member?.type !== "MemberExpression" || member.object !== current || member.computed || member.property.type !== "Identifier")
|
|
60
|
+
break;
|
|
61
|
+
const call = member.parent;
|
|
62
|
+
if (call?.type !== "CallExpression" || call.callee !== member)
|
|
63
|
+
break;
|
|
64
|
+
calls.push({ name: member.property.name, call });
|
|
65
|
+
current = call;
|
|
66
66
|
}
|
|
67
|
-
return calls
|
|
68
|
-
}
|
|
69
|
-
|
|
67
|
+
return calls;
|
|
68
|
+
};
|
|
70
69
|
/** Resolves a zod constructor, including `z.iso.datetime()` and a renamed named import of `iso`. */
|
|
71
70
|
const constructorOf = (callee, namespaces, named) => {
|
|
72
|
-
if (callee.type === "Identifier")
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
if (callee.type === "Identifier")
|
|
72
|
+
return named.get(callee.name) ?? null;
|
|
73
|
+
if (callee.type !== "MemberExpression" || callee.computed || callee.property.type !== "Identifier")
|
|
74
|
+
return null;
|
|
75
|
+
let object = callee.object;
|
|
75
76
|
if (ISO_STRINGY.has(callee.property.name)) {
|
|
76
|
-
const importedIso = object.type === "Identifier" && named.get(object.name) === "iso"
|
|
77
|
-
const namespaceIso = object.type === "MemberExpression" && !object.computed && object.property.type === "Identifier" && object.property.name === "iso" && object.object.type === "Identifier" && namespaces.has(object.object.name)
|
|
78
|
-
if (importedIso || namespaceIso)
|
|
77
|
+
const importedIso = object.type === "Identifier" && named.get(object.name) === "iso";
|
|
78
|
+
const namespaceIso = object.type === "MemberExpression" && !object.computed && object.property.type === "Identifier" && object.property.name === "iso" && object.object.type === "Identifier" && namespaces.has(object.object.name);
|
|
79
|
+
if (importedIso || namespaceIso)
|
|
80
|
+
return `iso.${callee.property.name}`;
|
|
79
81
|
}
|
|
80
|
-
while (object.type === "MemberExpression" && !object.computed && object.property.type === "Identifier" && PASS_THROUGH.has(object.property.name))
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
while (object.type === "MemberExpression" && !object.computed && object.property.type === "Identifier" && PASS_THROUGH.has(object.property.name))
|
|
83
|
+
object = object.object;
|
|
84
|
+
return object.type === "Identifier" && namespaces.has(object.name) ? callee.property.name : null;
|
|
85
|
+
};
|
|
84
86
|
/** Every schema built by this file is bounded and none accepts anything. */
|
|
85
87
|
export const schemaBounded = {
|
|
86
88
|
meta: {
|
|
@@ -96,63 +98,71 @@ export const schemaBounded = {
|
|
|
96
98
|
},
|
|
97
99
|
},
|
|
98
100
|
create(context) {
|
|
99
|
-
const namespaces = new Set()
|
|
100
|
-
const named = new Map()
|
|
101
|
+
const namespaces = new Set();
|
|
102
|
+
const named = new Map();
|
|
101
103
|
return {
|
|
102
104
|
ImportDeclaration(node) {
|
|
103
|
-
if (typeof node.source.value !== "string" || !ZOD.test(node.source.value))
|
|
105
|
+
if (typeof node.source.value !== "string" || !ZOD.test(node.source.value))
|
|
106
|
+
return;
|
|
104
107
|
for (const specifier of node.specifiers) {
|
|
105
|
-
if (specifier.type === "ImportNamespaceSpecifier")
|
|
108
|
+
if (specifier.type === "ImportNamespaceSpecifier")
|
|
109
|
+
namespaces.add(specifier.local.name);
|
|
106
110
|
else if (specifier.type === "ImportSpecifier") {
|
|
107
|
-
const imported = specifier.imported.type === "Identifier" ? specifier.imported.name : String(specifier.imported.value)
|
|
108
|
-
if (imported === "z")
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
const imported = specifier.imported.type === "Identifier" ? specifier.imported.name : String(specifier.imported.value);
|
|
112
|
+
if (imported === "z")
|
|
113
|
+
namespaces.add(specifier.local.name);
|
|
114
|
+
else
|
|
115
|
+
named.set(specifier.local.name, imported);
|
|
116
|
+
}
|
|
117
|
+
else if (specifier.type === "ImportDefaultSpecifier")
|
|
118
|
+
namespaces.add(specifier.local.name);
|
|
111
119
|
}
|
|
112
120
|
},
|
|
113
121
|
CallExpression(node) {
|
|
114
|
-
const name = constructorOf(node.callee, namespaces, named)
|
|
115
|
-
if (name === null)
|
|
122
|
+
const name = constructorOf(node.callee, namespaces, named);
|
|
123
|
+
if (name === null)
|
|
124
|
+
return;
|
|
116
125
|
if (OPEN.has(name)) {
|
|
117
|
-
context.report({ node, messageId: "open", data: { name } })
|
|
118
|
-
return
|
|
126
|
+
context.report({ node, messageId: "open", data: { name } });
|
|
127
|
+
return;
|
|
119
128
|
}
|
|
120
|
-
const kind = STRINGY.has(name) ? "string" : COUNTED.has(name) ? "counted" : REFINED.has(name) ? "refined" : null
|
|
121
|
-
if (kind === null)
|
|
122
|
-
|
|
129
|
+
const kind = STRINGY.has(name) ? "string" : COUNTED.has(name) ? "counted" : REFINED.has(name) ? "refined" : null;
|
|
130
|
+
if (kind === null)
|
|
131
|
+
return;
|
|
132
|
+
const chain = chainOf(node);
|
|
123
133
|
if (kind === "refined") {
|
|
124
|
-
if (!chain.some((entry) => REFINING.has(entry.name)))
|
|
125
|
-
|
|
134
|
+
if (!chain.some((entry) => REFINING.has(entry.name)))
|
|
135
|
+
context.report({ node, messageId: "refined", data: { name } });
|
|
136
|
+
return;
|
|
126
137
|
}
|
|
127
|
-
const bounds = chain.filter((entry) => BOUNDING.has(entry.name))
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
138
|
+
const bounds = chain.filter((entry) => BOUNDING.has(entry.name));
|
|
139
|
+
const [first] = bounds;
|
|
140
|
+
if (!first) {
|
|
141
|
+
context.report({ node, messageId: kind, data: { name } });
|
|
142
|
+
return;
|
|
131
143
|
}
|
|
132
|
-
if (!bounds.some((entry) => isRealBound(entry.call.arguments[0])))
|
|
144
|
+
if (!bounds.some((entry) => isRealBound(entry.call.arguments[0])))
|
|
145
|
+
context.report({ node: first.call, messageId: "bound", data: { name: first.name } });
|
|
133
146
|
},
|
|
134
|
-
}
|
|
147
|
+
};
|
|
135
148
|
},
|
|
136
|
-
}
|
|
137
|
-
|
|
149
|
+
};
|
|
138
150
|
/** The module specifiers a file references, with the node that names each (imports, re-exports, `import()` and `require()`). */
|
|
139
151
|
const referenceNodes = (node) => {
|
|
140
152
|
switch (node.type) {
|
|
141
153
|
case "ImportDeclaration":
|
|
142
154
|
case "ExportAllDeclaration":
|
|
143
155
|
case "ExportNamedDeclaration":
|
|
144
|
-
return node.source ? [node.source] : []
|
|
156
|
+
return node.source ? [node.source] : [];
|
|
145
157
|
case "ImportExpression":
|
|
146
|
-
return [node.source]
|
|
158
|
+
return [node.source];
|
|
147
159
|
case "CallExpression":
|
|
148
|
-
return node.callee.type === "Identifier" && node.callee.name === "require" && node.arguments[0] ? [node.arguments[0]] : []
|
|
160
|
+
return node.callee.type === "Identifier" && node.callee.name === "require" && node.arguments[0] ? [node.arguments[0]] : [];
|
|
149
161
|
default:
|
|
150
|
-
return []
|
|
162
|
+
return [];
|
|
151
163
|
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const referencesZod = (node) => referenceNodes(node).filter((source) => source.type === "Literal" && typeof source.value === "string" && ZOD.test(source.value))
|
|
155
|
-
|
|
164
|
+
};
|
|
165
|
+
const referencesZod = (node) => referenceNodes(node).filter((source) => source.type === "Literal" && typeof source.value === "string" && ZOD.test(source.value));
|
|
156
166
|
/** Where a schema may live, and what shares a file with it. */
|
|
157
167
|
export const schemaPlace = {
|
|
158
168
|
meta: {
|
|
@@ -167,29 +177,34 @@ export const schemaPlace = {
|
|
|
167
177
|
},
|
|
168
178
|
},
|
|
169
179
|
create(context) {
|
|
170
|
-
const hfs = hfsOf(context)
|
|
171
|
-
const filename = normalizePath(context.filename)
|
|
172
|
-
const slot = hfs.slotOf(filename) ?? ""
|
|
173
|
-
const tier = hfs.tierOf(filename)
|
|
174
|
-
const inDoor = isTransportSlot(slot) || slot.startsWith("be.transport.") || hfs.relative(filename).split("/").slice(0, -1).includes("dto")
|
|
175
|
-
const isSchemaFile = SCHEMA_FILE.test(filename)
|
|
180
|
+
const hfs = hfsOf(context);
|
|
181
|
+
const filename = normalizePath(context.filename);
|
|
182
|
+
const slot = hfs.slotOf(filename) ?? "";
|
|
183
|
+
const tier = hfs.tierOf(filename);
|
|
184
|
+
const inDoor = isTransportSlot(slot) || slot.startsWith("be.transport.") || hfs.relative(filename).split("/").slice(0, -1).includes("dto");
|
|
185
|
+
const isSchemaFile = SCHEMA_FILE.test(filename);
|
|
176
186
|
return {
|
|
177
187
|
"*"(node) {
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
else if (
|
|
188
|
+
const [first] = referencesZod(node);
|
|
189
|
+
if (!first)
|
|
190
|
+
return;
|
|
191
|
+
if (inDoor)
|
|
192
|
+
context.report({ node: first, messageId: "door" });
|
|
193
|
+
else if (tier === "feature")
|
|
194
|
+
context.report({ node: first, messageId: "tier", data: { tier } });
|
|
195
|
+
else if (!isSchemaFile)
|
|
196
|
+
context.report({ node: first, messageId: "file" });
|
|
197
|
+
else if (!SCHEMA_TIERS.has(tier))
|
|
198
|
+
context.report({ node: first, messageId: "tier", data: { tier: tier ?? "non-owner" } });
|
|
184
199
|
},
|
|
185
200
|
ImportDeclaration(node) {
|
|
186
|
-
if (!isSchemaFile || inDoor || !MIXED.has(node.source.value))
|
|
187
|
-
|
|
201
|
+
if (!isSchemaFile || inDoor || !MIXED.has(node.source.value))
|
|
202
|
+
return;
|
|
203
|
+
context.report({ node: node.source, messageId: "mixed", data: { source: node.source.value } });
|
|
188
204
|
},
|
|
189
|
-
}
|
|
205
|
+
};
|
|
190
206
|
},
|
|
191
|
-
}
|
|
192
|
-
|
|
207
|
+
};
|
|
193
208
|
/** What a schema file holds: zod values and types, nothing that runs. */
|
|
194
209
|
export const schemaFileValuesOnly = {
|
|
195
210
|
meta: {
|
|
@@ -201,25 +216,25 @@ export const schemaFileValuesOnly = {
|
|
|
201
216
|
},
|
|
202
217
|
},
|
|
203
218
|
create(context) {
|
|
204
|
-
if (!SCHEMA_FILE.test(normalizePath(context.filename)) || context.filename.endsWith(".spec.ts"))
|
|
219
|
+
if (!SCHEMA_FILE.test(normalizePath(context.filename)) || context.filename.endsWith(".spec.ts"))
|
|
220
|
+
return {};
|
|
205
221
|
return {
|
|
206
222
|
"Program:exit"(node) {
|
|
207
|
-
for (const problem of schemaFileProblems(context.sourceCode.text))
|
|
223
|
+
for (const problem of schemaFileProblems(context.sourceCode.text))
|
|
224
|
+
context.report({ node, messageId: "logic", data: { problem } });
|
|
208
225
|
},
|
|
209
|
-
}
|
|
226
|
+
};
|
|
210
227
|
},
|
|
211
|
-
}
|
|
212
|
-
|
|
228
|
+
};
|
|
213
229
|
/** The rules this law contributes to the plugin. */
|
|
214
230
|
export const rules = {
|
|
215
231
|
"schema-bounded": schemaBounded,
|
|
216
232
|
"schema-place": schemaPlace,
|
|
217
233
|
"schema-file-values-only": schemaFileValuesOnly,
|
|
218
|
-
}
|
|
219
|
-
|
|
234
|
+
};
|
|
220
235
|
/** Both start at error: no baseline exists. */
|
|
221
236
|
export const recommended = {
|
|
222
237
|
"starci-be/schema-bounded": "error",
|
|
223
238
|
"starci-be/schema-place": "error",
|
|
224
239
|
"starci-be/schema-file-values-only": "error",
|
|
225
|
-
}
|
|
240
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Recommended, RuleModule } from "./lib/rule.js";
|
|
2
|
+
/** A spec arranges rows through a builder, never by writing them itself. */
|
|
3
|
+
export declare const specNoRawInsert: RuleModule;
|
|
4
|
+
/** A spec builds each persistence entity as an object literal at most once; further rows come from a builder. */
|
|
5
|
+
export declare const specNoRepeatedRowLiteral: RuleModule;
|
|
6
|
+
/** A module of the test tree that exports something creating persisted rows is a builder and lives in the builders slot. */
|
|
7
|
+
export declare const persistingBuilderInBuildersSlot: RuleModule;
|
|
8
|
+
/** A builder arranges data only: no assertion, deterministic defaults. */
|
|
9
|
+
export declare const builderArrangesOnly: RuleModule;
|
|
10
|
+
/** The test tree keeps every database constraint on. */
|
|
11
|
+
export declare const testsKeepConstraints: RuleModule;
|
|
12
|
+
/** The rules this law contributes to the plugin. */
|
|
13
|
+
export declare const rules: {
|
|
14
|
+
"persisting-builder-in-builders-slot": RuleModule;
|
|
15
|
+
"spec-no-raw-insert": RuleModule;
|
|
16
|
+
"spec-no-repeated-row-literal": RuleModule;
|
|
17
|
+
"builder-arranges-only": RuleModule;
|
|
18
|
+
"tests-keep-constraints": RuleModule;
|
|
19
|
+
};
|
|
20
|
+
/** Every rule of this law ships at `error`. */
|
|
21
|
+
export declare const recommended: Recommended;
|