@sshkeda/check 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +52 -22
  2. package/docs/how-to-make-check-pass.md +3 -0
  3. package/package.json +7 -10
  4. package/scripts/check.ts +10 -0
  5. package/src/internal/ban-abbreviated-words-in-declared-names.ts +4 -5
  6. package/src/internal/ban-deadlines-inside-tests.ts +4 -5
  7. package/src/internal/ban-dropped-failures-detached-fibers-sleeps-and-untraced-functions.ts +4 -5
  8. package/src/internal/ban-failures-collected-as-results.ts +4 -5
  9. package/src/internal/ban-fallbacks-of-named-recoveries.ts +6 -7
  10. package/src/internal/ban-fixed-values-in-recoveries.ts +331 -0
  11. package/src/internal/ban-re-exports.ts +14 -1
  12. package/src/internal/ban-reading-the-clock-and-sleeping-outside-effect.ts +4 -5
  13. package/src/internal/ban-recovering-file-system-exists.ts +12 -79
  14. package/src/internal/ban-timer-schedules-without-deadlines.ts +5 -6
  15. package/src/internal/ban-type-predicates.ts +4 -5
  16. package/src/internal/ban-what-a-file-is-not-granted.ts +9 -9
  17. package/src/internal/define-the-lint-plugin-and-configs.ts +6 -2
  18. package/src/internal/follow-the-steps-applied-to-an-effect.ts +100 -0
  19. package/src/internal/recognize-fixed-values.ts +318 -0
  20. package/src/internal/recognize-whole-library-error-tags.ts +6 -0
  21. package/src/internal/report-code-grants-nothing-uses.ts +122 -0
  22. package/src/lib/project-directory/index.ts +5 -0
  23. package/src/lib/project-directory/internal/read-the-project-directory.ts +13 -0
  24. package/src/lib/tasks/internal/declare-the-check-task.ts +18 -10
  25. package/src/lib/tasks/internal/declare-the-checker-queries-task.ts +3 -1
  26. package/src/lib/tasks/internal/verify-where-check-was-started.ts +50 -0
  27. package/src/lib/tasks/lib/check-effect-diagnostics-with-effect-tsgo/index.ts +1 -1
  28. package/src/lib/tasks/lib/check-effect-diagnostics-with-effect-tsgo/internal/read-effect-tsgo-json-report.ts +13 -9
  29. package/src/lib/tasks/lib/confine-layer-provides-to-program-starts/internal/find-layer-provides-outside-program-starts.ts +6 -36
  30. package/src/lib/tasks/lib/detect-duplicate-functions/internal/find-duplicate-functions.ts +2 -3
  31. package/src/lib/tasks/lib/enforce-file-layout/internal/check-the-layout-of-each-package.ts +1 -1
  32. package/src/lib/tasks/lib/enforce-file-layout/internal/file-layout-errors.ts +19 -2
  33. package/src/lib/tasks/lib/enforce-file-layout/internal/find-file-layout-violations.ts +53 -19
  34. package/src/lib/tasks/lib/enforce-file-types/internal/find-file-type-violations.ts +1 -1
  35. package/src/lib/tasks/lib/format-with-bun-fmt/internal/check-formatting-with-bun-fmt.ts +17 -16
  36. package/src/lib/tasks/lib/format-with-bun-fmt/internal/declare-the-formatting-task.ts +22 -14
  37. package/src/lib/tasks/lib/lint-with-oxlint/index.ts +1 -1
  38. package/src/lib/tasks/lib/lint-with-oxlint/internal/check-lint-rules-with-oxlint.ts +7 -0
  39. package/src/lib/tasks/lib/lint-with-oxlint/internal/find-shebangs-outside-bin.ts +38 -0
  40. package/src/lib/tasks/lib/lint-with-oxlint/internal/shebang-errors.ts +22 -0
  41. package/src/lib/tasks/lib/place-exports-in-the-narrowest-directory/internal/find-export-placement-violations.ts +9 -1
  42. package/src/lib/tasks/lib/place-exports-in-the-narrowest-directory/internal/find-the-importer-graph.ts +21 -0
  43. package/src/lib/tasks/lib/place-exports-in-the-narrowest-directory/internal/recognise-task-default-exports.ts +76 -0
  44. package/src/lib/tasks/lib/refuse-disable-directives/index.ts +1 -1
  45. package/src/lib/tasks/lib/refuse-forks-whose-failures-nothing-observes/index.ts +1 -0
  46. package/src/lib/tasks/lib/refuse-forks-whose-failures-nothing-observes/internal/find-unobserved-fork-failures.ts +402 -0
  47. package/src/lib/tasks/lib/refuse-forks-whose-failures-nothing-observes/internal/fork-failure-errors.ts +28 -0
  48. package/src/lib/tasks/lib/require-type-checking-every-linted-file/internal/find-linted-files-not-type-checked.ts +15 -9
  49. package/src/lib/tasks/lib/type-check-with-bun-check/index.ts +1 -1
  50. package/src/lib/tasks/shared/check-each-nested-package.ts +13 -5
  51. package/src/lib/tasks/shared/declare-lint-config-task.ts +1 -1
  52. package/src/lib/tasks/shared/declare-typescript-config-task.ts +1 -1
  53. package/src/lib/tasks/shared/find-installed-package-binaries.ts +10 -0
  54. package/src/lib/tasks/shared/list-package-files.ts +15 -2
  55. package/src/lib/tasks/shared/read-piped-steps-through-wrappers.ts +41 -0
  56. package/src/lib/tasks/shared/report-paths-from-the-project.ts +56 -0
  57. package/src/shared/bans-each-permission-lifts.ts +3 -0
  58. package/src/shared/format-reported-failures.ts +8 -6
  59. package/src/shared/record-and-grant-permissions-by-path.ts +63 -7
  60. package/src/internal/ban-shebang-lines.ts +0 -22
  61. /package/src/lib/tasks/{lib/format-with-bun-fmt/internal → shared}/find-symbolic-links.ts +0 -0
