@starci/eslint-canon-be 3.5.0 → 3.6.1
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 +21 -0
- package/README.md +13 -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-view.d.ts +127 -0
- package/dist/lib/hfs-view.js +1 -0
- 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 +23 -8
- package/runtime/knowledge/hfs/canon-pins.yaml +18 -11
- package/runtime/scripts/hfs/repo-identity.mjs +5 -4
- 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
package/{cli.mjs → dist/cli.js}
RENAMED
|
@@ -17,22 +17,19 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Where a file lives is asked of the slot view; what a name IS comes from the import that binds it. No path pattern is spelled here.
|
|
19
19
|
*/
|
|
20
|
-
import { hfsOf } from "./lib/hfs.
|
|
21
|
-
import { decoratorCallee, importOf, isImportedFrom, moduleReferences } from "./lib/import-source.
|
|
22
|
-
|
|
20
|
+
import { hfsOf } from "./lib/hfs.js";
|
|
21
|
+
import { decoratorCallee, importOf, isImportedFrom, moduleReferences } from "./lib/import-source.js";
|
|
23
22
|
/** The slot of the cli app and of the cli feature root. */
|
|
24
|
-
const CLI_APP_SLOT = "be.app.cli"
|
|
25
|
-
const CLI_FEATURE_SLOT = "be.cli"
|
|
26
|
-
const COMMANDER = "nest-commander"
|
|
23
|
+
const CLI_APP_SLOT = "be.app.cli";
|
|
24
|
+
const CLI_FEATURE_SLOT = "be.cli";
|
|
25
|
+
const COMMANDER = "nest-commander";
|
|
27
26
|
/** The argument parsers no back-end source imports: nest-commander (in the cli app and feature only) parses the arguments. */
|
|
28
|
-
const FOREIGN_PARSERS = new Set(["commander", "yargs", "yargs/yargs", "yargs/helpers", "minimist"])
|
|
27
|
+
const FOREIGN_PARSERS = new Set(["commander", "yargs", "yargs/yargs", "yargs/helpers", "minimist"]);
|
|
29
28
|
/** The entry file of an app (the slot's first requirement): where the cli app boots. */
|
|
30
|
-
const ENTRY = "main.ts"
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const isCliFeature = (hfs, file) => hfs.slotOf(file) === CLI_FEATURE_SLOT
|
|
35
|
-
|
|
29
|
+
const ENTRY = "main.ts";
|
|
30
|
+
const relativeIn = (hfs, file) => hfs.allows(file)?.relative ?? null;
|
|
31
|
+
const isCliApp = (hfs, file) => hfs.slotOf(file) === CLI_APP_SLOT;
|
|
32
|
+
const isCliFeature = (hfs, file) => hfs.slotOf(file) === CLI_FEATURE_SLOT;
|
|
36
33
|
/** The cli app boots with CommandFactory.run and never serves HTTP or a microservice. */
|
|
37
34
|
export const cliBootstrap = {
|
|
38
35
|
meta: {
|
|
@@ -45,49 +42,58 @@ export const cliBootstrap = {
|
|
|
45
42
|
},
|
|
46
43
|
},
|
|
47
44
|
create(context) {
|
|
48
|
-
const hfs = hfsOf(context)
|
|
49
|
-
const filename = context.filename
|
|
50
|
-
if (!isCliApp(hfs, filename))
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
const hfs = hfsOf(context);
|
|
46
|
+
const filename = context.filename;
|
|
47
|
+
if (!isCliApp(hfs, filename))
|
|
48
|
+
return {};
|
|
49
|
+
const entry = relativeIn(hfs, filename) === ENTRY;
|
|
50
|
+
let boots = false;
|
|
53
51
|
return {
|
|
54
52
|
...moduleReferences(({ source, value }) => {
|
|
55
|
-
if (value === "@nestjs/microservices" || value.startsWith("@nestjs/platform-"))
|
|
53
|
+
if (value === "@nestjs/microservices" || value.startsWith("@nestjs/platform-"))
|
|
54
|
+
context.report({ node: source, messageId: "server", data: { name: value } });
|
|
56
55
|
}),
|
|
57
56
|
CallExpression(node) {
|
|
58
|
-
const callee = node.callee
|
|
59
|
-
if (callee.type !== "MemberExpression" || callee.computed || callee.property.type !== "Identifier")
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (isImportedFrom(context, callee.object,
|
|
63
|
-
|
|
57
|
+
const callee = node.callee;
|
|
58
|
+
if (callee.type !== "MemberExpression" || callee.computed || callee.property.type !== "Identifier")
|
|
59
|
+
return;
|
|
60
|
+
const method = callee.property.name;
|
|
61
|
+
if (method === "run" && isImportedFrom(context, callee.object, COMMANDER, "CommandFactory"))
|
|
62
|
+
boots = true;
|
|
63
|
+
if (isImportedFrom(context, callee.object, "@nestjs/core", "NestFactory"))
|
|
64
|
+
context.report({ node, messageId: "server", data: { name: `NestFactory.${method}` } });
|
|
65
|
+
else if (method === "listen" || method === "connectMicroservice" || method === "startAllMicroservices")
|
|
66
|
+
context.report({ node, messageId: "server", data: { name: `.${method}()` } });
|
|
64
67
|
},
|
|
65
68
|
"Program:exit"(program) {
|
|
66
|
-
if (entry && !boots)
|
|
69
|
+
if (entry && !boots)
|
|
70
|
+
context.report({ node: program, messageId: "missing" });
|
|
67
71
|
},
|
|
68
|
-
}
|
|
72
|
+
};
|
|
69
73
|
},
|
|
70
|
-
}
|
|
71
|
-
|
|
74
|
+
};
|
|
72
75
|
/** The nest-commander decorator a class carries (Command or SubCommand), by the import that binds it. */
|
|
73
76
|
const commanderDecorator = (context, klass) => {
|
|
74
77
|
for (const decorator of klass.decorators ?? []) {
|
|
75
|
-
const callee = decoratorCallee(decorator)
|
|
76
|
-
if (callee?.type !== "Identifier")
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
const callee = decoratorCallee(decorator);
|
|
79
|
+
if (callee?.type !== "Identifier")
|
|
80
|
+
continue;
|
|
81
|
+
const bound = importOf(context, callee);
|
|
82
|
+
if (bound?.source === COMMANDER && (bound.imported === "Command" || bound.imported === "SubCommand"))
|
|
83
|
+
return { decorator, kind: bound.imported };
|
|
79
84
|
}
|
|
80
|
-
return null
|
|
81
|
-
}
|
|
82
|
-
|
|
85
|
+
return null;
|
|
86
|
+
};
|
|
83
87
|
/** Where a command of each kind is declared in the cli feature root: `<group>/<group>.cli.ts` or `<group>/subs/<name>.cli.ts`. */
|
|
84
88
|
const placeOf = (relative) => {
|
|
85
|
-
const parts = String(relative ?? "").split("/")
|
|
86
|
-
if (parts.length === 2 && parts[1] === `${parts[0]}.cli.ts`)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const parts = String(relative ?? "").split("/");
|
|
90
|
+
if (parts.length === 2 && parts[1] === `${parts[0]}.cli.ts`)
|
|
91
|
+
return "Command";
|
|
92
|
+
const leaf = parts[2];
|
|
93
|
+
if (parts.length === 3 && parts[1] === "subs" && leaf !== undefined && leaf.endsWith(".cli.ts") && !leaf.endsWith(".spec.ts"))
|
|
94
|
+
return "SubCommand";
|
|
95
|
+
return null;
|
|
96
|
+
};
|
|
91
97
|
/** A nest-commander command is declared only where the cli feature root keeps it, one per file, a sub-command a CommandRunner. */
|
|
92
98
|
export const cliCommandShape = {
|
|
93
99
|
meta: {
|
|
@@ -102,40 +108,47 @@ export const cliCommandShape = {
|
|
|
102
108
|
},
|
|
103
109
|
},
|
|
104
110
|
create(context) {
|
|
105
|
-
const hfs = hfsOf(context)
|
|
106
|
-
const filename = context.filename
|
|
107
|
-
const slot = hfs.slotOf(filename)
|
|
108
|
-
const place = isCliFeature(hfs, filename) ? placeOf(relativeIn(hfs, filename)) : null
|
|
109
|
-
let commands = 0
|
|
111
|
+
const hfs = hfsOf(context);
|
|
112
|
+
const filename = context.filename;
|
|
113
|
+
const slot = hfs.slotOf(filename);
|
|
114
|
+
const place = isCliFeature(hfs, filename) ? placeOf(relativeIn(hfs, filename)) : null;
|
|
115
|
+
let commands = 0;
|
|
110
116
|
const check = (klass) => {
|
|
111
|
-
const found = commanderDecorator(context, klass)
|
|
112
|
-
if (!found)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
if (found.kind
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
const found = commanderDecorator(context, klass);
|
|
118
|
+
if (!found)
|
|
119
|
+
return;
|
|
120
|
+
commands += 1;
|
|
121
|
+
if (!isCliFeature(hfs, filename))
|
|
122
|
+
return context.report({ node: found.decorator, messageId: "outside", data: { kind: found.kind, slot: slot ?? "none" } });
|
|
123
|
+
if (place !== found.kind)
|
|
124
|
+
return context.report({ node: found.decorator, messageId: "misplaced", data: { kind: found.kind, relative: relativeIn(hfs, filename) ?? filename } });
|
|
125
|
+
if (commands > 1)
|
|
126
|
+
return context.report({ node: found.decorator, messageId: "second" });
|
|
127
|
+
if (found.kind === "SubCommand" && !(klass.superClass && isImportedFrom(context, klass.superClass, COMMANDER, "CommandRunner")))
|
|
128
|
+
context.report({ node: klass.id ?? klass, messageId: "runner", data: { name: klass.id?.name ?? "anonymous" } });
|
|
129
|
+
};
|
|
130
|
+
return { ClassDeclaration: check, ClassExpression: check };
|
|
120
131
|
},
|
|
121
|
-
}
|
|
122
|
-
|
|
132
|
+
};
|
|
123
133
|
/** Whether a member expression is `process.argv` of the Node global (or `globalThis.process.argv`). */
|
|
124
134
|
const isProcessArgv = (context, node) => {
|
|
125
|
-
if (node.computed || node.property.type !== "Identifier" || node.property.name !== "argv")
|
|
126
|
-
|
|
135
|
+
if (node.computed || node.property.type !== "Identifier" || node.property.name !== "argv")
|
|
136
|
+
return false;
|
|
137
|
+
const object = node.object;
|
|
127
138
|
const isProcess = (expression) => {
|
|
128
|
-
if (expression.type !== "Identifier" || expression.name !== "process")
|
|
139
|
+
if (expression.type !== "Identifier" || expression.name !== "process")
|
|
140
|
+
return false;
|
|
129
141
|
for (let scope = context.sourceCode.getScope(expression); scope; scope = scope.upper) {
|
|
130
|
-
const variable = scope.set.get("process")
|
|
131
|
-
if (variable)
|
|
142
|
+
const variable = scope.set.get("process");
|
|
143
|
+
if (variable)
|
|
144
|
+
return variable.defs.length === 0;
|
|
132
145
|
}
|
|
133
|
-
return true
|
|
134
|
-
}
|
|
135
|
-
if (isProcess(object))
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
return true;
|
|
147
|
+
};
|
|
148
|
+
if (isProcess(object))
|
|
149
|
+
return true;
|
|
150
|
+
return object.type === "MemberExpression" && !object.computed && object.object.type === "Identifier" && object.object.name === "globalThis" && object.property.type === "Identifier" && object.property.name === "process";
|
|
151
|
+
};
|
|
139
152
|
/** nest-commander belongs to the cli app and the cli feature root; nothing else parses arguments or opens an action door. */
|
|
140
153
|
export const cliOwner = {
|
|
141
154
|
meta: {
|
|
@@ -149,33 +162,35 @@ export const cliOwner = {
|
|
|
149
162
|
},
|
|
150
163
|
},
|
|
151
164
|
create(context) {
|
|
152
|
-
const hfs = hfsOf(context)
|
|
153
|
-
const filename = context.filename
|
|
154
|
-
const slot = hfs.slotOf(filename)
|
|
155
|
-
const owner = isCliApp(hfs, filename) || isCliFeature(hfs, filename)
|
|
165
|
+
const hfs = hfsOf(context);
|
|
166
|
+
const filename = context.filename;
|
|
167
|
+
const slot = hfs.slotOf(filename);
|
|
168
|
+
const owner = isCliApp(hfs, filename) || isCliFeature(hfs, filename);
|
|
156
169
|
return {
|
|
157
170
|
...moduleReferences(({ source, value }) => {
|
|
158
171
|
if (value === COMMANDER || value.startsWith(`${COMMANDER}/`)) {
|
|
159
|
-
if (!owner)
|
|
160
|
-
|
|
172
|
+
if (!owner)
|
|
173
|
+
context.report({ node: source, messageId: "commander", data: { slot: slot ?? "none" } });
|
|
174
|
+
}
|
|
175
|
+
else if (FOREIGN_PARSERS.has(value))
|
|
176
|
+
context.report({ node: source, messageId: "parser", data: { name: value } });
|
|
161
177
|
}),
|
|
162
178
|
MemberExpression(node) {
|
|
163
|
-
if (isProcessArgv(context, node))
|
|
179
|
+
if (isProcessArgv(context, node))
|
|
180
|
+
context.report({ node, messageId: "argv" });
|
|
164
181
|
},
|
|
165
|
-
}
|
|
182
|
+
};
|
|
166
183
|
},
|
|
167
|
-
}
|
|
168
|
-
|
|
184
|
+
};
|
|
169
185
|
/** The rules this law contributes to the plugin. */
|
|
170
186
|
export const rules = {
|
|
171
187
|
"cli-bootstrap": cliBootstrap,
|
|
172
188
|
"cli-command-shape": cliCommandShape,
|
|
173
189
|
"cli-owner": cliOwner,
|
|
174
|
-
}
|
|
175
|
-
|
|
190
|
+
};
|
|
176
191
|
/** Every rule is an error from the start: HFS keeps no baseline. */
|
|
177
192
|
export const recommended = {
|
|
178
193
|
"starci-be/cli-bootstrap": "error",
|
|
179
194
|
"starci-be/cli-command-shape": "error",
|
|
180
195
|
"starci-be/cli-owner": "error",
|
|
181
|
-
}
|
|
196
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rules that hold `comments.md`.
|
|
3
|
+
*
|
|
4
|
+
* Six rules, and each is careful about a different false positive:
|
|
5
|
+
*
|
|
6
|
+
* - `require-export-jsdoc` skips plain data constants. `export const MAX_ATTEMPTS = 3` is already
|
|
7
|
+
* fully described by its own name, and demanding a sentence there produces sentences that
|
|
8
|
+
* restate the name - which COMMENT-3 forbids. Only declarations with a surface get the check.
|
|
9
|
+
* - `require-public-member-jsdoc` (R109) judges only what a caller reaches: a private, protected or `#` member, the
|
|
10
|
+
* constructor and an index signature are not surface, overload signatures of one name share one doc, and a property
|
|
11
|
+
* set to a literal or a named constant is a data constant (COMMENT-1's reason). Product source only: the test tiers
|
|
12
|
+
* (`e2e`, `fixtures` of the slot manifest) document their spec-read shapes at the type.
|
|
13
|
+
* - `require-enum-member-jsdoc` checks an adjacent non-empty description, never whether it states a
|
|
14
|
+
* consequence. That half is read by a person, and the rule says so rather than pretending.
|
|
15
|
+
* - `no-non-ascii-source` takes no exemption marker, so text a program depends on
|
|
16
|
+
* lives in a message catalog (slot be.domain.messages, of any module tier, or be.feature.messages), the only place Vietnamese may appear. Specs
|
|
17
|
+
* and fixtures get no exemption.
|
|
18
|
+
* - `no-restated-name-jsdoc` (law 7) holds the decidable slice of law 3 - a doc block whose only
|
|
19
|
+
* content is the declared name re-spelled in words teaches nothing beyond the import line, so it
|
|
20
|
+
* is COMMENT-3's violation wearing COMMENT-1's shape. It fires only on an exact match between the
|
|
21
|
+
* doc's content words and the name's own words, so a doc that adds any real information is left
|
|
22
|
+
* alone - the rest of law 3 (whether a sentence explains something outside the line) is not
|
|
23
|
+
* decidable and stays a human read.
|
|
24
|
+
*/
|
|
25
|
+
import type { Recommended, RuleModule } from "./lib/rule.js";
|
|
26
|
+
/** Every export with a surface opens with a doc block. */
|
|
27
|
+
export declare const requireExportJsdoc: RuleModule;
|
|
28
|
+
/** Every public member of an exported class, interface or object type opens with a doc block (BE-COMMENT-3). */
|
|
29
|
+
export declare const requirePublicMemberJsdoc: RuleModule;
|
|
30
|
+
/** Every member of an exported enum carries its own doc. */
|
|
31
|
+
export declare const requireEnumMemberJsdoc: RuleModule;
|
|
32
|
+
/** Source prose is English; there is no exemption marker. */
|
|
33
|
+
export declare const noNonAsciiSource: RuleModule;
|
|
34
|
+
/** A doc block that only re-spells the declared name is COMMENT-3's violation wearing COMMENT-1's shape. */
|
|
35
|
+
export declare const noRestatedNameJsdoc: RuleModule;
|
|
36
|
+
/** The rules this law contributes to the plugin. */
|
|
37
|
+
export declare const rules: {
|
|
38
|
+
"require-export-jsdoc": RuleModule;
|
|
39
|
+
"require-enum-member-jsdoc": RuleModule;
|
|
40
|
+
"require-public-member-jsdoc": RuleModule;
|
|
41
|
+
"no-non-ascii-source": RuleModule;
|
|
42
|
+
"no-restated-name-jsdoc": RuleModule;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The level this law asks for, as the plugin's own opinion.
|
|
46
|
+
*
|
|
47
|
+
* `no-non-ascii-source` replaces three separate rules in the reference plugin - one for Vietnamese,
|
|
48
|
+
* one for emoji, one for decorative symbols. They were three character classes answering one
|
|
49
|
+
* question, and a reader who hit the emoji rule learned nothing about the other two. One rule with
|
|
50
|
+
* one reason is easier to obey, and impossible to satisfy by switching alphabets.
|
|
51
|
+
*/
|
|
52
|
+
export declare const recommended: Recommended;
|