@ligeti/eslint-plugin 0.0.0-stage → 1.0.3
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/LICENSE +201 -0
- package/README.md +88 -2
- package/dist/comment-allowlist.d.ts +10 -0
- package/dist/comment-allowlist.d.ts.map +1 -0
- package/dist/comment-allowlist.js +215 -0
- package/dist/comment-allowlist.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/presets.d.ts +15 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.js +161 -0
- package/dist/presets.js.map +1 -0
- package/dist/rules/no-catch-in-workflow.d.ts +4 -0
- package/dist/rules/no-catch-in-workflow.d.ts.map +1 -0
- package/dist/rules/no-catch-in-workflow.js +46 -0
- package/dist/rules/no-catch-in-workflow.js.map +1 -0
- package/dist/rules/no-comments.d.ts +7 -0
- package/dist/rules/no-comments.d.ts.map +1 -0
- package/dist/rules/no-comments.js +166 -0
- package/dist/rules/no-comments.js.map +1 -0
- package/dist/rules/no-exec-call.d.ts +4 -0
- package/dist/rules/no-exec-call.d.ts.map +1 -0
- package/dist/rules/no-exec-call.js +47 -0
- package/dist/rules/no-exec-call.js.map +1 -0
- package/dist/rules/no-nondeterminism.d.ts +5 -0
- package/dist/rules/no-nondeterminism.d.ts.map +1 -0
- package/dist/rules/no-nondeterminism.js +118 -0
- package/dist/rules/no-nondeterminism.js.map +1 -0
- package/dist/rules/no-sync-io.d.ts +4 -0
- package/dist/rules/no-sync-io.d.ts.map +1 -0
- package/dist/rules/no-sync-io.js +65 -0
- package/dist/rules/no-sync-io.js.map +1 -0
- package/dist/util/create-rule.d.ts +5 -0
- package/dist/util/create-rule.d.ts.map +1 -0
- package/dist/util/create-rule.js +5 -0
- package/dist/util/create-rule.js.map +1 -0
- package/dist/util/workflow-body.d.ts +3 -0
- package/dist/util/workflow-body.d.ts.map +1 -0
- package/dist/util/workflow-body.js +132 -0
- package/dist/util/workflow-body.js.map +1 -0
- package/package.json +34 -3
package/dist/presets.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
const BANNED_WORKFLOW_IO_MODULES = [
|
|
2
|
+
"fs",
|
|
3
|
+
"node:fs",
|
|
4
|
+
"fs/promises",
|
|
5
|
+
"node:fs/promises",
|
|
6
|
+
"child_process",
|
|
7
|
+
"node:child_process",
|
|
8
|
+
"net",
|
|
9
|
+
"node:net",
|
|
10
|
+
"http",
|
|
11
|
+
"node:http",
|
|
12
|
+
"https",
|
|
13
|
+
"node:https",
|
|
14
|
+
"dgram",
|
|
15
|
+
"node:dgram",
|
|
16
|
+
"@dbos-inc/dbos-sdk",
|
|
17
|
+
];
|
|
18
|
+
export const workflow = {
|
|
19
|
+
rules: {
|
|
20
|
+
"ligeti/no-nondeterminism": "error",
|
|
21
|
+
"ligeti/no-catch-in-workflow": "error",
|
|
22
|
+
"no-restricted-imports": [
|
|
23
|
+
"error",
|
|
24
|
+
{
|
|
25
|
+
paths: BANNED_WORKFLOW_IO_MODULES.map((name) => ({
|
|
26
|
+
name,
|
|
27
|
+
message: "a workflow body may only reach I/O through a step -- import it from there instead.",
|
|
28
|
+
})),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const bannedWorkflowIoDynamicImportSelector = {
|
|
34
|
+
selector: `ImportExpression[source.value=/^(${BANNED_WORKFLOW_IO_MODULES.map((name) => name.replace(/[/.]/g, "\\$&")).join("|")})$/]`,
|
|
35
|
+
message: "a workflow body may only reach I/O through a step -- import it from there instead.",
|
|
36
|
+
};
|
|
37
|
+
export const runtime = {
|
|
38
|
+
rules: {
|
|
39
|
+
"ligeti/no-sync-io": "error",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const noRawRecvSelector = {
|
|
43
|
+
selector: "CallExpression[callee.object.name='DBOS'][callee.property.name='recv']",
|
|
44
|
+
message: "DBOS.recv is reserved for @ligeti/sdk's own waitFor implementation (ADR-0019) -- use ctx.waitFor/ctx.waitForCallback instead.",
|
|
45
|
+
};
|
|
46
|
+
const noShellTrueSelector = {
|
|
47
|
+
selector: "Property[key.name='shell'][value.value=true]",
|
|
48
|
+
message: "shell: true is banned (ADR-0004) -- spawn with an argv array and never let a shell interpret a command string.",
|
|
49
|
+
};
|
|
50
|
+
const noProcessEnvReadSelector = {
|
|
51
|
+
selector: "MemberExpression[object.object.name='process'][object.property.name='env']",
|
|
52
|
+
message: "process.env is read only inside a package's own settings.ts, through Zod (ADR-0003) -- add the variable to that package's settings schema, or use the injectable env parameter, instead of reading process.env directly here.",
|
|
53
|
+
};
|
|
54
|
+
const noExecImportEntries = [
|
|
55
|
+
{
|
|
56
|
+
name: "child_process",
|
|
57
|
+
importNames: ["exec"],
|
|
58
|
+
message: "child_process.exec is banned (ADR-0004) -- use execFile/spawn with an argv array.",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "node:child_process",
|
|
62
|
+
importNames: ["exec"],
|
|
63
|
+
message: "child_process.exec is banned (ADR-0004) -- use execFile/spawn with an argv array.",
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
const noProcessEnvReadExceptTestVarsSelector = {
|
|
67
|
+
selector: "MemberExpression[object.object.name='process'][object.property.name='env']:not([property.name=/^LIGETI_TEST_/])",
|
|
68
|
+
message: "process.env is read only for the enumerated LIGETI_TEST_* variables in this file (ADR-0003) -- add the variable to a settings.ts schema instead, or widen the enumerated allow-list here explicitly.",
|
|
69
|
+
};
|
|
70
|
+
export const shell = {
|
|
71
|
+
rules: {
|
|
72
|
+
"no-restricted-syntax": [
|
|
73
|
+
"error",
|
|
74
|
+
{
|
|
75
|
+
selector: "CallExpression[callee.object.name='DBOS'][callee.property.name=/^(launch|registerWorkflow|registerStep)$/]",
|
|
76
|
+
message: "the shell must not call DBOS.launch/registerWorkflow/registerStep -- it talks to workers via DBOSClient only",
|
|
77
|
+
},
|
|
78
|
+
noRawRecvSelector,
|
|
79
|
+
noShellTrueSelector,
|
|
80
|
+
noProcessEnvReadSelector,
|
|
81
|
+
],
|
|
82
|
+
"no-restricted-imports": [
|
|
83
|
+
"error",
|
|
84
|
+
{
|
|
85
|
+
paths: [
|
|
86
|
+
{
|
|
87
|
+
name: "@dbos-inc/dbos-sdk",
|
|
88
|
+
importNames: ["DBOS"],
|
|
89
|
+
message: "the shell must not import DBOS (under any local name) -- it talks to workers via DBOSClient only.",
|
|
90
|
+
},
|
|
91
|
+
...noExecImportEntries,
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
"ligeti/no-exec-call": "error",
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
export const noRawRecv = {
|
|
99
|
+
rules: {
|
|
100
|
+
"no-restricted-syntax": ["error", noRawRecvSelector, bannedWorkflowIoDynamicImportSelector],
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
export const stepRuntimeGuards = {
|
|
104
|
+
rules: {
|
|
105
|
+
"no-restricted-syntax": [
|
|
106
|
+
"error",
|
|
107
|
+
noRawRecvSelector,
|
|
108
|
+
noShellTrueSelector,
|
|
109
|
+
noProcessEnvReadSelector,
|
|
110
|
+
],
|
|
111
|
+
"no-restricted-imports": ["error", { paths: noExecImportEntries }],
|
|
112
|
+
"ligeti/no-exec-call": "error",
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
export const sdkAndTestingGuards = {
|
|
116
|
+
rules: {
|
|
117
|
+
"no-restricted-syntax": ["error", noShellTrueSelector, noProcessEnvReadSelector],
|
|
118
|
+
"no-restricted-imports": ["error", { paths: noExecImportEntries }],
|
|
119
|
+
"ligeti/no-exec-call": "error",
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
export const settingsGuards = {
|
|
123
|
+
rules: {
|
|
124
|
+
"no-restricted-syntax": ["error", noShellTrueSelector],
|
|
125
|
+
"no-restricted-imports": ["error", { paths: noExecImportEntries }],
|
|
126
|
+
"ligeti/no-exec-call": "error",
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
export const testEnvExceptionGuards = {
|
|
130
|
+
rules: {
|
|
131
|
+
"no-restricted-syntax": ["error", noShellTrueSelector, noProcessEnvReadExceptTestVarsSelector],
|
|
132
|
+
"no-restricted-imports": ["error", { paths: noExecImportEntries }],
|
|
133
|
+
"ligeti/no-exec-call": "error",
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
export const noComments = {
|
|
137
|
+
rules: {
|
|
138
|
+
"ligeti/no-comments": ["error", {}],
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
export const testDoubles = {
|
|
142
|
+
rules: {
|
|
143
|
+
"no-restricted-syntax": [
|
|
144
|
+
"error",
|
|
145
|
+
{
|
|
146
|
+
selector: "CallExpression[callee.property.name=/^(mock|doMock|unmock|doUnmock)$/]",
|
|
147
|
+
message: "module mocking is banned (ADR-0007) -- .mock/.doMock/.unmock/.doUnmock replace the module boundary the test is supposed to exercise. Fake the external tool with a real process or server, or use dependency injection through a parameter the production code already declares.",
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
"no-restricted-imports": [
|
|
151
|
+
"error",
|
|
152
|
+
{
|
|
153
|
+
paths: ["sinon", "testdouble", "proxyquire", "mock-require", "jest-mock"].map((name) => ({
|
|
154
|
+
name,
|
|
155
|
+
message: "module mocking is banned (ADR-0007) -- sinon/testdouble/proxyquire/mock-require/jest-mock all intercept the module boundary. Fake the external tool with a real process or server, or use dependency injection through a parameter the production code already declares.",
|
|
156
|
+
})),
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":"AAQA,MAAM,0BAA0B,GAAG;IACjC,IAAI;IACJ,SAAS;IACT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BAAqB,EAAE,OAAO;KAC/B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAW;IACpC,KAAK,EAAE;QACL,sBAAsB,EAAE,CAAC,OAAO,EAAE,mBAAmB,CAAC;QACtD,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;QAClE,qBAAqB,EAAE,OAAO;KAC/B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAW;IAC5C,KAAK,EAAE;QACL,sBAAsB,EAAE,CAAC,OAAO,EAAE,mBAAmB,EAAE,sCAAsC,CAAC;QAC9F,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;QAClE,qBAAqB,EAAE,OAAO;KAC/B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAW;IAChC,KAAK,EAAE;QACL,oBAAoB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;KACpC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAW;IACjC,KAAK,EAAE;QACL,sBAAsB,EAAE;YACtB,OAAO;YACP;gBACE,QAAQ,EAAE,wEAAwE;gBAClF,OAAO,EACL,kRAAkR;aACrR;SACF;QACD,uBAAuB,EAAE;YACvB,OAAO;YACP;gBACE,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBACvF,IAAI;oBACJ,OAAO,EACL,0QAA0Q;iBAC7Q,CAAC,CAAC;aACJ;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const noCatchInWorkflow: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noCatch" | "noFinally" | "noPromiseCatch", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
|
+
//# sourceMappingURL=no-catch-in-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-catch-in-workflow.d.ts","sourceRoot":"","sources":["../../src/rules/no-catch-in-workflow.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB;;CA6C5B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// ABOUTME: ligeti/no-catch-in-workflow -- bans `catch`, `finally`, and promise `.catch(...)`
|
|
2
|
+
// ABOUTME: inside a workflow body, since a bare catch also intercepts cancellation (ADR-0002).
|
|
3
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4
|
+
import { createRule } from "../util/create-rule.js";
|
|
5
|
+
import { isInsideWorkflowRun } from "../util/workflow-body.js";
|
|
6
|
+
export const noCatchInWorkflow = createRule({
|
|
7
|
+
name: "no-catch-in-workflow",
|
|
8
|
+
meta: {
|
|
9
|
+
type: "problem",
|
|
10
|
+
docs: {
|
|
11
|
+
description: "disallow catch, finally, and promise .catch() inside a defineWorkflow run body, since a bare catch also intercepts DBOS cancellation",
|
|
12
|
+
},
|
|
13
|
+
schema: [],
|
|
14
|
+
messages: {
|
|
15
|
+
noCatch: "catch is not allowed in a workflow body: it also intercepts cancellation, which a step must never run after (ADR-0002). Let errors and cancellation propagate; the SDK's wrapper handles cleanup.",
|
|
16
|
+
noFinally: "finally is not allowed in a workflow body: it also runs on cancellation, and running a step there risks running it after CANCELLED (ADR-0002).",
|
|
17
|
+
noPromiseCatch: "promise .catch() is not allowed in a workflow body: it also intercepts cancellation (ADR-0002). Let errors and cancellation propagate; the SDK's wrapper handles cleanup.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultOptions: [],
|
|
21
|
+
create(context) {
|
|
22
|
+
return {
|
|
23
|
+
CatchClause(node) {
|
|
24
|
+
if (isInsideWorkflowRun(node)) {
|
|
25
|
+
context.report({ node, messageId: "noCatch" });
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
TryStatement(node) {
|
|
29
|
+
if (node.finalizer && isInsideWorkflowRun(node)) {
|
|
30
|
+
context.report({ node: node.finalizer, messageId: "noFinally" });
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
CallExpression(node) {
|
|
34
|
+
const callee = node.callee;
|
|
35
|
+
if (callee.type === AST_NODE_TYPES.MemberExpression &&
|
|
36
|
+
!callee.computed &&
|
|
37
|
+
callee.property.type === AST_NODE_TYPES.Identifier &&
|
|
38
|
+
callee.property.name === "catch" &&
|
|
39
|
+
isInsideWorkflowRun(node)) {
|
|
40
|
+
context.report({ node, messageId: "noPromiseCatch" });
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=no-catch-in-workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-catch-in-workflow.js","sourceRoot":"","sources":["../../src/rules/no-catch-in-workflow.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,+FAA+F;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;IAC1C,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,sIAAsI;SACzI;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,OAAO,EACL,mMAAmM;YACrM,SAAS,EACP,gJAAgJ;YAClJ,cAAc,EACZ,2KAA2K;SAC9K;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,WAAW,CAAC,IAAI;gBACd,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC9B,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;gBACjD,CAAC;YACH,CAAC;YACD,YAAY,CAAC,IAAI;gBACf,IAAI,IAAI,CAAC,SAAS,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;oBAChD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;YACD,cAAc,CAAC,IAAI;gBACjB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;gBAC3B,IACE,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB;oBAC/C,CAAC,MAAM,CAAC,QAAQ;oBAChB,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU;oBAClD,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,OAAO;oBAChC,mBAAmB,CAAC,IAAI,CAAC,EACzB,CAAC;oBACD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAAC;gBACxD,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface Options {
|
|
2
|
+
readonly tsdocFiles?: readonly string[];
|
|
3
|
+
}
|
|
4
|
+
export declare const noComments: import("@typescript-eslint/utils/ts-eslint").RuleModule<"disallowedComment", [Options], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=no-comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-comments.d.ts","sourceRoot":"","sources":["../../src/rules/no-comments.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AA8HD,eAAO,MAAM,UAAU;;CAiErB,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// ABOUTME: ligeti/no-comments reports every comment that is not one of AGENTS.md's allowed kinds,
|
|
2
|
+
// ABOUTME: classified by ../comment-allowlist.ts's classifyComment against the tsdocFiles option.
|
|
3
|
+
import { AST_NODE_TYPES, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
|
|
4
|
+
import { classifyComment } from "../comment-allowlist.js";
|
|
5
|
+
import { createRule } from "../util/create-rule.js";
|
|
6
|
+
const ABOUTME_HEADER_COMMENT_COUNT = 2;
|
|
7
|
+
function commentRawText(comment) {
|
|
8
|
+
return comment.type === AST_TOKEN_TYPES.Line ? `//${comment.value}` : `/*${comment.value}*/`;
|
|
9
|
+
}
|
|
10
|
+
const STEP_OVER_KINDS = new Set([
|
|
11
|
+
"eslint-directive",
|
|
12
|
+
"ts-directive",
|
|
13
|
+
"prettier-directive",
|
|
14
|
+
"shellcheck-directive",
|
|
15
|
+
"yaml-language-server-directive",
|
|
16
|
+
"vitest-directive",
|
|
17
|
+
"triple-slash-directive",
|
|
18
|
+
"pure-annotation",
|
|
19
|
+
"quirk",
|
|
20
|
+
]);
|
|
21
|
+
function isImmediatelyFollowedByADisallowedComment(sourceCode, comment) {
|
|
22
|
+
let current = comment;
|
|
23
|
+
for (;;) {
|
|
24
|
+
const next = sourceCode.getTokenAfter(current, {
|
|
25
|
+
includeComments: true,
|
|
26
|
+
});
|
|
27
|
+
if (next === null) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (next.type !== AST_TOKEN_TYPES.Line && next.type !== AST_TOKEN_TYPES.Block) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const classification = classifyComment(commentRawText(next), "js");
|
|
34
|
+
if (classification.allowed && STEP_OVER_KINDS.has(classification.kind)) {
|
|
35
|
+
current = next;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function isInsideAFunctionBody(sourceCode, comment) {
|
|
42
|
+
let current = sourceCode.getNodeByRangeIndex(comment.range[0]);
|
|
43
|
+
while (current) {
|
|
44
|
+
const parent = current.parent;
|
|
45
|
+
const isFunctionLike = parent?.type === AST_NODE_TYPES.FunctionDeclaration ||
|
|
46
|
+
parent?.type === AST_NODE_TYPES.FunctionExpression ||
|
|
47
|
+
parent?.type === AST_NODE_TYPES.ArrowFunctionExpression;
|
|
48
|
+
if (isFunctionLike && parent.body === current) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
current = parent ?? null;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
function isAttachedToADeclaration(sourceCode, comment) {
|
|
56
|
+
return (!isImmediatelyFollowedByADisallowedComment(sourceCode, comment) &&
|
|
57
|
+
!isInsideAFunctionBody(sourceCode, comment));
|
|
58
|
+
}
|
|
59
|
+
const CLOSING_PUNCTUATORS = new Set(["}", ")", "]"]);
|
|
60
|
+
function declaredNames(node) {
|
|
61
|
+
switch (node.type) {
|
|
62
|
+
case AST_NODE_TYPES.FunctionDeclaration:
|
|
63
|
+
case AST_NODE_TYPES.ClassDeclaration:
|
|
64
|
+
case AST_NODE_TYPES.TSInterfaceDeclaration:
|
|
65
|
+
case AST_NODE_TYPES.TSEnumDeclaration:
|
|
66
|
+
return node.id ? [node.id.name] : [];
|
|
67
|
+
case AST_NODE_TYPES.VariableDeclaration:
|
|
68
|
+
return node.declarations
|
|
69
|
+
.map((declarator) => declarator.id.type === AST_NODE_TYPES.Identifier ? declarator.id.name : undefined)
|
|
70
|
+
.filter((name) => name !== undefined);
|
|
71
|
+
default:
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function isExportedByNamedSpecifier(sourceCode, name) {
|
|
76
|
+
return sourceCode.ast.body.some((node) => node.type === AST_NODE_TYPES.ExportNamedDeclaration &&
|
|
77
|
+
node.declaration === null &&
|
|
78
|
+
node.source === null &&
|
|
79
|
+
node.specifiers.some((specifier) => specifier.local.name === name));
|
|
80
|
+
}
|
|
81
|
+
function isAttachedToAnExportedDeclaration(sourceCode, comment) {
|
|
82
|
+
const nextToken = sourceCode.getTokenAfter(comment, { includeComments: false });
|
|
83
|
+
if (nextToken === null) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (nextToken.type === AST_TOKEN_TYPES.Punctuator && CLOSING_PUNCTUATORS.has(nextToken.value)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
let current = sourceCode.getNodeByRangeIndex(nextToken.range[0]);
|
|
90
|
+
while (current) {
|
|
91
|
+
if (current.type === AST_NODE_TYPES.ExportNamedDeclaration ||
|
|
92
|
+
current.type === AST_NODE_TYPES.ExportDefaultDeclaration) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
if (current.parent?.type === AST_NODE_TYPES.Program) {
|
|
96
|
+
if (declaredNames(current).some((name) => isExportedByNamedSpecifier(sourceCode, name))) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
current = current.parent ?? null;
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
export const noComments = createRule({
|
|
105
|
+
name: "no-comments",
|
|
106
|
+
meta: {
|
|
107
|
+
type: "problem",
|
|
108
|
+
docs: {
|
|
109
|
+
description: "disallow any comment that is not an ABOUTME header, a reasoned tool directive, a QUIRK note, or SDK TSDoc (AGENTS.md 'Code comments')",
|
|
110
|
+
},
|
|
111
|
+
schema: [
|
|
112
|
+
{
|
|
113
|
+
type: "object",
|
|
114
|
+
properties: {
|
|
115
|
+
tsdocFiles: { type: "array", items: { type: "string" } },
|
|
116
|
+
},
|
|
117
|
+
additionalProperties: false,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
messages: {
|
|
121
|
+
disallowedComment: "comments are not allowed here (AGENTS.md 'Code comments') -- move the information into a name, a type, a test, or the commit message instead.",
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
defaultOptions: [{}],
|
|
125
|
+
create(context, [options]) {
|
|
126
|
+
const tsdocFiles = options.tsdocFiles ?? [];
|
|
127
|
+
const filename = context.filename;
|
|
128
|
+
const isTsdocFile = tsdocFiles.some((allowed) => filename.endsWith(allowed));
|
|
129
|
+
return {
|
|
130
|
+
Program() {
|
|
131
|
+
const sourceCode = context.sourceCode;
|
|
132
|
+
const comments = sourceCode.getAllComments();
|
|
133
|
+
let aboutmeSeen = 0;
|
|
134
|
+
comments.forEach((comment) => {
|
|
135
|
+
const commentType = comment.type;
|
|
136
|
+
if (commentType === "Shebang") {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const classification = classifyComment(commentRawText(comment), "js");
|
|
140
|
+
if (classification.kind === "aboutme") {
|
|
141
|
+
const isLeadingCandidate = aboutmeSeen < ABOUTME_HEADER_COMMENT_COUNT &&
|
|
142
|
+
sourceCode.getTokenBefore(comment, { includeComments: false }) === null;
|
|
143
|
+
if (isLeadingCandidate) {
|
|
144
|
+
aboutmeSeen++;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
context.report({ loc: comment.loc, messageId: "disallowedComment" });
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (classification.kind === "tsdoc") {
|
|
151
|
+
const attached = isAttachedToADeclaration(sourceCode, comment);
|
|
152
|
+
const exported = attached && isAttachedToAnExportedDeclaration(sourceCode, comment);
|
|
153
|
+
if (!isTsdocFile || !attached || !exported) {
|
|
154
|
+
context.report({ loc: comment.loc, messageId: "disallowedComment" });
|
|
155
|
+
}
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (!classification.allowed) {
|
|
159
|
+
context.report({ loc: comment.loc, messageId: "disallowedComment" });
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
//# sourceMappingURL=no-comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-comments.js","sourceRoot":"","sources":["../../src/rules/no-comments.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,kGAAkG;AAClG,OAAO,EAAE,cAAc,EAAE,eAAe,EAAiB,MAAM,0BAA0B,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAMpD,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC,SAAS,cAAc,CAAC,OAAyB;IAC/C,OAAO,OAAO,CAAC,IAAI,KAAK,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,IAAI,CAAC;AAC/F,CAAC;AAED,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC;IACnD,kBAAkB;IAClB,cAAc;IACd,oBAAoB;IACpB,sBAAsB;IACtB,gCAAgC;IAChC,kBAAkB;IAClB,wBAAwB;IACxB,iBAAiB;IACjB,OAAO;CACR,CAAC,CAAC;AAEH,SAAS,yCAAyC,CAChD,UAAsB,EACtB,OAAyB;IAEzB,IAAI,OAAO,GAAmB,OAAO,CAAC;IACtC,SAAS,CAAC;QACR,MAAM,IAAI,GAA0B,UAAU,CAAC,aAAa,CAAC,OAAO,EAAE;YACpE,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;QACH,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,IAAI,IAAI,IAAI,CAA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AmB,EAAE,CAAC,CAAC;wBACrE,OAAO;oBACT,CAAC;oBACD,IAAI,cAAc,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;wBACpC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;wBAC/D,MAAM,QAAQ,GAAG,QAAQ,IAAI,iCAAiC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;wBACpF,IAAI,CAAC,WAAW,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;4BAC3C,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;wBACvE,CAAC;wBACD,OAAO;oBACT,CAAC;oBACD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;wBAC5B,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;oBACvE,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-exec-call.d.ts","sourceRoot":"","sources":["../../src/rules/no-exec-call.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,UAAU;;CA+CrB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// ABOUTME: ligeti/no-exec-call bans child_process.exec reached through a namespace or default
|
|
2
|
+
// ABOUTME: import, closing the alias gap a named-import no-restricted-imports ban leaves open.
|
|
3
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4
|
+
import { createRule } from "../util/create-rule.js";
|
|
5
|
+
const EXEC_MODULES = new Set(["child_process", "node:child_process"]);
|
|
6
|
+
export const noExecCall = createRule({
|
|
7
|
+
name: "no-exec-call",
|
|
8
|
+
meta: {
|
|
9
|
+
type: "problem",
|
|
10
|
+
docs: {
|
|
11
|
+
description: "disallow child_process.exec reached through a namespace or default import -- a shell-string call must never be introduced under any import form (ADR-0004)",
|
|
12
|
+
},
|
|
13
|
+
schema: [],
|
|
14
|
+
messages: {
|
|
15
|
+
noExecCall: "child_process.exec is banned (ADR-0004), including through a namespace/default import ({{name}}.exec) -- use execFile/spawn with an argv array.",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultOptions: [],
|
|
19
|
+
create(context) {
|
|
20
|
+
const namespaceLocals = new Set();
|
|
21
|
+
return {
|
|
22
|
+
ImportDeclaration(node) {
|
|
23
|
+
if (typeof node.source.value !== "string" || !EXEC_MODULES.has(node.source.value)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
for (const specifier of node.specifiers) {
|
|
27
|
+
if (specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier ||
|
|
28
|
+
specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
29
|
+
namespaceLocals.add(specifier.local.name);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
CallExpression(node) {
|
|
34
|
+
const callee = node.callee;
|
|
35
|
+
if (callee.type === AST_NODE_TYPES.MemberExpression &&
|
|
36
|
+
!callee.computed &&
|
|
37
|
+
callee.property.type === AST_NODE_TYPES.Identifier &&
|
|
38
|
+
callee.property.name === "exec" &&
|
|
39
|
+
callee.object.type === AST_NODE_TYPES.Identifier &&
|
|
40
|
+
namespaceLocals.has(callee.object.name)) {
|
|
41
|
+
context.report({ node, messageId: "noExecCall", data: { name: callee.object.name } });
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=no-exec-call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-exec-call.js","sourceRoot":"","sources":["../../src/rules/no-exec-call.ts"],"names":[],"mapp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AChB,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU;oBAClD,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM;oBAC/B,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU;oBAChD,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EACvC,CAAC;oBACD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACxF,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-nondeterminism.d.ts","sourceRoot":"","sources":["../../src/rules/no-nondeterminism.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4B,KAAK,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AA8ElG,eAAO,MAAM,gBAAgB;;CA4E3B,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// ABOUTME: ligeti/no-nondeterminism -- bans nondeterministic/environment-dependent globals
|
|
2
|
+
// ABOUTME: (Date, Math.random, crypto randomness, performance.now, process, timers, fetch) inside workflow bodies.
|
|
3
|
+
import { ASTUtils, AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4
|
+
import { createRule } from "../util/create-rule.js";
|
|
5
|
+
import { isInsideWorkflowRun } from "../util/workflow-body.js";
|
|
6
|
+
const GLOBALS = {
|
|
7
|
+
Date: { wholeBanAdvice: "use ctx.now() instead" },
|
|
8
|
+
Math: { members: { random: "use ctx.uuid() or a step for randomness instead" } },
|
|
9
|
+
crypto: {
|
|
10
|
+
members: { randomUUID: "use ctx.uuid() instead", getRandomValues: "use ctx.uuid() instead" },
|
|
11
|
+
},
|
|
12
|
+
performance: { members: { now: "use ctx.now() instead" } },
|
|
13
|
+
process: { wholeBanAdvice: "pass configuration in as workflow input instead" },
|
|
14
|
+
setTimeout: { wholeBanAdvice: "use ctx.sleep() instead" },
|
|
15
|
+
setInterval: { wholeBanAdvice: "use ctx.sleep() in a loop instead" },
|
|
16
|
+
setImmediate: { wholeBanAdvice: "use ctx.sleep(0) instead" },
|
|
17
|
+
fetch: { wholeBanAdvice: "use a step for network calls instead" },
|
|
18
|
+
};
|
|
19
|
+
const WHOLE_BAN_NAMES = new Set(Object.entries(GLOBALS)
|
|
20
|
+
.filter(([, entry]) => entry.wholeBanAdvice !== undefined)
|
|
21
|
+
.map(([name]) => name));
|
|
22
|
+
function resolveBareOrGlobalThisBase(node) {
|
|
23
|
+
if (node.type === AST_NODE_TYPES.Identifier) {
|
|
24
|
+
return { name: node.name, shadowCheckNode: node };
|
|
25
|
+
}
|
|
26
|
+
if (node.type === AST_NODE_TYPES.MemberExpression &&
|
|
27
|
+
!node.computed &&
|
|
28
|
+
node.object.type === AST_NODE_TYPES.Identifier &&
|
|
29
|
+
node.object.name === "globalThis" &&
|
|
30
|
+
node.property.type === AST_NODE_TYPES.Identifier) {
|
|
31
|
+
return { name: node.property.name, shadowCheckNode: null };
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
function isShadowedByALocalBinding(id, scope) {
|
|
36
|
+
const variable = ASTUtils.findVariable(scope, id);
|
|
37
|
+
return variable !== null && variable.defs.length > 0;
|
|
38
|
+
}
|
|
39
|
+
function isMemberExpressionPropertyOrObject(parent, node) {
|
|
40
|
+
return (parent.type === AST_NODE_TYPES.MemberExpression &&
|
|
41
|
+
(parent.property === node || parent.object === node));
|
|
42
|
+
}
|
|
43
|
+
function isTypePosition(parent) {
|
|
44
|
+
return (parent.type === AST_NODE_TYPES.TSTypeReference ||
|
|
45
|
+
parent.type === AST_NODE_TYPES.TSTypeQuery ||
|
|
46
|
+
parent.type === AST_NODE_TYPES.TSQualifiedName);
|
|
47
|
+
}
|
|
48
|
+
export const noNondeterminism = createRule({
|
|
49
|
+
name: "no-nondeterminism",
|
|
50
|
+
meta: {
|
|
51
|
+
type: "problem",
|
|
52
|
+
docs: {
|
|
53
|
+
description: "disallow nondeterministic or environment-dependent globals (Date, Math.random, crypto randomness, performance.now, process, timers, fetch) inside a defineWorkflow run body",
|
|
54
|
+
},
|
|
55
|
+
schema: [],
|
|
56
|
+
messages: {
|
|
57
|
+
nondeterministic: "{{displayName}} is nondeterministic inside a workflow body -- {{advice}}.",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
defaultOptions: [],
|
|
61
|
+
create(context) {
|
|
62
|
+
function report(node, match) {
|
|
63
|
+
if (!isInsideWorkflowRun(node)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
context.report({
|
|
67
|
+
node,
|
|
68
|
+
messageId: "nondeterministic",
|
|
69
|
+
data: { displayName: match.displayName, advice: match.advice },
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
MemberExpression(node) {
|
|
74
|
+
if (node.computed || node.property.type !== AST_NODE_TYPES.Identifier) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const base = resolveBareOrGlobalThisBase(node.object);
|
|
78
|
+
if (!base) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const entry = GLOBALS[base.name];
|
|
82
|
+
if (!entry) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (base.shadowCheckNode &&
|
|
86
|
+
isShadowedByALocalBinding(base.shadowCheckNode, context.sourceCode.getScope(base.shadowCheckNode))) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const propName = node.property.name;
|
|
90
|
+
const advice = entry.wholeBanAdvice ?? entry.members?.[propName];
|
|
91
|
+
if (advice === undefined) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
report(node, { displayName: `${base.name}.${propName}`, advice });
|
|
95
|
+
},
|
|
96
|
+
Identifier(node) {
|
|
97
|
+
if (!WHOLE_BAN_NAMES.has(node.name)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const parent = node.parent;
|
|
101
|
+
if (isMemberExpressionPropertyOrObject(parent, node) || isTypePosition(parent)) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const scope = context.sourceCode.getScope(node);
|
|
105
|
+
const isValueReference = scope.references.some((ref) => ref.identifier === node);
|
|
106
|
+
if (!isValueReference || isShadowedByALocalBinding(node, scope)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const entry = GLOBALS[node.name];
|
|
110
|
+
if (!entry?.wholeBanAdvice) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
report(node, { displayName: node.name, advice: entry.wholeBanAdvice });
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=no-nondeterminism.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-nondeterminism.js","sourceRoot":"","sources":["../../src/rules/no-nondeterminism.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,mHAAmH;AACnH,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAgC,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAO/D,MAAM,OAAO,GAA0C;IACrD,IAAI,EAAE,EAAE,cAAc,EAAE,uBAAuB,EAAE;IACjD,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,iDAAiD,EAAE,EAAE;IAChF,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,UAAU,EAAE,wBAAwB,EAAE,eAAe,EAAE,wBAAwB,EAAE;KAC7F;IACD,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,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