package/README.md CHANGED
@@ -4,11 +4,11 @@ Check sends your AI slop code back to the kitchen!
4
4
 
5
5
  Check holds your TypeScript code to a strict standard built around Effect and Bun, so the code stays type-safe, observable and predictable.
6
6
 
7
- It runs about 308 lint rules, 65 of them its own, and about 80 checks on your project's layout, imports and config. It also runs oxfmt, Effect's diagnostics and `bun check`. Your agent keeps fixing what it reports until the slop is gone.
7
+ It runs about 310 lint rules, 66 of them its own, and about 80 checks on your project's layout, imports and config. It also runs oxfmt, Effect's diagnostics and `bun check`. Your agent keeps fixing what it reports until the slop is gone.
8
8
 
9
9
  No comment or setting turns a rule off everywhere. A small set of rules was picked to allow an override, and you grant each one to a single file in `oxlint.config.ts`. See [Grant a permission](docs/how-to-make-check-pass.md#grant-a-permission).
10
10
 
11
- Check is built on [Task](https://github.com/sshkeda/task), a task runner for Bun.
11
+ Check is a command you run in your repo. It runs its checks with [Task](https://github.com/sshkeda/task), a task runner for Bun.
12
12
 
13
13
  ## See it catch slop
14
14
 
@@ -37,13 +37,13 @@ Here's what Check prints when it runs on that code:
37
37
  [effect-tsgo] src/index.ts:1:25: error effect(asyncFunction): This code declares an async function, consider representing this async control flow with Effect values and `Effect.gen`.
38
38
  [effect-tsgo] src/index.ts:3:28: error effect(globalFetch): This code uses the global `fetch` function, HTTP requests are represented through `HttpClient` from `effect/http`.
39
39
  [effect-tsgo] error ToolExited: effect-tsgo exited with code 1
40
- [oxlint] src/index.ts:4:12: error typescript(consistent-type-assertions): Do not use any type assertions.
41
- [oxlint] src/index.ts:4:39: error typescript(no-explicit-any): Unexpected `any`. Specify a different type.
42
- [oxlint] src/index.ts:7:5: error eslint(no-console): Unexpected console statement.
43
40
  [oxlint] src/index.ts:1:25: error sshkeda(no-index-logic): index file holds an arrow function expression
41
+ [oxlint] src/index.ts:4:5: error typescript(no-unsafe-return): Unsafe return of a value of type `any`.
42
+ [oxlint] src/index.ts:4:12: error typescript(consistent-type-assertions): Do not use any type assertions.
44
43
  [oxlint] src/index.ts:4:19: error sshkeda(no-unchecked-parsing): json() parses JSON without a Schema
44
+ [oxlint] src/index.ts:4:39: error typescript(no-explicit-any): Unexpected `any`. Specify a different type.
45
45
  [oxlint] src/index.ts:6:5: error sshkeda(no-comments): comment in code
46
- [oxlint] src/index.ts:4:5: error typescript(no-unsafe-return): Unsafe return of a value of type `any`.
46
+ [oxlint] src/index.ts:7:5: error eslint(no-console): Unexpected console statement.
47
47
  [oxlint] error ToolExited: oxlint exited with code 1
48
48
  [typed-checks] error SettledTasksFailed: 2 of 6 tasks failed: oxlint, effect-tsgo
49
49
  [check] read node_modules/@sshkeda/check/docs/how-to-make-check-pass.md before you change the code
@@ -84,7 +84,7 @@ Check passes.
84
84
 
85
85
  - **No comments.** When code is hard to follow, the fix is better names and simpler code, which stay true as the code changes. Comments drift out of date, and agents fill them with noise. When you need more explanation, ask your agent to explain the code.
86
86
  - **No `type` or `interface` declarations.** Types are inferred from the code that produces each value, so every type has one source of truth and nothing to keep in sync.
87
- - **No `let` and no loops.** Values don't change after they're made, which leaves an agent fewer ways to get state wrong.
87
+ - **No `let`, and no `while` or counting `for` loops.** Values don't change after they're made, which leaves an agent fewer ways to get state wrong.
88
88
  - **Modules with `internal/`, `shared/` and `lib/`.** Each module exposes its public code in `index.ts`, keeps private code in `internal/`, which only that module may import, puts code its parts share in `shared/` and holds its child modules in `lib/`. Code stays easy to organize and hard to tangle.
89
89
  - **No abbreviations.** `imABigFanWhenVariablesAreLongBecauseThenItsEasierToUnderstandWhatTheCodeDoes`. Full words read the same to every person and every agent.
90
90
  - **No unchecked data.** JSON and other input pass through a Schema before the code trusts them, because a type assertion or a hand-written type guard proves nothing.
@@ -93,17 +93,17 @@ Check passes.
93
93
  - **Tests are tasks.** Every test is a Task task in `tests/`, never a Vitest, Jest or `bun:test` suite. Tests run in parallel and clean up after themselves.
94
94
  - **Each service in its own layer.** Services are declared only in files you grant, which keeps their wiring in one place.
95
95
  - **No polling.** Code waits for an event or a signal instead of checking on a timer, so it reacts right away. When there's nothing to listen to, such as a server that's still starting, polling needs a grant and a time limit.
96
- - **No dropped failures.** Every error is handled or passed on, so nothing fails silently.
96
+ - **No dropped failures.** Every error is handled or passed on, and a fork that can fail must keep its fiber, so nothing fails silently.
97
97
  - **Risky access only where you grant it.** Reading environment variables, starting commands and printing to the terminal each need a grant on the exact file that does it.
98
98
 
99
99
  ## Get started
100
100
 
101
101
  Check needs Bun 1.4.4 or newer and a Git repository.
102
102
 
103
- 1. Install Check, Task, Effect and Bun's types.
103
+ 1. Install Check, Effect and Bun's types.
104
104
 
105
105
  ```bash
106
- bun add @sshkeda/check @sshkeda/task effect
106
+ bun add @sshkeda/check effect
107
107
  bun add -d @types/bun
108
108
  ```
109
109
 
@@ -142,22 +142,52 @@ Check needs Bun 1.4.4 or newer and a Git repository.
142
142
  export default FORMAT_CONFIG;
143
143
  ```
144
144
 
145
- 5. Create `scripts/ci.ts` to run Check.
145
+ 5. Run Check, and have your agent fix what it reports. Expect the first run to fail, even on a new project from `bun init`.
146
146
 
147
- ```ts
148
- import { check } from "@sshkeda/check/tasks";
149
- import { Task } from "@sshkeda/task";
150
-
151
- if (import.meta.main) {
152
- Task.main(check);
153
- }
147
+ ```bash
148
+ bunx @sshkeda/check
154
149
  ```
155
150
 
156
- 6. Run it, and have your agent fix what it reports. Expect the first run to fail, even on a new project from `bun init`.
151
+ Check checks the package in the directory you start it in.
157
152
 
158
- ```bash
159
- bun scripts/ci.ts
160
- ```
153
+ ## Run it from a script
154
+
155
+ To run Check beside your own tasks, such as your tests, add Task and start the command from a task in `scripts/`.
156
+
157
+ ```bash
158
+ bun add @sshkeda/task
159
+ ```
160
+
161
+ `scripts/internal/start-check.ts` starts the command:
162
+
163
+ ```ts
164
+ import { Task } from "@sshkeda/task";
165
+
166
+ export const check = Task.make("check", Task.exec("bunx", ["@sshkeda/check"]));
167
+ ```
168
+
169
+ `scripts/ci.ts` runs it:
170
+
171
+ ```ts
172
+ import { Task } from "@sshkeda/task";
173
+
174
+ import { check } from "./internal/start-check.ts";
175
+
176
+ if (import.meta.main) {
177
+ Task.main(check);
178
+ }
179
+ ```
180
+
181
+ To run your tests too, make one task in `scripts/internal/run-checks-and-tests.ts` that runs both, and pass it to `Task.main` in `scripts/ci.ts`:
182
+
183
+ ```ts
184
+ import { Task } from "@sshkeda/task";
185
+
186
+ import { tests } from "../../tests/index.ts";
187
+ import { check } from "./start-check.ts";
188
+
189
+ export const ci = Task.make("ci", Task.allSettled([check, tests]));
190
+ ```
161
191
 
162
192
  ## Make it yours
163
193
 
@@ -7,7 +7,9 @@ Check may not catch every violation of these principles. Review your code agains
7
7
  ## Meet the requirement behind the error
8
8
 
9
9
  - Use a grant only for an unavoidable exception.
10
+ - Move the code that needs a grant into its own small file and grant that file. A grant covers the whole file, so Check stops reporting that ban for everything else in it.
10
11
  - Design for the current requirement as if you were starting fresh. Delete code the new design doesn't need.
12
+ - Handle a forked effect's failure before the fork, or keep the fiber and join it.
11
13
  - Grant `isGeneratedByATool` only to a file a tool generates.
12
14
 
13
15
  ## Grant a permission
@@ -36,6 +38,7 @@ export default lintConfig({
36
38
  - `patchesADependency`: Allows a patch file from `bun patch`.
37
39
  - `trustsUnverifiedTypes`: Allows trusting a value's type without checking it, through `Schema.declare`.
38
40
  - `handlesEveryFailure`: Allows catching every error, through `Effect.catch`, `Effect.exit`, a forked fiber or `Effect.runPromise`.
41
+ - `fallsBackToFixedValues`: Allows answering every failure, or a whole library error such as `PlatformError`, with a fixed value that never reads the failure.
39
42
  - `isGeneratedByATool`: Check skips this path, so it can't have any other permission.
40
43
 
41
44
  ## Make the code explain itself
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sshkeda/check",
3
- "version": "2.1.0",
3
+ "version": "3.0.0",
4
4
  "homepage": "https://github.com/sshkeda/check#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/sshkeda/check/issues"
@@ -10,14 +10,17 @@
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/sshkeda/check.git"
12
12
  },
13
+ "bin": {
14
+ "check": "./scripts/check.ts"
15
+ },
13
16
  "files": [
14
17
  "docs",
18
+ "scripts/check.ts",
15
19
  "src"
16
20
  ],
17
21
  "type": "module",
18
22
  "exports": {
19
- ".": "./src/index.ts",
20
- "./tasks": "./src/lib/tasks/index.ts"
23
+ ".": "./src/index.ts"
21
24
  },
22
25
  "publishConfig": {
23
26
  "access": "public",
@@ -27,6 +30,7 @@
27
30
  "@effect/platform-bun": "4.1.0",
28
31
  "@effect/tsgo": "0.67.4",
29
32
  "@oxlint/plugins": "1.88.0",
33
+ "@sshkeda/task": "1.0.2",
30
34
  "oxc-parser": "0.153.0",
31
35
  "oxc-resolver": "11.24.2",
32
36
  "oxlint": "1.88.0",
@@ -34,19 +38,12 @@
34
38
  "typescript": "7.0.2"
35
39
  },
36
40
  "devDependencies": {
37
- "@sshkeda/task": "^1.0.0",
38
41
  "@types/bun": "1.4.3",
39
42
  "effect": "4.1.0"
40
43
  },
41
44
  "peerDependencies": {
42
- "@sshkeda/task": "^1.0.0",
43
45
  "effect": "^4.1.0"
44
46
  },
45
- "peerDependenciesMeta": {
46
- "@sshkeda/task": {
47
- "optional": true
48
- }
49
- },
50
47
  "engines": {
51
48
  "bun": ">=1.4.4"
52
49
  }
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bun
2
+ import { Task } from "@sshkeda/task";
3
+
4
+ import { PROJECT_DIRECTORY_VARIABLE } from "../src/lib/project-directory/index.ts";
5
+ import { check } from "../src/lib/tasks/index.ts";
6
+
7
+ if (import.meta.main) {
8
+ process.env[PROJECT_DIRECTORY_VARIABLE] = process.cwd();
9
+ Task.main(check);
10
+ }
@@ -1,5 +1,4 @@
1
- import { defineRule } from "@oxlint/plugins";
2
- import type { ESTree } from "@oxlint/plugins";
1
+ import type { Context, CreateRule, ESTree } from "@oxlint/plugins";
3
2
  import { Schema } from "effect";
4
3
 
5
4
  import { decodeRuleOptions, ruleOptionsJsonSchema } from "./describe-and-decode-rule-options.ts";
@@ -128,7 +127,7 @@ const allowList = (options: readonly unknown[]): ReadonlySet<string> =>
128
127
  ),
129
128
  );
130
129
 
131
- export const noAbbreviations = defineRule({
130
+ export const noAbbreviations = {
132
131
  meta: {
133
132
  type: "suggestion",
134
133
  messages: {
@@ -136,7 +135,7 @@ export const noAbbreviations = defineRule({
136
135
  },
137
136
  schema: ruleOptionsJsonSchema(ABBREVIATION_OPTIONS),
138
137
  },
139
- create(context) {
138
+ create(context: Pick<Context, "options" | "report">) {
140
139
  const allowed = allowList(context.options);
141
140
 
142
141
  const check = (node: ESTree.Node) => {
@@ -158,4 +157,4 @@ export const noAbbreviations = defineRule({
158
157
 
159
158
  return declaredNameListeners(check);
160
159
  },
161
- });
160
+ } satisfies CreateRule;
@@ -1,5 +1,4 @@
1
- import { defineRule } from "@oxlint/plugins";
2
- import type { ESTree } from "@oxlint/plugins";
1
+ import type { Context, CreateRule, ESTree } from "@oxlint/plugins";
3
2
 
4
3
  import { SCHEDULE_MESSAGES } from "../shared/lint-rule-messages-and-patterns.ts";
5
4
  import { scheduleVisitors } from "./ban-timer-schedules-without-deadlines.ts";
@@ -7,12 +6,12 @@ import { effectModuleReference } from "./resolve-what-an-expression-imports.ts";
7
6
 
8
7
  const TIMEOUT = "timeout";
9
8
 
10
- export const noTestTimeouts = defineRule({
9
+ export const noTestTimeouts = {
11
10
  meta: {
12
11
  type: "problem",
13
12
  messages: { ...SCHEDULE_MESSAGES, timeout: "{{usage}} sets a deadline inside a test" },
14
13
  },
15
- create(context) {
14
+ create(context: Pick<Context, "report" | "sourceCode">) {
16
15
  const schedules = scheduleVisitors({ context, timedSchedules: "banned" });
17
16
  const reportEffectTimeout = (node: ESTree.Node) => {
18
17
  const usage = effectModuleReference(node, context.sourceCode, "Effect");
@@ -37,4 +36,4 @@ export const noTestTimeouts = defineRule({
37
36
  },
38
37
  };
39
38
  },
40
- });
39
+ } satisfies CreateRule;
@@ -1,5 +1,4 @@
1
- import { defineRule } from "@oxlint/plugins";
2
- import type { ESTree } from "@oxlint/plugins";
1
+ import type { Context, CreateRule, ESTree } from "@oxlint/plugins";
3
2
 
4
3
  import { EFFECT_OPERATION_RULES } from "../shared/lint-rule-messages-and-patterns.ts";
5
4
  import { effectModuleOperation, moduleExportName } from "./resolve-what-an-expression-imports.ts";
@@ -17,14 +16,14 @@ export const effectOperationRule = (ruleName: keyof typeof EFFECT_OPERATION_RULE
17
16
  const bannedModules: ReadonlySet<string> = new Set(
18
17
  bannedOperations.flatMap(([, operations]) => [...operations.keys()]),
19
18
  );
20
- return defineRule({
19
+ return {
21
20
  meta: {
22
21
  type: "problem",
23
22
  messages: {
24
23
  operation: "{{moduleName}}.{{operation}} is banned",
25
24
  },
26
25
  },
27
- create(context) {
26
+ create(context: Pick<Context, "report" | "sourceCode">) {
28
27
  const report = (node: ESTree.Node, moduleName: string, operation: string | undefined) => {
29
28
  if (operation === undefined) {
30
29
  return;
@@ -61,5 +60,5 @@ export const effectOperationRule = (ruleName: keyof typeof EFFECT_OPERATION_RULE
61
60
  },
62
61
  };
63
62
  },
64
- });
63
+ } satisfies CreateRule;
65
64
  };
@@ -1,5 +1,4 @@
1
- import { defineRule } from "@oxlint/plugins";
2
- import type { ESTree } from "@oxlint/plugins";
1
+ import type { Context, CreateRule, ESTree } from "@oxlint/plugins";
3
2
 
4
3
  import { effectModuleOperation, propertyKeyName } from "./resolve-what-an-expression-imports.ts";
5
4
 
@@ -28,7 +27,7 @@ const unsafeOptionsMessage = (options: ESTree.Node | undefined) => {
28
27
  return isDefaultMode ? undefined : "results";
29
28
  };
30
29
 
31
- export const noFailuresAsResults = defineRule({
30
+ export const noFailuresAsResults = {
32
31
  meta: {
33
32
  type: "problem",
34
33
  messages: {
@@ -36,7 +35,7 @@ export const noFailuresAsResults = defineRule({
36
35
  opaqueOptions: "Effect.all is given options that are not written inline",
37
36
  },
38
37
  },
39
- create(context) {
38
+ create(context: Pick<Context, "report" | "sourceCode">) {
40
39
  return {
41
40
  CallExpression(node) {
42
41
  const operation = effectModuleOperation(node.callee, context.sourceCode, "Effect");
@@ -50,4 +49,4 @@ export const noFailuresAsResults = defineRule({
50
49
  },
51
50
  };
52
51
  },
53
- });
52
+ } satisfies CreateRule;
@@ -1,14 +1,13 @@
1
- import { defineRule } from "@oxlint/plugins";
2
- import type { ESTree, SourceCode } from "@oxlint/plugins";
1
+ import type { Context, CreateRule, ESTree, SourceCode } from "@oxlint/plugins";
3
2
 
4
3
  import { constantValue, effectModuleOperation } from "./resolve-what-an-expression-imports.ts";
5
4
 
6
5
  const NAMED_RECOVERY_MODULES = ["Effect", "Stream", "Channel"] as const;
7
6
 
8
- const isTagText = (node: ESTree.Node) =>
7
+ export const isTagText = (node: ESTree.Node) =>
9
8
  (node.type === "Literal" && typeof node.value === "string") || node.type === "TemplateLiteral";
10
9
 
11
- const isTagList = (node: ESTree.Node) => isTagText(node) || node.type === "ArrayExpression";
10
+ export const isTagList = (node: ESTree.Node) => isTagText(node) || node.type === "ArrayExpression";
12
11
 
13
12
  const isHandlerObject = (node: ESTree.Node) => node.type === "ObjectExpression";
14
13
 
@@ -61,14 +60,14 @@ const hasFallback = (
61
60
  return isDataLastWithFallback || !isDataFirstWithoutFallback;
62
61
  };
63
62
 
64
- export const noUnnamedFallbacks = defineRule({
63
+ export const noUnnamedFallbacks = {
65
64
  meta: {
66
65
  type: "problem",
67
66
  messages: {
68
67
  fallback: "{{member}} is given a fallback for failures it does not name",
69
68
  },
70
69
  },
71
- create(context) {
70
+ create(context: Pick<Context, "report" | "sourceCode">) {
72
71
  return {
73
72
  CallExpression(node) {
74
73
  for (const moduleName of NAMED_RECOVERY_MODULES) {
@@ -87,4 +86,4 @@ export const noUnnamedFallbacks = defineRule({
87
86
  },
88
87
  };
89
88
  },
90
- });
89
+ } satisfies CreateRule;