@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.
Files changed (43) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +88 -2
  3. package/dist/comment-allowlist.d.ts +10 -0
  4. package/dist/comment-allowlist.d.ts.map +1 -0
  5. package/dist/comment-allowlist.js +215 -0
  6. package/dist/comment-allowlist.js.map +1 -0
  7. package/dist/index.d.ts +23 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +19 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/presets.d.ts +15 -0
  12. package/dist/presets.d.ts.map +1 -0
  13. package/dist/presets.js +161 -0
  14. package/dist/presets.js.map +1 -0
  15. package/dist/rules/no-catch-in-workflow.d.ts +4 -0
  16. package/dist/rules/no-catch-in-workflow.d.ts.map +1 -0
  17. package/dist/rules/no-catch-in-workflow.js +46 -0
  18. package/dist/rules/no-catch-in-workflow.js.map +1 -0
  19. package/dist/rules/no-comments.d.ts +7 -0
  20. package/dist/rules/no-comments.d.ts.map +1 -0
  21. package/dist/rules/no-comments.js +166 -0
  22. package/dist/rules/no-comments.js.map +1 -0
  23. package/dist/rules/no-exec-call.d.ts +4 -0
  24. package/dist/rules/no-exec-call.d.ts.map +1 -0
  25. package/dist/rules/no-exec-call.js +47 -0
  26. package/dist/rules/no-exec-call.js.map +1 -0
  27. package/dist/rules/no-nondeterminism.d.ts +5 -0
  28. package/dist/rules/no-nondeterminism.d.ts.map +1 -0
  29. package/dist/rules/no-nondeterminism.js +118 -0
  30. package/dist/rules/no-nondeterminism.js.map +1 -0
  31. package/dist/rules/no-sync-io.d.ts +4 -0
  32. package/dist/rules/no-sync-io.d.ts.map +1 -0
  33. package/dist/rules/no-sync-io.js +65 -0
  34. package/dist/rules/no-sync-io.js.map +1 -0
  35. package/dist/util/create-rule.d.ts +5 -0
  36. package/dist/util/create-rule.d.ts.map +1 -0
  37. package/dist/util/create-rule.js +5 -0
  38. package/dist/util/create-rule.js.map +1 -0
  39. package/dist/util/workflow-body.d.ts +3 -0
  40. package/dist/util/workflow-body.d.ts.map +1 -0
  41. package/dist/util/workflow-body.js +132 -0
  42. package/dist/util/workflow-body.js.map +1 -0
  43. package/package.json +34 -3
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Viktor "Bika" Nagy
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,89 @@
1
- # Temporary Holding Version
1
+ # @ligeti/eslint-plugin
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Determinism and boundary ESLint rules for Ligeti workflow/step/shell code
4
+ ([ADR-0002](../../adr/0002-workflow-bodies-are-deterministic.md)). The plugin ships three rules and
5
+ four flat-config presets built from them; `pnpm build` compiles the plugin to `dist/` before
6
+ `pnpm lint` runs, so the root `eslint.config.js` always imports the built package
7
+ (`@ligeti/eslint-plugin`), never plugin source directly.
8
+
9
+ ## Rules
10
+
11
+ ### `ligeti/no-nondeterminism`
12
+
13
+ Reports `Date`/`Date.now()`, `Math.random()`, `crypto.randomUUID()`/`getRandomValues()`,
14
+ `performance.now()`, any `process` access (including `process.env`, banned wholesale rather than by
15
+ specific member), `setTimeout`/`setInterval`/`setImmediate`, and `fetch` -- called, `new`'d, accessed
16
+ as a member (`Date.now`, `globalThis.Date.now`), or referenced bare as a value -- anywhere inside the
17
+ `run` function of a `defineWorkflow({ ... })` call, including nested closures. Each message names the
18
+ deterministic replacement (`ctx.now()`, `ctx.uuid()`, `ctx.sleep()`, or a step). Code outside a
19
+ workflow's `run` (a step's own `run`/`spawn`/`find`/`close`) is untouched, and a name that is
20
+ shadowed by a real local declaration in scope is not flagged.
21
+
22
+ `@types/node`'s global augmentations (`process`, `fetch`, `setTimeout`, ...) are not registered in
23
+ typescript-eslint's scope manager the way core-lib globals (`Date`, `Math`) are, so this rule does
24
+ not rely on resolving names as globals; it checks the more reliable opposite thing -- whether the
25
+ name is bound by a real local declaration anywhere in the enclosing scope chain.
26
+
27
+ Enforces [ADR-0002](../../adr/0002-workflow-bodies-are-deterministic.md): a workflow body must be
28
+ replay-safe, since DBOS re-runs it from the top on recovery.
29
+
30
+ ### `ligeti/no-catch-in-workflow`
31
+
32
+ Reports any `catch` clause, `finally` block, and promise `.catch(...)` call inside a workflow's
33
+ `run` body (including nested closures). Every thrown value -- including workflow cancellation --
34
+ reaches a bare `catch`, since nothing keeps a cancellation signal out of a generic handler: a naive
35
+ "on error, run a cleanup step" handler will try to run a step after CANCELLED. `finally` runs on the same cancellation path,
36
+ so it is banned for the same reason; only a bare `try` (no `catch`, no `finally`) is allowed. Let
37
+ errors and cancellation propagate -- the SDK's own workflow wrapper handles cleanup and resource
38
+ closing.
39
+
40
+ Enforces [ADR-0002](../../adr/0002-workflow-bodies-are-deterministic.md).
41
+
42
+ ### `ligeti/no-sync-io`
43
+
44
+ Reports `*Sync` calls from `fs`/`node:fs`/`child_process`/`node:child_process`, via named imports
45
+ (aliased or not, e.g. `import { readFileSync as r }`), a namespace import (`import * as fs`), or a
46
+ default import. Synchronous I/O blocks the event loop shared by every workflow run in the same
47
+ worker process, including cancellation polling.
48
+
49
+ Enforces [ADR-0002](../../adr/0002-workflow-bodies-are-deterministic.md), applied to runtime code
50
+ generally rather than only inside a workflow body -- see the `runtime` preset below.
51
+
52
+ ## Presets
53
+
54
+ Each preset is a flat-config object (`{ rules: {...} }`) exported from `presets`:
55
+
56
+ | Preset | Rules | Applied to |
57
+ | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
58
+ | `workflow` | `no-nondeterminism`, `no-catch-in-workflow`, `no-restricted-imports` (`fs`, `node:fs`, `fs/promises`, `node:fs/promises`, `child_process`, `node:child_process`, `net`, `node:net`, `http`, `node:http`, `https`, `node:https`, `dgram`, `node:dgram`, `@dbos-inc/dbos-sdk`) | `workflows/*/src/**` |
59
+ | `runtime` | `no-sync-io` | `packages/sdk/src/**`, `packages/shell/src/**`, `packages/agent-runtime/src/**`, `steps/*/src/**` (excluding `**/src/cli/**` and `**/src/cli.ts` -- CLI startup code may still do a one-time sync read) |
60
+ | `shell` | bans `DBOS.launch`/`registerWorkflow`/`registerStep` and the raw `DBOS.recv` (one combined `no-restricted-syntax`, since a second preset targeting the same files would silently clobber it -- see the preset's own comment), plus banning any import of `DBOS` itself, under any local name, from `@dbos-inc/dbos-sdk` (`no-restricted-imports`) | `packages/shell/src/**` |
61
+ | `noRawRecv` | bans the raw `DBOS.recv` (`no-restricted-syntax`) -- only the SDK's own `waitFor` may call it, everyone else uses `ctx.waitFor`/`ctx.waitForCallback` (ADR-0019) (the shell gets this ban from `shell` above instead, to avoid that same clobbering) | `packages/agent-runtime/src/**`, `steps/*/src/**`, `workflows/*/src/**` |
62
+ | `stepRuntimeGuards` | the raw `DBOS.recv` ban, plus a `shell: true` ban ([ADR-0004](../../adr/0004-child-processes-take-argv-and-an-explicit-environment.md)), a `process.env.<name>` read ban ([ADR-0003](../../adr/0003-configuration-is-a-settings-module.md)) and a `no-restricted-imports` ban on `exec` from `child_process` -- all in one `no-restricted-syntax` entry, for the same clobbering reason as `shell` | `packages/agent-runtime/src/**`, `steps/*/src/**` |
63
+ | `sdkAndTestingGuards` | the same `shell: true` and `process.env` bans, but deliberately **not** the raw-recv ban -- `packages/sdk` is where the SDK's own `waitFor` calls the real `DBOS.recv` | `packages/sdk/src/**`, `packages/testing/src/**` |
64
+ | `testDoubles` | bans `vi.mock`/`vi.doMock` and any import of `sinon` ([ADR-0007](../../adr/0007-test-doubles-are-real-processes.md)). Dependency injection through a parameter the production code already declares -- a `vi.fn()` passed as a `FetchLike` -- is untouched, since neither rule looks at how a test builds its own local values | every test-file glob |
65
+
66
+ `workflow` and `noRawRecv` together enforce
67
+ [ADR-0001](../../adr/0001-package-boundaries-and-dependency-rules.md)'s boundaries: only the SDK's
68
+ `waitFor` may call the raw `DBOS.recv`, and a workflow body reaches the outside world only through
69
+ steps.
70
+ `shell` enforces that same boundary rule for `packages/shell`, which talks to workers over
71
+ `DBOSClient`/HTTP only and must never itself launch a DBOS app or register a workflow/step.
72
+
73
+ Three of these presets exist to enforce records that would otherwise be advisory: a `process.env`
74
+ read outside a `settings.ts` ([ADR-0003](../../adr/0003-configuration-is-a-settings-module.md)),
75
+ `shell: true` on a child process
76
+ ([ADR-0004](../../adr/0004-child-processes-take-argv-and-an-explicit-environment.md)), and module
77
+ mocking in a test ([ADR-0007](../../adr/0007-test-doubles-are-real-processes.md)). Two further
78
+ rules are configured directly in `eslint.config.js` rather than here, since they are stock rules
79
+ needing no selector: `no-console` over `packages/*/src` and `steps/*/src`
80
+ ([ADR-0011](../../adr/0011-logging-goes-through-the-contextual-logger.md)) and
81
+ `@typescript-eslint/consistent-type-definitions`
82
+ ([ADR-0009](../../adr/0009-module-and-file-conventions.md)).
83
+
84
+ `packages/eslint-plugin/test/adr-lint-rules.test.ts` proves each of the five fires, and proves the
85
+ dependency-injection case does not.
86
+
87
+ `packages/eslint-plugin/test/fixtures/bad-workflow.ts` is a deliberately lint-dirty (but
88
+ type-valid) fixture exercised by `packages/eslint-plugin/test/fixture-lint.test.ts`; it is excluded
89
+ from the repo-wide `pnpm lint` via `eslint.config.js`'s `ignores`.
@@ -0,0 +1,10 @@
1
+ export type CommentLanguage = "js" | "shell" | "yaml";
2
+ export declare const QUIRK_TOOLS: readonly ["dbos", "git", "gitlab", "herdr", "claude", "opencode", "node", "vitest", "pnpm", "typescript", "eslint", "zod", "postgres", "telegram", "beads", "docker", "typedoc", "bash"];
3
+ export type QuirkTool = (typeof QUIRK_TOOLS)[number];
4
+ export type CommentKind = "aboutme" | "eslint-directive" | "ts-directive" | "prettier-directive" | "shellcheck-directive" | "yaml-language-server-directive" | "vitest-directive" | "triple-slash-directive" | "pure-annotation" | "quirk" | "tsdoc" | "type-jsdoc" | "plain";
5
+ export interface CommentClassification {
6
+ readonly kind: CommentKind;
7
+ readonly allowed: boolean;
8
+ }
9
+ export declare function classifyComment(text: string, language: CommentLanguage): CommentClassification;
10
+ //# sourceMappingURL=comment-allowlist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment-allowlist.d.ts","sourceRoot":"","sources":["../src/comment-allowlist.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtD,eAAO,MAAM,WAAW,0LAmBd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,kBAAkB,GAClB,cAAc,GACd,oBAAoB,GACpB,sBAAsB,GACtB,gCAAgC,GAChC,kBAAkB,GAClB,wBAAwB,GACxB,iBAAiB,GACjB,OAAO,GACP,OAAO,GACP,YAAY,GACZ,OAAO,CAAC;AAEZ,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAqND,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,qBAAqB,CAM9F"}
@@ -0,0 +1,215 @@
1
+ // ABOUTME: Single source of truth for which comments AGENTS.md's "Code comments" section allows.
2
+ // ABOUTME: ligeti/no-comments and scripts/check-comments.mjs both classify comment text here.
3
+ export const QUIRK_TOOLS = [
4
+ "dbos",
5
+ "git",
6
+ "gitlab",
7
+ "herdr",
8
+ "claude",
9
+ "opencode",
10
+ "node",
11
+ "vitest",
12
+ "pnpm",
13
+ "typescript",
14
+ "eslint",
15
+ "zod",
16
+ "postgres",
17
+ "telegram",
18
+ "beads",
19
+ "docker",
20
+ "typedoc",
21
+ "bash",
22
+ ];
23
+ const MIN_TS_EXPECT_ERROR_REASON_LENGTH = 10;
24
+ const ABOUTME_PREFIX = "ABOUTME:";
25
+ const QUIRK_PATTERN = /^QUIRK\(([a-zA-Z-]+)\):\s+(\S.*)$/;
26
+ const REASON_PATTERN = /--\s+(\S.*)$/;
27
+ const ESLINT_DIRECTIVE_PATTERN = /^eslint-(disable-next-line|disable-line|disable|enable)\b(.*)$/;
28
+ const TS_BANNED_DIRECTIVE_PATTERN = /^@ts-(ignore|nocheck)\b/;
29
+ const TS_EXPECT_ERROR_PATTERN = /^@ts-expect-error\b(.*)$/;
30
+ const PRETTIER_IGNORE_PATTERN = /^prettier-ignore$/;
31
+ const VITEST_ENVIRONMENT_PATTERN = /^@vitest-environment\s+(\S+)$/;
32
+ const VITEST_ENVIRONMENT_OPTIONS_TAG_PATTERN = /^@vitest-environment-options\s*/;
33
+ const TRIPLE_SLASH_REFERENCE_PATTERN = /^<reference\s+[^>]*\/>$/;
34
+ const PURE_ANNOTATIONS = new Set(["/*#__PURE__*/", "/*@__PURE__*/"]);
35
+ const SHELLCHECK_DIRECTIVE_PATTERN = /^shellcheck\s+(disable|source|shell)=(\S+)(.*)$/;
36
+ const YAML_LANGUAGE_SERVER_DIRECTIVE_PATTERN = /^yaml-language-server:\s*\$schema=(\S+)\s*$/;
37
+ const IDENTIFIER_PATTERN = /^[A-Za-z_$][\w$]*$/;
38
+ function matchingNestedBraceIndexOrNull(text, openIndex) {
39
+ if (text[openIndex] !== "{") {
40
+ return null;
41
+ }
42
+ let depth = 0;
43
+ for (let index = openIndex; index < text.length; index++) {
44
+ if (text[index] === "{") {
45
+ depth++;
46
+ }
47
+ else if (text[index] === "}") {
48
+ depth--;
49
+ if (depth === 0) {
50
+ return index;
51
+ }
52
+ }
53
+ }
54
+ return null;
55
+ }
56
+ function isBracedTagWithQualifyingTrailer(line, tagPattern, isQualifyingTrailer) {
57
+ const tagMatch = tagPattern.exec(line);
58
+ if (!tagMatch) {
59
+ return false;
60
+ }
61
+ const afterTag = line.slice(tagMatch[0].length);
62
+ const closeIndex = matchingNestedBraceIndexOrNull(afterTag, 0);
63
+ if (closeIndex === null) {
64
+ return false;
65
+ }
66
+ return isQualifyingTrailer(afterTag.slice(closeIndex + 1).trim());
67
+ }
68
+ const HAS_NO_TRAILER = (afterClosingBrace) => afterClosingBrace.length === 0;
69
+ const IS_IDENTIFIER_TRAILER = (afterClosingBrace) => IDENTIFIER_PATTERN.test(afterClosingBrace);
70
+ function isTypeOnlyJsDocLine(line) {
71
+ if (isBracedTagWithQualifyingTrailer(line, /^@type\s*/, HAS_NO_TRAILER)) {
72
+ return true;
73
+ }
74
+ if (isBracedTagWithQualifyingTrailer(line, /^@satisfies\s*/, HAS_NO_TRAILER)) {
75
+ return true;
76
+ }
77
+ if (isBracedTagWithQualifyingTrailer(line, /^@returns?\s*/, HAS_NO_TRAILER)) {
78
+ return true;
79
+ }
80
+ if (isBracedTagWithQualifyingTrailer(line, /^@param\s*/, IS_IDENTIFIER_TRAILER)) {
81
+ return true;
82
+ }
83
+ if (isBracedTagWithQualifyingTrailer(line, /^@typedef\s*/, IS_IDENTIFIER_TRAILER)) {
84
+ return true;
85
+ }
86
+ if (isBracedTagWithQualifyingTrailer(line, /^@import\s*/, (afterClosingBrace) => /^from\s+(['"])[^'"]+\1$/.test(afterClosingBrace))) {
87
+ return true;
88
+ }
89
+ const templateMatch = /^@template\s+(.+)$/.exec(line);
90
+ const templateNames = templateMatch?.[1];
91
+ if (templateNames !== undefined) {
92
+ const names = templateNames.split(",").map((name) => name.trim());
93
+ return names.every((name) => IDENTIFIER_PATTERN.test(name));
94
+ }
95
+ return false;
96
+ }
97
+ function isTypeOnlyJsDocBlock(rawBlockText) {
98
+ const inner = rawBlockText.slice(2, -2);
99
+ const lines = inner
100
+ .split(/\r?\n/)
101
+ .map((line) => line.replace(/^\s*\*\s?/, "").trim())
102
+ .filter((line) => line.length > 0);
103
+ return lines.length > 0 && lines.every((line) => isTypeOnlyJsDocLine(line));
104
+ }
105
+ function hasQualifyingReason(rest, minLength = 1) {
106
+ if (rest === undefined) {
107
+ return false;
108
+ }
109
+ const match = REASON_PATTERN.exec(rest);
110
+ const reason = match?.[1];
111
+ return reason !== undefined && reason.trim().length >= minLength;
112
+ }
113
+ function matchQuirk(inner) {
114
+ const match = QUIRK_PATTERN.exec(inner);
115
+ if (!match) {
116
+ return undefined;
117
+ }
118
+ const tool = match[1];
119
+ const rest = match[2];
120
+ if (tool === undefined || rest === undefined) {
121
+ return undefined;
122
+ }
123
+ const isKnownTool = QUIRK_TOOLS.includes(tool);
124
+ const hasUrl = /https?:\/\/\S+/.test(rest);
125
+ return { kind: "quirk", allowed: isKnownTool && hasUrl };
126
+ }
127
+ function classifyJsInner(inner, isTsdocCandidate) {
128
+ if (isTsdocCandidate) {
129
+ return { kind: "tsdoc", allowed: true };
130
+ }
131
+ if (inner.startsWith(ABOUTME_PREFIX)) {
132
+ return { kind: "aboutme", allowed: true };
133
+ }
134
+ const eslintMatch = ESLINT_DIRECTIVE_PATTERN.exec(inner);
135
+ if (eslintMatch) {
136
+ return { kind: "eslint-directive", allowed: hasQualifyingReason(eslintMatch[2]) };
137
+ }
138
+ if (TS_BANNED_DIRECTIVE_PATTERN.test(inner)) {
139
+ return { kind: "ts-directive", allowed: false };
140
+ }
141
+ const tsExpectErrorMatch = TS_EXPECT_ERROR_PATTERN.exec(inner);
142
+ if (tsExpectErrorMatch) {
143
+ return {
144
+ kind: "ts-directive",
145
+ allowed: hasQualifyingReason(tsExpectErrorMatch[1], MIN_TS_EXPECT_ERROR_REASON_LENGTH),
146
+ };
147
+ }
148
+ if (PRETTIER_IGNORE_PATTERN.test(inner)) {
149
+ return { kind: "prettier-directive", allowed: true };
150
+ }
151
+ if (VITEST_ENVIRONMENT_PATTERN.test(inner)) {
152
+ return { kind: "vitest-directive", allowed: true };
153
+ }
154
+ if (VITEST_ENVIRONMENT_OPTIONS_TAG_PATTERN.test(inner)) {
155
+ const allowed = isBracedTagWithQualifyingTrailer(inner, VITEST_ENVIRONMENT_OPTIONS_TAG_PATTERN, HAS_NO_TRAILER);
156
+ return { kind: "vitest-directive", allowed };
157
+ }
158
+ return matchQuirk(inner) ?? { kind: "plain", allowed: false };
159
+ }
160
+ function classifyJs(text) {
161
+ if (text.startsWith("///")) {
162
+ const inner = text.slice(3).trim();
163
+ if (TRIPLE_SLASH_REFERENCE_PATTERN.test(inner)) {
164
+ return { kind: "triple-slash-directive", allowed: true };
165
+ }
166
+ return { kind: "plain", allowed: false };
167
+ }
168
+ if (text.startsWith("//")) {
169
+ return classifyJsInner(text.slice(2).trim(), false);
170
+ }
171
+ if (text.startsWith("/*") && text.endsWith("*/") && text.length >= 4) {
172
+ if (PURE_ANNOTATIONS.has(text)) {
173
+ return { kind: "pure-annotation", allowed: true };
174
+ }
175
+ const isTsdocCandidate = text.startsWith("/**") && text !== "/**/";
176
+ if (isTsdocCandidate && isTypeOnlyJsDocBlock(text)) {
177
+ return { kind: "type-jsdoc", allowed: true };
178
+ }
179
+ return classifyJsInner(text.slice(2, -2).trim(), isTsdocCandidate);
180
+ }
181
+ return { kind: "plain", allowed: false };
182
+ }
183
+ function classifyHash(text, language) {
184
+ if (!text.startsWith("#")) {
185
+ return { kind: "plain", allowed: false };
186
+ }
187
+ const inner = text.slice(1).trim();
188
+ if (inner.startsWith(ABOUTME_PREFIX)) {
189
+ return { kind: "aboutme", allowed: true };
190
+ }
191
+ const quirkMatch = matchQuirk(inner);
192
+ if (quirkMatch) {
193
+ return quirkMatch;
194
+ }
195
+ if (language === "shell") {
196
+ const shellcheckMatch = SHELLCHECK_DIRECTIVE_PATTERN.exec(inner);
197
+ if (shellcheckMatch) {
198
+ const [, keyword, , rest] = shellcheckMatch;
199
+ const allowed = keyword === "disable" ? hasQualifyingReason(rest) : (rest?.trim().length ?? 0) === 0;
200
+ return { kind: "shellcheck-directive", allowed };
201
+ }
202
+ }
203
+ if (language === "yaml" && YAML_LANGUAGE_SERVER_DIRECTIVE_PATTERN.test(inner)) {
204
+ return { kind: "yaml-language-server-directive", allowed: true };
205
+ }
206
+ return { kind: "plain", allowed: false };
207
+ }
208
+ export function classifyComment(text, language) {
209
+ const trimmed = text.trim();
210
+ if (language === "js") {
211
+ return classifyJs(trimmed);
212
+ }
213
+ return classifyHash(trimmed, language);
214
+ }
215
+ //# sourceMappingURL=comment-allowlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment-allowlist.js","sourceRoot":"","sources":["../src/comment-allowlist.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,8FAA8F;AAI9F,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM;IACN,KAAK;IACL,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,MAAM;IACN,QAAQ;IACR,MAAM;IACN,YAAY;IACZ,QAAQ;IACR,KAAK;IACL,UAAU;IACV,UAAU;IACV,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;CACE,CAAC;AAwBX,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAE7C,MAAM,cAAc,GAAG,UAAU,CAAC;AAClC,MAAM,aAAa,GAAG,mCAAmC,CAAC;AAC1D,MAAM,cAAc,GAAG,cAAc,CAAC;AACtC,MAAM,wBAAwB,GAAG,gEAAgE,CAAC;AAClG,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AAC9D,MAAM,uBAAuB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AACpD,MAAM,0BAA0B,GAAG,+BAA+B,CAAC;AACnE,MAAM,sCAAsC,GAAG,iCAAiC,CAAC;AACjF,MAAM,8BAA8B,GAAG,yBAAyB,CAAC;AACjE,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC;AACrE,MAAM,4BAA4B,GAAG,iDAAiD,CAAC;AACvF,MAAM,sCAAsC,GAAG,6CAA6C,CAAC;AAE7F,MAAM,kBAAk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
3
+ rules: {
4
+ "no-nondeterminism": import("@typescript-eslint/utils/ts-eslint").RuleModule<"nondeterministic", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
5
+ name: string;
6
+ };
7
+ "no-catch-in-workflow": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noCatch" | "noFinally" | "noPromiseCatch", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
8
+ name: string;
9
+ };
10
+ "no-sync-io": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noSyncIo", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
11
+ name: string;
12
+ };
13
+ "no-exec-call": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noExecCall", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
14
+ name: string;
15
+ };
16
+ "no-comments": import("@typescript-eslint/utils/ts-eslint").RuleModule<"disallowedComment", [import("./rules/no-comments.js").Options], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
17
+ name: string;
18
+ };
19
+ };
20
+ };
21
+ export { presets };
22
+ export type { Preset } from "./presets.js";
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;CAQlB,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ // ABOUTME: Public entry point of @ligeti/eslint-plugin: the `ligeti` plugin object (rules) and
2
+ // ABOUTME: the flat-config presets (`workflow`, `runtime`, `shell`, `noRawRecv`) the root config wires in (plan §7).
3
+ import { noNondeterminism } from "./rules/no-nondeterminism.js";
4
+ import { noCatchInWorkflow } from "./rules/no-catch-in-workflow.js";
5
+ import { noSyncIo } from "./rules/no-sync-io.js";
6
+ import { noExecCall } from "./rules/no-exec-call.js";
7
+ import { noComments } from "./rules/no-comments.js";
8
+ import * as presets from "./presets.js";
9
+ export const plugin = {
10
+ rules: {
11
+ "no-nondeterminism": noNondeterminism,
12
+ "no-catch-in-workflow": noCatchInWorkflow,
13
+ "no-sync-io": noSyncIo,
14
+ "no-exec-call": noExecCall,
15
+ "no-comments": noComments,
16
+ },
17
+ };
18
+ export { presets };
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,qHAAqH;AACrH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE;QACL,mBAAmB,EAAE,gBAAgB;QACrC,sBAAsB,EAAE,iBAAiB;QACzC,YAAY,EAAE,QAAQ;QACtB,cAAc,EAAE,UAAU;QAC1B,aAAa,EAAE,UAAU;KAC1B;CACF,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Linter } from "eslint";
2
+ export interface Preset {
3
+ readonly rules: Linter.RulesRecord;
4
+ }
5
+ export declare const workflow: Preset;
6
+ export declare const runtime: Preset;
7
+ export declare const shell: Preset;
8
+ export declare const noRawRecv: Preset;
9
+ export declare const stepRuntimeGuards: Preset;
10
+ export declare const sdkAndTestingGuards: Preset;
11
+ export declare const settingsGuards: Preset;
12
+ export declare const testEnvExceptionGuards: Preset;
13
+ export declare const noComments: Preset;
14
+ export declare const testDoubles: Preset;
15
+ //# sourceMappingURL=presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC;CACpC;AAoBD,eAAO,MAAM,QAAQ,EAAE,MAetB,CAAC;AASF,eAAO,MAAM,OAAO,EAAE,MAIrB,CAAC;AAwCF,eAAO,MAAM,KAAK,EAAE,MA8BnB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAIvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAW/B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAMjC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAM5B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,MAMpC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAIxB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAqBzB,CAAC"}