eslint-plugin-functype 2.127.2 → 2.201.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 (106) hide show
  1. package/README.md +109 -75
  2. package/dist/cli/list-rules.js.map +1 -1
  3. package/dist/configs/recommended.d.ts +43 -45
  4. package/dist/configs/recommended.js +1 -1
  5. package/dist/configs/recommended.js.map +1 -1
  6. package/dist/configs/tests.d.ts +8 -5
  7. package/dist/configs/tests.js +1 -1
  8. package/dist/configs/tests.js.map +1 -1
  9. package/dist/index.d.ts +2 -4
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/rules/collection-naming.d.ts +1 -4
  13. package/dist/rules/collection-naming.js.map +1 -1
  14. package/dist/rules/index.d.ts +13 -14
  15. package/dist/rules/index.js +1 -1
  16. package/dist/rules/index.js.map +1 -1
  17. package/dist/rules/must-fold-on-component-return.d.ts +1 -4
  18. package/dist/rules/must-fold-on-component-return.js.map +1 -1
  19. package/dist/rules/no-array-mutation.d.ts +1 -4
  20. package/dist/rules/no-array-mutation.js +1 -1
  21. package/dist/rules/no-array-mutation.js.map +1 -1
  22. package/dist/rules/no-floating-io.d.ts +1 -4
  23. package/dist/rules/no-floating-io.js.map +1 -1
  24. package/dist/rules/no-floating-result.d.ts +1 -4
  25. package/dist/rules/no-floating-result.js.map +1 -1
  26. package/dist/rules/no-get-unsafe.d.ts +1 -4
  27. package/dist/rules/no-get-unsafe.js +1 -1
  28. package/dist/rules/no-get-unsafe.js.map +1 -1
  29. package/dist/rules/no-getOrThrow-in-render.d.ts +1 -4
  30. package/dist/rules/no-getOrThrow-in-render.js +1 -1
  31. package/dist/rules/no-getOrThrow-in-render.js.map +1 -1
  32. package/dist/rules/no-imperative-loops.d.ts +1 -4
  33. package/dist/rules/no-imperative-loops.js +1 -1
  34. package/dist/rules/no-imperative-loops.js.map +1 -1
  35. package/dist/rules/no-let.d.ts +1 -4
  36. package/dist/rules/no-let.js.map +1 -1
  37. package/dist/rules/no-serialize-container.d.ts +1 -4
  38. package/dist/rules/no-serialize-container.js.map +1 -1
  39. package/dist/rules/no-uncalled-method.d.ts +16 -0
  40. package/dist/rules/no-uncalled-method.js +2 -0
  41. package/dist/rules/no-uncalled-method.js.map +1 -0
  42. package/dist/rules/prefer-do-notation.d.ts +1 -4
  43. package/dist/rules/prefer-do-notation.js +1 -1
  44. package/dist/rules/prefer-do-notation.js.map +1 -1
  45. package/dist/rules/prefer-either.d.ts +1 -4
  46. package/dist/rules/prefer-either.js.map +1 -1
  47. package/dist/rules/prefer-flatmap.d.ts +1 -4
  48. package/dist/rules/prefer-flatmap.js +1 -1
  49. package/dist/rules/prefer-flatmap.js.map +1 -1
  50. package/dist/rules/prefer-fold.d.ts +1 -4
  51. package/dist/rules/prefer-fold.js +1 -1
  52. package/dist/rules/prefer-fold.js.map +1 -1
  53. package/dist/rules/prefer-functype-map.d.ts +1 -4
  54. package/dist/rules/prefer-functype-map.js.map +1 -1
  55. package/dist/rules/prefer-functype-set.d.ts +1 -4
  56. package/dist/rules/prefer-functype-set.js.map +1 -1
  57. package/dist/rules/prefer-list.d.ts +1 -4
  58. package/dist/rules/prefer-list.js +2 -2
  59. package/dist/rules/prefer-list.js.map +1 -1
  60. package/dist/rules/prefer-map.d.ts +1 -4
  61. package/dist/rules/prefer-map.js.map +1 -1
  62. package/dist/rules/prefer-option.d.ts +1 -4
  63. package/dist/rules/prefer-option.js.map +1 -1
  64. package/dist/rules/prefer-try.d.ts +1 -4
  65. package/dist/rules/prefer-try.js +1 -1
  66. package/dist/rules/prefer-try.js.map +1 -1
  67. package/dist/types/ast.d.ts +1 -4
  68. package/dist/utils/array-mutation.d.ts +2 -5
  69. package/dist/utils/array-mutation.js.map +1 -1
  70. package/dist/utils/ast-walk.d.ts +1 -4
  71. package/dist/utils/ast-walk.js.map +1 -1
  72. package/dist/utils/async-detection.d.ts +1 -4
  73. package/dist/utils/async-detection.js.map +1 -1
  74. package/dist/utils/boundary-tags.d.ts +2 -5
  75. package/dist/utils/boundary-tags.js.map +1 -1
  76. package/dist/utils/collection-binding.d.ts +2 -5
  77. package/dist/utils/collection-binding.js.map +1 -1
  78. package/dist/utils/dependency-validator.d.ts +1 -3
  79. package/dist/utils/dependency-validator.js.map +1 -1
  80. package/dist/utils/functype-detection.d.ts +2 -5
  81. package/dist/utils/functype-detection.js +1 -1
  82. package/dist/utils/functype-detection.js.map +1 -1
  83. package/dist/utils/functype-predicates.d.ts +2 -5
  84. package/dist/utils/functype-predicates.js.map +1 -1
  85. package/dist/utils/host-throws.d.ts +2 -5
  86. package/dist/utils/host-throws.js.map +1 -1
  87. package/dist/utils/import-fixer.d.ts +1 -4
  88. package/dist/utils/import-fixer.js.map +1 -1
  89. package/dist/utils/mutable-collection.d.ts +2 -5
  90. package/dist/utils/mutable-collection.js.map +1 -1
  91. package/dist/utils/react-render.d.ts +1 -4
  92. package/dist/utils/react-render.js.map +1 -1
  93. package/dist/utils/readonly-contract.d.ts +1 -4
  94. package/dist/utils/readonly-contract.js.map +1 -1
  95. package/dist/utils/type-aware.d.ts +15 -6
  96. package/dist/utils/type-aware.js +1 -1
  97. package/dist/utils/type-aware.js.map +1 -1
  98. package/dist/utils/wire-types.d.ts +1 -4
  99. package/dist/utils/wire-types.js.map +1 -1
  100. package/package.json +6 -6
  101. package/dist/configs/agent.d.ts +0 -45
  102. package/dist/configs/agent.js +0 -2
  103. package/dist/configs/agent.js.map +0 -1
  104. package/dist/configs/strict.d.ts +0 -26
  105. package/dist/configs/strict.js +0 -2
  106. package/dist/configs/strict.js.map +0 -1
package/README.md CHANGED
@@ -14,61 +14,81 @@ npm install -D eslint-plugin-functype eslint
14
14
  // eslint.config.mjs
15
15
  import functype from "eslint-plugin-functype"
16
16
 
17
- export default [functype.configs.recommended]
17
+ export default [functype.configs.recommended, functype.configs.tests]
18
18
  ```
19
19
 
20
- ### Strict mode
20
+ There is one preset. The code it checks is written by coding agents, and an agent acts on what fails its build and passes over a warning, so every rule is `error` or `off`. `tests` relaxes it for test files.
21
21
 
22
- ```js
23
- import functype from "eslint-plugin-functype"
22
+ - **`error`:** every rule whose precision is measured on real code. A forgotten `.run()`, a dropped `Either` or a throw in render is the kind of mistake an agent makes and a reviewer misses.
23
+ - **`off`:** `prefer-flatmap` and `prefer-do-notation`, whose precision is unmeasured. At `error` they would teach an agent to write `eslint-disable`. Each moves to `error` once it's measured.
24
+ - **At a real boundary, mark it** rather than disable the rule: `@interop <reason>` or `invariant()` for a throw (see below), `Wire<T>` for a data shape.
25
+ - **Type-aware rules:** `no-array-mutation`, `no-floating-io`, `no-floating-result`, `no-serialize-container` and `no-uncalled-method` need typescript-eslint's parser with `parserOptions.projectService`. Without it they report nothing.
26
+ - **Make sure the agent runs lint.** An error it never sees doesn't steer it, so put `eslint` in the check it runs before it's done, such as `pnpm validate`.
24
27
 
25
- export default [functype.configs.strict]
26
- ```
28
+ In 1.x the plugin had three presets: `recommended` and `strict`, which warned on rules still being measured, and `agent`, which didn't. 2.0's `recommended` is 1.x's `agent`, and `strict` and `agent` are gone: a config that names one fails to load (ESLint reports an `Unexpected undefined config`), so update it to `recommended`.
27
29
 
28
- ### Agent mode
30
+ ## TypeScript 7
29
31
 
30
- For code a coding agent writes. An agent acts on what fails its build and passes over a warning, so `agent` has no warnings: every rule is `error` or `off`.
32
+ typescript-eslint, which this plugin runs on, doesn't support TypeScript 7 yet: it loads the TypeScript 6 compiler API, and TypeScript 7.0 ships none. With `typescript@7` as a project's only `typescript`, `npm install` fails on typescript-eslint's peer range, and a forced install fails at lint time with "typescript-eslint does not support TS 7.0". Two paths work today.
31
33
 
32
- ```js
33
- import functype from "eslint-plugin-functype"
34
+ **Run TypeScript 7 side by side with 6.0, which is the setup Microsoft and typescript-eslint point to.** Alias `typescript` to the 6.0 package, so lint loads the 6.0 API, and install TypeScript 7 as `@typescript/native`:
35
+
36
+ ```json
37
+ {
38
+ "devDependencies": {
39
+ "typescript": "npm:@typescript/typescript6@6.0.2",
40
+ "@typescript/native": "npm:typescript@7.0.2"
41
+ }
42
+ }
43
+ ```
44
+
45
+ `tsc` is then TypeScript 7 and `tsc6` is 6.0. Keep the name `@typescript/native`: under npm, the name decides which package's `tsc` gets linked, and with another alias name `tsc` ran 6.0. typescript-eslint 8.73.0 also declares an optional peer `@typescript/native` for TypeScript 7.1 builds, so a package manager may warn that 7.0.2 misses its range, or install a 7.1 nightly beside it; lint results are the same either way. ESLint, typescript-eslint and every rule here, the type-aware ones included, run unchanged. Checked on 2026-11-22 with typescript-eslint 8.73.0, ESLint 10.14.0 and this plugin's 2.127.2: `no-floating-result` and `no-array-mutation` reported, and `tsc` 7.0.2 type-checked the same project.
46
+
47
+ **Or run the plugin in Oxlint, without type information.** Oxlint loads it as a JS plugin, unchanged, on a project with only TypeScript 7. In `.oxlintrc.json`:
34
48
 
35
- export default [functype.configs.agent]
49
+ ```json
50
+ {
51
+ "jsPlugins": ["eslint-plugin-functype"],
52
+ "rules": { "functype/no-let": "error", "functype/prefer-option": "error", "functype/prefer-list": "error" }
53
+ }
36
54
  ```
37
55
 
38
- - **`error`:** everything `strict` errors on, plus `no-floating-io` and the two React rules, which `strict` still warns on while they're measured. A forgotten `.run()` or a throw in render is the kind of mistake an agent makes and a reviewer misses.
39
- - **`off`:** `prefer-flatmap` and `prefer-do-notation`, whose precision is unmeasured. At `error` they would teach an agent to write `eslint-disable`. Each moves to `error` once it's measured. `prefer-list` is off too: with type-aware linting, `no-array-mutation`, at `error`, covers its in-place-change case, and the rest asks for `ReadonlyArray<T>` types, a typing choice `strict` keeps at `warn`.
40
- - `prefer-option`, `prefer-either` and `prefer-try` are `error`, as in `strict`. At a real boundary the agent marks it instead: `@interop <reason>` or `invariant()` for a throw (see below), `Wire<T>` for a data shape.
41
- - `no-array-mutation` and `no-floating-io` need type-aware linting (typescript-eslint's parser with `parserOptions.projectService`). Without it they report nothing.
42
- - Make sure the agent runs lint. An error it never sees doesn't steer it, so put `eslint` in the check it runs before it's done, such as `pnpm validate`.
56
+ Every rule that works without type information works there. The five type-aware rules, `no-array-mutation`, `no-floating-io`, `no-floating-result`, `no-serialize-container` and `no-uncalled-method`, report nothing, because Oxlint doesn't pass type information to JS plugins yet. Checked on 2026-11-22 with Oxlint 1.94.0.
57
+
58
+ When typescript-eslint supports TypeScript 7.1's new compiler API, the 6.0 alias can go and nothing in this plugin changes; its `@typescript/native` peer suggests that name stays. Until then, prefer the side-by-side setup, which keeps the type-aware rules.
43
59
 
44
60
  ## Rules
45
61
 
46
- | Rule | Recommended | Strict | Agent | Description |
47
- | ---------------------------------------- | :---------: | :----: | :---: | -------------------------------------------------------------------------------------------- |
48
- | `functype/no-let` | error | error | error | Use `const`; no reassignment |
49
- | `functype/no-imperative-loops` | error | error | error | Use `List`/array methods, async traversal or `IO.forEach` instead of loops |
50
- | `functype/prefer-functype-map` | error | error | error | Use functype `Map` instead of a native `Map` you only read |
51
- | `functype/prefer-functype-set` | error | error | error | Use functype `Set` instead of a native `Set` you only read |
52
- | `functype/collection-naming` | error | error | error | Import functype's `Map`/`Set` under their own names; spell the built-in `globalThis.Map` |
53
- | `functype/prefer-map` | error | error | error | Use `map` instead of pushing inside `forEach` |
54
- | `functype/prefer-fold` | error | error | error | Use `fold` instead of branching on `isSome()`/`isLeft()`/… |
55
- | `functype/prefer-option` | warn | error | error | Use `Option` instead of `null`/`undefined` |
56
- | `functype/prefer-either` | warn | error | error | Use `Either` for typed domain errors instead of `throw` |
57
- | `functype/prefer-try` | warn | error | error | Use `Try` / `Try.fromPromise` instead of try/catch |
58
- | `functype/prefer-flatmap` | warn | warn | off | Use `flatMap` instead of `map().flat()` |
59
- | `functype/prefer-do-notation` | warn | warn | off | Use `Do` notation for chained operations |
60
- | `functype/no-get-unsafe` | off | error | error | Disallow unsafe extraction (`.orThrow()`, `.expect()`) |
61
- | `functype/prefer-list` | off | warn | off | Use `List` instead of native arrays |
62
- | `functype/no-array-mutation` | off | error | error | Don't change an array in place (`push`, `sort`, `xs[i] = v`…); build a new one |
63
- | `functype/no-floating-io` | off | warn | error | Don't build an `IO` and drop it, or `await` it unrun; run, return or `yield*` it |
64
- | `functype/no-floating-result` | off | error | error | Don't drop an `Either`/`Try` result; a failure in it is silently ignored |
65
- | `functype/no-serialize-container` | off | error | error | Don't send an `Either`/`Option`/`List` to `c.json()` or `JSON.stringify()`; unwrap it first |
66
- | `functype/no-getOrThrow-in-render` | off | warn | error | React: no bare `.orThrow()` in a component or hook body; a throw in render unmounts the tree |
67
- | `functype/must-fold-on-component-return` | off | warn | error | React: render an `Option`/`Either`/`Try` with `fold` or `<MatchOption>`, not a guard or `&&` |
62
+ | Rule | `recommended` | `tests` | Description |
63
+ | ---------------------------------------- | :-----------: | :-----: | -------------------------------------------------------------------------------------------- |
64
+ | `functype/no-let` | error | | Use `const`; no reassignment |
65
+ | `functype/no-imperative-loops` | error | | Use `List`/array methods, async traversal or `IO.forEach` instead of loops |
66
+ | `functype/prefer-functype-map` | error | | Use functype `Map` instead of a native `Map` you only read |
67
+ | `functype/prefer-functype-set` | error | | Use functype `Set` instead of a native `Set` you only read |
68
+ | `functype/collection-naming` | error | | Import functype's `Map`/`Set` under their own names; spell the built-in `globalThis.Map` |
69
+ | `functype/prefer-map` | error | | Use `map` instead of pushing inside `forEach` |
70
+ | `functype/prefer-fold` | error¹ | | Use `fold` instead of branching on `isSome()`/`isLeft()`/… |
71
+ | `functype/prefer-option` | error | off | Use `Option` instead of `null`/`undefined` |
72
+ | `functype/prefer-either` | error | off | Use `Either` for typed domain errors instead of `throw` |
73
+ | `functype/prefer-try` | error | off | Use `Try` / `Try.fromPromise` instead of try/catch |
74
+ | `functype/prefer-flatmap` | off | | Use `flatMap` instead of `map().flat()` |
75
+ | `functype/prefer-do-notation` | off | | Use `Do` notation for chained operations |
76
+ | `functype/no-get-unsafe` | error² | | Disallow unsafe extraction (`.orThrow()`, `.expect()`) |
77
+ | `functype/prefer-list` | error | | Use `List` instead of native arrays |
78
+ | `functype/no-array-mutation` | error | | Don't change an array in place (`push`, `sort`, `xs[i] = v`…); build a new one |
79
+ | `functype/no-floating-io` | error | | Don't build an `IO` and drop it, or `await` it unrun; run, return or `yield*` it |
80
+ | `functype/no-floating-result` | error | off | Don't drop an `Either`/`Try` result; a failure in it is silently ignored |
81
+ | `functype/no-serialize-container` | error | off | Don't send an `Either`/`Option`/`List` to `c.json()` or `JSON.stringify()`; unwrap it first |
82
+ | `functype/no-uncalled-method` | error | | Call a functype method: `list.head()`, not `list.head`; read without `()` it is the function |
83
+ | `functype/no-getOrThrow-in-render` | error | | React: no bare `.orThrow()` in a component or hook body; a throw in render unmounts the tree |
84
+ | `functype/must-fold-on-component-return` | error | | React: render an `Option`/`Either`/`Try` with `fold` or `<MatchOption>`, not a guard or `&&` |
85
+
86
+ ¹ With `checkGuards: true`: a guard followed by an unwrap is reported too.
87
+ ² Allowed in test files by its own `allowInTests` option.
68
88
 
69
89
  ### Severity policy
70
90
 
71
- A rule is **`error` in `recommended` once it is right on ~95–99% of real code**, meaning its known false-positive classes are closed. It stays `warn` only while those classes are still open. FP here is governance: a rule that is reliably right should fail the build, not print advice nobody reads. Expect `recommended` to get stricter as boundary markers (`Wire<T>`, `@interop`) close the remaining cases for `prefer-option`, `prefer-either` and `prefer-try`.
91
+ A rule is **`error` once it is right on ~95–99% of real code**, meaning its known false-positive classes are closed. Until then it is `off`, never `warn`: a warning is advice an agent passes over, and a rule that is reliably right should fail the build.
72
92
 
73
93
  `prefer-fold` reports only; its rewrite is a suggestion you apply, never an autofix, so `eslint --fix` can't change code on your behalf.
74
94
 
@@ -136,11 +156,11 @@ Prefer either tool to `eslint-disable`. A disable covers a whole file or line an
136
156
 
137
157
  ### `functype/prefer-list`
138
158
 
139
- | Option | Default | Description |
140
- | --------------------- | :-----: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
141
- | `allowArraysInTests` | `true` | Silence the rule inside test files (`.test.ts`, `.spec.ts`, `__tests__/`, `/test/`, `/tests/`). |
142
- | `allowReadonlyArrays` | `true` | When `true`, `ReadonlyArray<T>` **and** `readonly T[]` pass. When `false`, both are flagged consistently. Use `false` in combination with `Wire<T>` from `functype` to hold the rule at `error` — every unmarked `ReadonlyArray<T>` becomes a lint error, and wrapping a boundary type in `Wire<…>` is the explicit escape hatch. |
143
- | `allowArrayLiterals` | `false` | When `true`, `const xs = [1, 2, 3]` is not reported. Useful when you want type-position enforcement but tolerate idiomatic literals like `[...map.entries()]`. Mutable `T[]` in type positions is always reported regardless. |
159
+ | Option | Default | Description |
160
+ | --------------------- | :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
161
+ | `allowArraysInTests` | `true` | Silence the rule inside test files (`.test.ts`, `.spec.ts`, `__tests__/`, `/test/`, `/tests/`). |
162
+ | `allowReadonlyArrays` | `true` | When `true`, `ReadonlyArray<T>`, `readonly T[]` **and** `Readonly<T[]>` pass. When `false`, all three are flagged consistently. Use `false` in combination with `Wire<T>` from `functype` to hold the rule at `error` — every unmarked `ReadonlyArray<T>` becomes a lint error, and wrapping a boundary type in `Wire<…>` is the explicit escape hatch. |
163
+ | `allowArrayLiterals` | `false` | When `true`, `const xs = [1, 2, 3]` is not reported. Useful when you want type-position enforcement but tolerate idiomatic literals like `[...map.entries()]`. Mutable `T[]` in type positions is always reported regardless. |
144
164
 
145
165
  **What it reports.** The defect is a collection that can change under you, so:
146
166
 
@@ -161,7 +181,7 @@ Prefer either tool to `eslint-disable`. A disable covers a whole file or line an
161
181
 
162
182
  **Without type information, array literals aren't reported at all.** The rule can't tell a literal handed to a library from one of your own, so it reports neither rather than guess. Type positions and in-place mutation are still reported. Turn on type-aware linting to get literal checks.
163
183
 
164
- Also skipped: `as const` and other tuple assertions, tuple rest elements (`[string, ...string[]]`), rest parameters (`...args: T[]`), literals passed straight into `List(…)` / `Set(…)`, and files marked generated (`@generated`, "auto-generated", "DO NOT EDIT"). Generators with no marker, such as Supabase's types, need an `ignores` entry. Anything still reported that is a deliberate host shape gets `Wire<…>`.
184
+ Also skipped: `as const` and other tuple assertions, tuple rest elements (`[string, ...string[]]`), rest parameters (`...args: T[]`), literals passed straight into `List(…)` / `Set(…)`, and files marked generated (`@generated`, "auto-generated", "DO NOT EDIT"). Supabase's generated types carry no marker, so a file whose top level exports both `Json` and `Database` is skipped too. Any other generator with no marker needs an `ignores` entry. Anything still reported that is a deliberate host shape gets `Wire<…>`.
165
185
 
166
186
  Measured on five consumers (2026-10-10), with type-aware linting: **2,000 hits under 2.114, 696 after.** By repo, before → after: a private app monorepo 821 → 215, agent-todo 843 → 328, dokploy-mcp-server 170 → 68, ts-builds 111 → 43, supabase-typed-query 55 → 42. Known false positives left: 25 hits in agent-todo's unmarked Supabase types (an `ignores` entry), one nested ReactFlow return type (`Wire`), one AWS SES request built in an untyped object. Linting all of that monorepo with the rule on takes about 18 seconds.
167
187
 
@@ -215,7 +235,9 @@ For a host that has to mutate, such as a charting library that takes the array i
215
235
  | `allowInTests` | `true` | Silence the rule inside test files. |
216
236
  | `allowInteropMarker` | `true` | Skip code inside a declaration tagged `@interop <reason>`. |
217
237
 
218
- Measured on five consumers (2026-10-10): 91 hits, every one a real in-place mutation. Most were `push` accumulators building a list or a Markdown body line by line; the rest were `sort` on a named array and element assignment. It's `off` in `recommended` until 2.0, to avoid failing builds on a 1.x upgrade.
238
+ Measured on five consumers (2026-10-10): 91 hits, every one a real in-place mutation. Most were `push` accumulators building a list or a Markdown body line by line; the rest were `sort` on a named array and element assignment. It's `error` in every preset since 2.0. In 1.x it was `off` in `recommended`, to avoid failing builds on a minor upgrade.
239
+
240
+ A local array that is declared and then changed by a method or an index write (`acc.push(x)`, `acc[i] = x`) is reported once, here at the change: with type information, `prefer-list` leaves its declaration to this rule. Without type information this rule reports nothing, so `prefer-list` reports the declaration instead. A field, a change through an alias, `acc[i]++` and `delete acc[i]` can still be reported by both. The dedupe assumes this rule is on, as it is in `recommended`.
219
241
 
220
242
  ### `functype/no-floating-io`
221
243
 
@@ -236,7 +258,7 @@ void save(user) // fine: a deliberate drop
236
258
 
237
259
  **It only runs with type-aware linting** (`parserOptions.projectService`). It recognizes `IO` by its type (it has `runExit` and `provideLayer`), whatever the call is named. Without type information it reports nothing.
238
260
 
239
- Measured (2026-10-16) on functype's own source and tests, functype-log, functype-react, agent-todo's agent-gate-api and a private web app's API: 0 false positives across about 1,340 IO-typed calls. The only hits were four deliberate drops in type-only tests. It's `off` in `recommended` and `warn` in `strict` while it is measured further.
261
+ Measured (2026-10-16) on functype's own source and tests, functype-log, functype-react, agent-todo's agent-gate-api and a private web app's API: 0 false positives across about 1,340 IO-typed calls. The only hits were four deliberate drops in type-only tests. It's `error` in `recommended`.
240
262
 
241
263
  ### `functype/no-floating-result`
242
264
 
@@ -252,14 +274,14 @@ await audit.write(entry).tapLeft((e) => log.error(e)) // fine: a best-effort wri
252
274
  void (await cache.refresh()) // fine: a deliberate drop
253
275
  ```
254
276
 
255
- - **What counts:** a type, or a member of its union, with `fold` and `isLeft` or `isFailure`. That covers `Either`, `Try`, `Exit`, `Validation`, `Task`'s result (`TaskOutcome`) and Either-shaped wrappers such as a `ServiceResult`. An ignored `Option` or `List` loses no error, so it isn't reported. An `IO` that is never run is `no-floating-io`'s.
277
+ - **What counts:** a type, or a member of its union, with `fold` and `isLeft` or `isFailure`. That covers `Either`, `Try`, `Exit`, `Validation` and Either-shaped wrappers such as a `ServiceResult`. An ignored `Option` or `List` loses no error, so it isn't reported. An `IO` that is never run is `no-floating-io`'s.
256
278
  - **Handled chains:** a chain that passes through `.tapError(…)` or `.tapLeft(…)` isn't reported, because it handles its failure. A `.flatMap(…)` after the handler can bring in a new failure, so that chain is reported again. `Try` has no failure tap, so mark a deliberate `Try` drop with `void`.
257
279
  - **Tests:** a test that calls something for its side effect and then checks mocks is reported too. Assert on the result, or turn the rule off for test files.
258
280
  - **Not seen yet:** a drop inside a callback, such as `xs.forEach((x) => save(x))`, or in the first part of a comma expression, isn't its own statement, so it isn't reported. `ok && save(x)` and `ok ? a() : b()` are.
259
281
 
260
282
  **It only runs with type-aware linting** (`parserOptions.projectService`). Without type information it reports nothing.
261
283
 
262
- Measured (2026-10-30) on agent-todo's agent-gate-api, which kept a hand-written check for this: at the commit that added that check, the rule reports 20 drops in production code. agent-todo fixed every one of them as a real bug, among them 8 in the Stripe webhook handler, where a failed write still answered Stripe 200. On the current code, after those fixes, it reports none in production code and 12 in tests. functype-os, functype-log, functype-react, functype-eval and functype-mcp-server report none. It's `error` in `strict` and `agent`, and `off` in `recommended`, where it moves to `error` in 2.0.
284
+ Measured (2026-10-30) on agent-todo's agent-gate-api, which kept a hand-written check for this: at the commit that added that check, the rule reports 20 drops in production code. agent-todo fixed every one of them as a real bug, among them 8 in the Stripe webhook handler, where a failed write still answered Stripe 200. On the current code, after those fixes, it reports none in production code and 12 in tests. functype-os, functype-log, functype-react, functype-eval and functype-mcp-server report none. It's `error` in `recommended`, and `off` in `tests`, where a result is often dropped on purpose.
263
285
 
264
286
  ### `functype/no-serialize-container`
265
287
 
@@ -281,27 +303,39 @@ return c.json(result.toJSON()) // fine: the envelope on purpose
281
303
 
282
304
  **It only runs with type-aware linting** (`parserOptions.projectService`). Without type information it reports nothing.
283
305
 
284
- Measured (2026-10-31) on agent-todo's agent-gate-api, which kept a hand-written check for this. Before its fix commit (f002b90), the rule reports 4 calls, and each is a bug agent-todo fixed: `GET /billing`, which showed every paying user "billing account isn't properly linked" for about nine months; `PATCH /user/me` and `PATCH /user/preferences`, which answered 200 with a `Left` in the body; and an MCP tool that reported success on failure. On the current code it reports none, and none in agent-todo's UI or in functype's own packages. It's `error` in `strict` and `agent`, and `off` in `recommended`, where it moves to `error` in 2.0.
306
+ Measured (2026-10-31) on agent-todo's agent-gate-api, which kept a hand-written check for this. Before its fix commit (f002b90), the rule reports 4 calls, and each is a bug agent-todo fixed: `GET /billing`, which showed every paying user "billing account isn't properly linked" for about nine months; `PATCH /user/me` and `PATCH /user/preferences`, which answered 200 with a `Left` in the body; and an MCP tool that reported success on failure. On the current code it reports none, and none in agent-todo's UI or in functype's own packages. It's `error` in `recommended`, and `off` in `tests`, which assert on a container's `JSON.stringify` envelope.
285
307
 
286
- ### React rules
308
+ ### `functype/no-uncalled-method`
287
309
 
288
- Two rules are for React code. They fire only inside a **component** (a function named in PascalCase whose body has JSX, including one wrapped in `memo` or `forwardRef`) or a **hook** (a function named `use` + a capital letter), so other code rarely trips them. The one exception is a non-React function whose name starts with `use` + a capital letter, which is read as a hook. Both are `off` in `recommended` and `warn` in `strict` while they're measured on real React code. To turn them on with `recommended`:
310
+ Reports a functype method read as a value instead of called. On functype 2, `head`, `last`, `tail`, `init`, `headOption` and `lastOption` are methods, and a read without `()` compiles wherever any value is accepted. It yields the function itself: always truthy, never the element. A detached functype method also throws when it's called later.
289
311
 
290
- ```js
291
- import functype from "eslint-plugin-functype"
292
-
293
- export default [
294
- functype.configs.recommended,
295
- {
296
- files: ["**/*.tsx", "**/*.jsx"],
297
- rules: {
298
- "functype/no-getOrThrow-in-render": "error",
299
- "functype/must-fold-on-component-return": "warn",
300
- },
301
- },
302
- ]
312
+ ```ts ignore
313
+ const checkout = results.head // reported: a function, so `if (!checkout)` is never taken
314
+ return Option(results.head) // reported: Some(<function>), not Some(firstRow)
315
+ expect(results.head).toEqual(row) // reported
316
+ if (opt.isSome) {
317
+ } // reported: always true
318
+ const { head } = results // reported
319
+
320
+ results.head() // fine
321
+ results.headOption() // fine
322
+ results.head.bind(results) // fine: the function on purpose
323
+ results.size // fine: a property
303
324
  ```
304
325
 
326
+ - **What counts:** a member declared as a method in functype's own files, read on a value with `_tag` and `fold`. A type of your own with that shape, or an interface extending `List` with methods of its own, isn't reported for those methods. Getters such as `size` and `isEmpty`, and function-valued data such as `Some(fn).value` or a `Ref` holding a callback, are never reported.
327
+ - **Deliberate uses:** a call (`?.()`, `new` and a tagged template included, also through `as`, `!` or `satisfies`), `.bind` / `.call` / `.apply`, `typeof`, an assignment target, and `delete`.
328
+ - **Not covered yet:** destructuring in parameters, nested patterns and `for…of`, and computed reads with a variable key (`results[key]`).
329
+ - **Why a lint rule:** the upgrade tool rewrites these reads once, in your own code. The rule keeps them from coming back, and runs in libraries that never run the upgrade tool.
330
+
331
+ **It only runs with type-aware linting** (`parserOptions.projectService`). Without type information it reports nothing.
332
+
333
+ Measured (2026-11-22) on seven codebases on functype 1.x and 2.x, 1,126 files: no hits. Run on a library's code from before its 2.0 port, it reports the `Option(list.head)` that library shipped. It's `error` in `recommended`, and stays on in `tests`: `expect(list.head)` is one of the bugs it's for.
334
+
335
+ ### React rules
336
+
337
+ Two rules are for React code. They fire only inside a **component** (a function named in PascalCase whose body has JSX, including one wrapped in `memo` or `forwardRef`) or a **hook** (a function named `use` + a capital letter), so other code rarely trips them. The one exception is a non-React function whose name starts with `use` + a capital letter, which is read as a hook. Both are `error` in `recommended`.
338
+
305
339
  Both work without type information. With it (`parserOptions.projectService`), the receiver must also be a functype container, so an unrelated object that happens to have an `orThrow` or `isSome` method is not reported.
306
340
 
307
341
  Only the component's or hook's own body counts as render. An event handler, an effect, or a callback passed to `.map` is a separate function, so a call there is not reported. That also means a call inside a callback that does run during render (`useMemo(() => …)`, `items.map((o) => o.orThrow())` in JSX) is missed: the rules prefer missing a case to reporting valid code.
@@ -361,7 +395,7 @@ const header = <h1>{user.isSome() && <Badge />}</h1> // reported → {user.fold(
361
395
 
362
396
  The message names the `Match` component that fits: `<MatchOption>` for `isSome`/`isNone`, `<MatchEither>` for `isLeft`/`isRight`, `<MatchTry>` for `isSuccess`/`isFailure`.
363
397
 
364
- A ternary or an if/else on a predicate is `prefer-fold`'s, everywhere, so this rule leaves it alone rather than report it twice. If you turn on `prefer-fold`'s `checkGuards`, an early return followed by an unwrap is reported by both rules. Only a predicate _call_ counts: `state.isPending` on a `useIO` result and `items.isEmpty` are properties, and are never reported. A guard that does other work before it returns, or returns something other than JSX or `null`, is not reported either. The rule reports only; there are no suggestions, because the rewrite moves code between branches.
398
+ A ternary or an if/else on a predicate is `prefer-fold`'s, everywhere, so this rule leaves it alone rather than report it twice. `prefer-fold`'s `checkGuards` is on in `recommended`, so an early return followed by an unwrap is reported by both rules. Only a predicate _call_ counts: `state.isPending` on a `useIO` result and `items.isEmpty` are properties, and are never reported. A guard that does other work before it returns, or returns something other than JSX or `null`, is not reported either. The rule reports only; there are no suggestions, because the rewrite moves code between branches.
365
399
 
366
400
  | Option | Default | Description |
367
401
  | -------------------- | :-----: | ---------------------------------------------------------- |
@@ -381,7 +415,7 @@ Measured (2026-10-25) with both rules on functype-react's source and tests (type
381
415
 
382
416
  `.orThrow(error)` and `.orThrow((e) => error)` are not reported: the caller chose the error, which is the documented way to throw for a host that needs it (see the decision table above). A bare `.orThrow()` throws a generic error and is reported.
383
417
 
384
- The rule reports each match with two suggestions — `.orElse(default)` for value fallback and `.fold(onNone, onSome)` for branch handling. There is no autofix: the correct replacement depends on human judgment about a default value, and `.expect(msg)` would silently lose its argument. Apply a suggestion explicitly in your editor when you know which one fits.
418
+ The rule reports each match with two suggestions — `.getOrElse(() => default)` for value fallback and `.fold(onNone, onSome)` for branch handling. There is no autofix: the correct replacement depends on human judgment about a default value, and `.expect(msg)` would silently lose its argument. Apply a suggestion explicitly in your editor when you know which one fits.
385
419
 
386
420
  ### `functype/prefer-fold`
387
421
 
@@ -389,16 +423,16 @@ The rule reports each match with two suggestions — `.orElse(default)` for valu
389
423
  | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
390
424
  | `minComplexity` | `2` | Minimum if/else chain length (root + branches) before it is reported. |
391
425
  | `checkNullable` | `false` | Also report null checks on plain values (`x === null ? a : b`). Off because whether `x` should be an `Option` is `prefer-option`'s call; at `error` this path fired on JSX, style objects and conditional spreads. |
392
- | `checkGuards` | `false` | Also report a guard followed by an unwrap: `if (e.isLeft()) return …` and then `e.value` / `e.orThrow()` / `e.get()` later in the same block. Off while it rolls out: `prefer-fold` is `error` in `recommended`. |
426
+ | `checkGuards` | `false` | Also report a guard followed by an unwrap: `if (e.isLeft()) return …` and then `e.value` / `e.orThrow()` / `e.get()` later in the same block. On in `recommended`. |
393
427
 
394
- Reports only; the rewrite is a **suggestion, never an autofix**. A fold rewrite can't be proven type-correct without type information, and `eslint --fix` applies fixable rules at warn severity too, so an autofix here would rewrite working code during `validate`. The suggestion reads narrowed values through the fold's parameters (`e.value` after `isLeft()` becomes `left`), omits unused parameters, keeps `return` on if/else chains, parenthesizes object-literal branches, and offers `a.or(b)` for `a.isSome() ? a : b`. Rewrites follow the syntax tree, so text inside strings, template literals and comments is left alone. No suggestion is offered when the rewrite would drop a comment or could not type-check (`a.isSome() ? a : 5`). Suggestions are applied by hand, so review each one: the rule has no type information and can't prove the result compiles.
428
+ Reports only; the rewrite is a **suggestion, never an autofix**. A fold rewrite can't be proven type-correct without type information, and `eslint --fix` applies fixable rules at warn severity too, so an autofix here would rewrite working code during `validate`. The suggestion reads narrowed values through the fold's parameters (`e.value` after `isLeft()` becomes `left`), omits unused parameters, keeps `return` on if/else chains, parenthesizes object-literal branches, and offers `a.orElse(() => b)` for `a.isSome() ? a : b`. Rewrites follow the syntax tree, so text inside strings, template literals and comments is left alone. No suggestion is offered when the rewrite would drop a comment or could not type-check (`a.isSome() ? a : 5`). Suggestions are applied by hand, so review each one: the rule has no type information and can't prove the result compiles.
395
429
 
396
- **`checkGuards`: guard, then unwrap.** Checking a container with an early exit and then pulling the value out is imperative branching. Getting a value out is fine: `orElse(default)` and `fold` are both proper exits and are never reported. What's reported is the shape below. The message picks its advice from what the guard does:
430
+ **`checkGuards`: guard, then unwrap.** Checking a container with an early exit and then pulling the value out is imperative branching. Getting a value out is fine: `getOrElse(() => default)` and `fold` are both proper exits and are never reported. What's reported is the shape below. The message picks its advice from what the guard does:
397
431
 
398
432
  ```ts ignore
399
433
  if (e.isLeft()) return e // hands the failure back → e.flatMap(…) / e.map(…)
400
434
  if (e.isLeft()) return Left({ kind: e.value.kind }) // a new failure → e.mapLeft(…).flatMap(…)
401
- if (o.isNone()) return 0 // a fallback → o.map(…).orElse(0), or o.fold(() => 0, …)
435
+ if (o.isNone()) return 0 // a fallback → o.map(…).getOrElse(() => 0), or o.fold(() => 0, …)
402
436
  if (r.isLeft()) return c.json({ error: r.value }, 500) // fallback reads the failure → r.fold(…), only
403
437
  if (a.isLeft()) return a
404
438
  if (b.isLeft()) return b // several in a row → Do(function* () { … })
@@ -411,7 +445,7 @@ if (t.isFailure()) {
411
445
 
412
446
  `orThrow(error)` / `orThrow((e) => …)` after a guard isn't counted as an unwrap, matching `no-get-unsafe`, which treats a named error as a deliberate host throw. A receiver reassigned after the guard isn't reported. Only the negative predicates (`isLeft` / `isNone` / `isFailure`) are matched; `if (!e.isRight())` isn't yet.
413
447
 
414
- Pass-through guards are the clear case: they are hand-written `flatMap`. Fallback and other-work-first guards are closer to a style choice, since TypeScript narrows `Either` after the guard (Rust's `let-else` and Swift's `guard let` make the same trade). For `Option` and `Try` the guard doesn't narrow `.value`, so the case is stronger there. That split is why this is planned for `strict`, not `recommended`, in 2.0.
448
+ Pass-through guards are the clear case: they are hand-written `flatMap`. Fallback and other-work-first guards are closer to a style choice, since TypeScript narrows `Either` after the guard (Rust's `let-else` and Swift's `guard let` make the same trade). For `Option` and `Try` the guard doesn't narrow `.value`, so the case is stronger there. It is on in `recommended`. To turn it off, set `"functype/prefer-fold": ["error", { "checkGuards": false }]`; a bare `"error"` after the preset keeps it on, because ESLint keeps the earlier options.
415
449
 
416
450
  When the code after the guard awaits, the advice uses `flatMapAsync` / `foldAsync`. Declarations tagged `@interop <reason>` are skipped. On a private app monorepo it finds 75 guards, all of this shape.
417
451
 
@@ -450,7 +484,7 @@ Return types, variables, class fields and generic arguments (`Array<string | und
450
484
  | Option | Default | Description |
451
485
  | ------------------- | ------- | ----------------------------------------------------------------------------------------- |
452
486
  | `minChainDepth` | `3` | Report a `.flatMap(…)` chain once it has this many `flatMap`/`map`/`filter`/`fold` steps. |
453
- | `detectMixedMonads` | `true` | Report a composition chain that moves between Option, Either, Try and Task. |
487
+ | `detectMixedMonads` | `true` | Report a composition chain that moves between Option, Either and Try. |
454
488
 
455
489
  It reports three shapes, each once, at the outermost step:
456
490
 
@@ -462,7 +496,7 @@ Option(x)
462
496
  user && user.profile && user.profile.name // a guard on each step of a path → user?.profile?.name
463
497
  ```
464
498
 
465
- - **Only chains on a monad count.** With type information the type of the value each step is called on decides, so an array's `.flatMap(…)` chain is never reported, and neither is one after `.getOrElse([])` or `.fold(…)` has unwrapped the monad. Without it, the chain must start from a monad constructor, companion or conversion (`Option(x)`, `Either.right(x)`, `Try(f).toOption()`), an identifier annotated with a monad type, or one named like a monad (`option`, `result`, or a capitalized suffix such as `userOption`; `entry` and `registry` don't count).
499
+ - **Only chains on a monad count.** With type information the type of the value each step is called on decides, so an array's `.flatMap(…)` chain is never reported, and neither is one after `.getOrElse(() => [])` or `.fold(…)` has unwrapped the monad. Without it, the chain must start from a monad constructor, companion or conversion (`Option(x)`, `Either.right(x)`, `Try(f).toOption()`), an identifier annotated with a monad type, or one named like a monad (`option`, `result`, or a capitalized suffix such as `userOption`; `entry` and `registry` don't count).
466
500
  - **Mixing is read along the chain**, from the monad each step's callback returns. A conversion such as `.toOption()` keeps the chain in one monad, and a monad built somewhere inside a callback isn't a step.
467
501
  - **A guard chain is read from the AST.** Each operand must be a property of the one before it, so `isAdmin && settings.theme && user.profile.name` isn't one.
468
502
  - **It has no autofix.** It reports only, so `eslint --fix` can't change code on its behalf.
@@ -541,7 +575,7 @@ import functype from "eslint-plugin-functype"
541
575
  export default [recommended, functype.configs.recommended, testOverrides, functype.configs.tests]
542
576
  ```
543
577
 
544
- `functype.configs.tests` turns off `prefer-option`, `prefer-either` and `prefer-try` for the same test files as `test-overrides`: tests call plain `T | undefined` APIs and assert on thrown errors. It changes no other rule. `no-let` and `no-imperative-loops` already skip test files themselves, unless you set their `allowInTests: false`. Put both after the recommended configs, so they win.
578
+ `functype.configs.tests` turns off `prefer-option`, `prefer-either`, `prefer-try`, `no-floating-result` and `no-serialize-container` for the same test files as `test-overrides`: tests call plain `T | undefined` APIs, assert on thrown errors, drop results on purpose and assert on `JSON.stringify` envelopes. It changes no other rule. `no-let` and `no-imperative-loops` already skip test files themselves, unless you set their `allowInTests: false`. Put both after the recommended configs, so they win.
545
579
 
546
580
  ## License
547
581
 
@@ -1 +1 @@
1
- {"version":3,"file":"list-rules.js","names":["plugin","colors","colorize","color","text","printDependencyStatus","result","icon","dep","warning","status","statusColor","main","args","showHelp","showUsage","checkDeps","validatePeerDependencies","rules","rule","ruleName","fullName","typeColor","printCustomUsageInfo","error"],"sources":["../../src/cli/list-rules.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport plugin from \"../index.js\"\nimport { validatePeerDependencies, type ValidationResult } from \"../utils/dependency-validator.js\"\n\n// Colors for console output\nconst colors = {\n reset: \"\\x1b[0m\",\n bright: \"\\x1b[1m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n} as const\n\nfunction colorize(text: string, color: keyof typeof colors): string {\n return colors[color] + text + colors.reset\n}\n\n// Removed unused utility functions - they were for the old config-based approach\n\nfunction printDependencyStatus(result: ValidationResult): void {\n console.log(colorize(\"\\n🔍 Dependency Status Check:\", \"bright\"))\n console.log(colorize(\"=\".repeat(40), \"blue\"))\n\n // Show available dependencies\n if (result.available.length > 0) {\n console.log(colorize(\"\\n✅ Available:\", \"green\"))\n result.available.forEach((dep) => {\n const icon = dep.required ? \"🔧\" : \"🔌\"\n console.log(` ${icon} ${colorize(dep.name, \"green\")} - ${dep.description}`)\n })\n }\n\n // Show missing dependencies\n if (result.missing.length > 0) {\n console.log(colorize(\"\\n❌ Missing:\", \"red\"))\n result.missing.forEach((dep) => {\n const icon = dep.required ? \"⚠️ \" : \"💡\"\n const color = dep.required ? \"red\" : \"yellow\"\n console.log(` ${icon} ${colorize(dep.name, color)} - ${dep.description}`)\n })\n\n if (result.installCommand) {\n console.log(colorize(\"\\n📦 Install missing dependencies:\", \"bright\"))\n console.log(` ${colorize(result.installCommand, \"cyan\")}`)\n }\n }\n\n // Show warnings\n if (result.warnings.length > 0) {\n console.log(colorize(\"\\n⚠️ Warnings:\", \"yellow\"))\n result.warnings.forEach((warning) => console.log(` ${warning}`))\n }\n\n // Overall status\n const status = result.isValid ? \"✅ Ready to use\" : \"❌ Configuration will fail\"\n const statusColor = result.isValid ? \"green\" : \"red\"\n console.log(colorize(`\\n${status}`, statusColor))\n}\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2)\n const showHelp = args.includes(\"--help\") || args.includes(\"-h\")\n const showUsage = args.includes(\"--usage\") || args.includes(\"-u\")\n const checkDeps = args.includes(\"--check-deps\") || args.includes(\"--check\")\n\n if (showHelp) {\n console.log(colorize(\"📋 ESLint Plugin Functype - Custom Rules\", \"bright\"))\n console.log(\"\\nUsage: pnpm run list-rules [options]\")\n console.log(\"\\nOptions:\")\n console.log(\" --verbose, -v Show rule descriptions and schemas\")\n console.log(\" --usage, -u Show usage examples\")\n console.log(\" --check-deps Check peer dependency status\")\n console.log(\" --help, -h Show this help message\")\n console.log(\"\\nThis command lists all custom rules provided by the functype plugin.\")\n return\n }\n\n // Handle dependency check\n if (checkDeps) {\n console.log(colorize(\"🔧 ESLint Plugin Functype - Dependency Check\", \"bright\"))\n const result = validatePeerDependencies()\n printDependencyStatus(result)\n\n if (!result.isValid) {\n process.exit(1)\n }\n return\n }\n\n console.log(colorize(\"🔧 ESLint Plugin Functype - Custom Rules\", \"bright\"))\n\n if (!plugin.rules) {\n console.error(colorize(\"❌ No rules found in plugin.\", \"red\"))\n process.exit(1)\n }\n\n console.log(colorize(\"\\n📦 Available Custom Rules:\", \"bright\"))\n console.log(colorize(\"=\".repeat(40), \"blue\"))\n\n const rules = Object.keys(plugin.rules)\n\n rules.forEach((ruleName) => {\n const rule = plugin.rules[ruleName]\n const fullName = `functype/${ruleName}`\n\n console.log(`\\n${colorize(\"●\", \"green\")} ${colorize(fullName, \"bright\")}`)\n\n if (rule.meta?.docs?.description) {\n console.log(` ${colorize(\"Description:\", \"cyan\")} ${rule.meta.docs.description}`)\n }\n\n if (rule.meta?.type) {\n const typeColor = rule.meta.type === \"problem\" ? \"red\" : rule.meta.type === \"suggestion\" ? \"yellow\" : \"blue\"\n console.log(` ${colorize(\"Type:\", \"cyan\")} ${colorize(rule.meta.type, typeColor)}`)\n }\n\n if (rule.meta?.fixable) {\n console.log(` ${colorize(\"Fixable:\", \"cyan\")} ${colorize(\"Yes\", \"green\")}`)\n }\n\n if (showUsage) {\n console.log(` ${colorize(\"Usage:\", \"cyan\")} \"${fullName}\": \"error\"`)\n }\n })\n\n console.log(colorize(`\\n📊 Summary: ${rules.length} custom rules available`, \"bright\"))\n\n if (showUsage) {\n printCustomUsageInfo()\n }\n\n console.log(colorize(\"\\n💡 Tips:\", \"bright\"))\n console.log(\"• Use --verbose to see detailed rule information\")\n console.log(\"• Use --usage to see configuration examples\")\n console.log('• All rules are prefixed with \"functype/\"')\n console.log(\"• Consider using eslint-config-functype for pre-configured setup\")\n\n console.log(colorize(\"\\n🔗 Links:\", \"bright\"))\n console.log(\"• Documentation: https://github.com/jordanburke/eslint-plugin-functype\")\n console.log(\"• Configuration Bundle: https://github.com/jordanburke/eslint-config-functype\")\n console.log(\"• Functype Library: https://github.com/jordanburke/functype\")\n}\n\nfunction printCustomUsageInfo(): void {\n console.log(colorize(\"\\n💡 Usage Examples:\", \"bright\"))\n console.log(colorize(\"=\".repeat(30), \"blue\"))\n console.log(\"\\n\" + colorize(\"ESLint 9+ (flat config):\", \"green\"))\n console.log(' import functypePlugin from \"eslint-plugin-functype\"')\n console.log(\" export default [\")\n console.log(\" {\")\n console.log(\" plugins: { functype: functypePlugin },\")\n console.log(\" rules: {\")\n console.log(' \"functype/prefer-option\": \"error\",')\n console.log(' \"functype/prefer-either\": \"error\",')\n console.log(' \"functype/no-get-unsafe\": \"error\",')\n console.log(\" }\")\n console.log(\" }\")\n console.log(\" ]\")\n console.log(\"\\n\" + colorize(\"With eslint-config-functype (recommended):\", \"green\"))\n console.log(' import functypeConfig from \"eslint-config-functype\"')\n console.log(\" export default [functypeConfig.recommended]\")\n}\n\n// Run the CLI\nmain().catch((error) => {\n console.error(colorize(\"❌ Unexpected error:\", \"red\"), error)\n process.exit(1)\n})\n"],"mappings":";uGAMA,MAAMC,EAAS,CACb,MAAO,UACP,OAAQ,UACR,IAAK,WACL,MAAO,WACP,OAAQ,WACR,KAAM,WACN,QAAS,WACT,KAAM,UACR,EAEA,SAASC,EAAS,EAAc,EAAoC,CAClE,OAAOD,EAAOE,GAASC,EAAOH,EAAO,KACvC,CAIA,SAASI,EAAsB,EAAgC,CAC7D,QAAQ,IAAIH,EAAS;6BAAiC,QAAQ,CAAC,EAC/D,QAAQ,IAAIA,EAAS,IAAI,OAAO,EAAE,EAAG,MAAM,CAAC,EAGxCI,EAAO,UAAU,OAAS,IAC5B,QAAQ,IAAIJ,EAAS;cAAkB,OAAO,CAAC,EAC/CI,EAAO,UAAU,QAAS,GAAQ,CAChC,IAAMC,EAAOC,EAAI,SAAW,KAAO,KACnC,QAAQ,IAAI,KAAKD,EAAK,GAAGL,EAASM,EAAI,KAAM,OAAO,EAAE,KAAKA,EAAI,aAAa,CAC7E,CAAC,GAICF,EAAO,QAAQ,OAAS,IAC1B,QAAQ,IAAIJ,EAAS;YAAgB,KAAK,CAAC,EAC3CI,EAAO,QAAQ,QAAS,GAAQ,CAC9B,IAAMC,EAAOC,EAAI,SAAW,MAAQ,KAC9BL,EAAQK,EAAI,SAAW,MAAQ,SACrC,QAAQ,IAAI,KAAKD,EAAK,GAAGL,EAASM,EAAI,KAAML,CAAK,EAAE,KAAKK,EAAI,aAAa,CAC3E,CAAC,EAEGF,EAAO,iBACT,QAAQ,IAAIJ,EAAS;kCAAsC,QAAQ,CAAC,EACpE,QAAQ,IAAI,MAAMA,EAASI,EAAO,e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,EAAE,EAAG,MAAM,CAAC,EAC5C,QAAQ,IAAI;EAAOA,EAAS,2BAA4B,OAAO,CAAC,EAChE,QAAQ,IAAI,uDAAuD,EACnE,QAAQ,IAAI,oBAAoB,EAChC,QAAQ,IAAI,OAAO,EACnB,QAAQ,IAAI,8CAA8C,EAC1D,QAAQ,IAAI,gBAAgB,EAC5B,QAAQ,IAAI,4CAA4C,EACxD,QAAQ,IAAI,4CAA4C,EACxD,QAAQ,IAAI,4CAA4C,EACxD,QAAQ,IAAI,SAAS,EACrB,QAAQ,IAAI,OAAO,EACnB,QAAQ,IAAI,KAAK,EACjB,QAAQ,IAAI;EAAOA,EAAS,6CAA8C,OAAO,CAAC,EAClF,QAAQ,IAAI,uDAAuD,EACnE,QAAQ,IAAI,+CAA+C,CAC7D,CAGAU,EAAK,CAAC,CAAC,MAAO,GAAU,CACtB,QAAQ,MAAMV,EAAS,sBAAuB,KAAK,EAAGsB,CAAK,EAC3D,QAAQ,KAAK,CAAC,CAChB,CAAC"}
1
+ {"version":3,"file":"list-rules.js","names":["plugin","validatePeerDependencies","colors","colorize","text","color","printDependencyStatus","result","dep","icon","warning","status","statusColor","main","args","showHelp","showUsage","checkDeps","rules","ruleName","rule","fullName","typeColor","printCustomUsageInfo","error"],"sources":["../../src/cli/list-rules.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport plugin from \"../index.js\"\nimport { validatePeerDependencies, type ValidationResult } from \"../utils/dependency-validator.js\"\n\n// Colors for console output\nconst colors = {\n reset: \"\\x1b[0m\",\n bright: \"\\x1b[1m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n} as const\n\nfunction colorize(text: string, color: keyof typeof colors): string {\n return colors[color] + text + colors.reset\n}\n\n// Removed unused utility functions - they were for the old config-based approach\n\nfunction printDependencyStatus(result: ValidationResult): void {\n console.log(colorize(\"\\n🔍 Dependency Status Check:\", \"bright\"))\n console.log(colorize(\"=\".repeat(40), \"blue\"))\n\n // Show available dependencies\n if (result.available.length > 0) {\n console.log(colorize(\"\\n✅ Available:\", \"green\"))\n result.available.forEach((dep) => {\n const icon = dep.required ? \"🔧\" : \"🔌\"\n console.log(` ${icon} ${colorize(dep.name, \"green\")} - ${dep.description}`)\n })\n }\n\n // Show missing dependencies\n if (result.missing.length > 0) {\n console.log(colorize(\"\\n❌ Missing:\", \"red\"))\n result.missing.forEach((dep) => {\n const icon = dep.required ? \"⚠️ \" : \"💡\"\n const color = dep.required ? \"red\" : \"yellow\"\n console.log(` ${icon} ${colorize(dep.name, color)} - ${dep.description}`)\n })\n\n if (result.installCommand) {\n console.log(colorize(\"\\n📦 Install missing dependencies:\", \"bright\"))\n console.log(` ${colorize(result.installCommand, \"cyan\")}`)\n }\n }\n\n // Show warnings\n if (result.warnings.length > 0) {\n console.log(colorize(\"\\n⚠️ Warnings:\", \"yellow\"))\n result.warnings.forEach((warning) => console.log(` ${warning}`))\n }\n\n // Overall status\n const status = result.isValid ? \"✅ Ready to use\" : \"❌ Configuration will fail\"\n const statusColor = result.isValid ? \"green\" : \"red\"\n console.log(colorize(`\\n${status}`, statusColor))\n}\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2)\n const showHelp = args.includes(\"--help\") || args.includes(\"-h\")\n const showUsage = args.includes(\"--usage\") || args.includes(\"-u\")\n const checkDeps = args.includes(\"--check-deps\") || args.includes(\"--check\")\n\n if (showHelp) {\n console.log(colorize(\"📋 ESLint Plugin Functype - Custom Rules\", \"bright\"))\n console.log(\"\\nUsage: pnpm run list-rules [options]\")\n console.log(\"\\nOptions:\")\n console.log(\" --verbose, -v Show rule descriptions and schemas\")\n console.log(\" --usage, -u Show usage examples\")\n console.log(\" --check-deps Check peer dependency status\")\n console.log(\" --help, -h Show this help message\")\n console.log(\"\\nThis command lists all custom rules provided by the functype plugin.\")\n return\n }\n\n // Handle dependency check\n if (checkDeps) {\n console.log(colorize(\"🔧 ESLint Plugin Functype - Dependency Check\", \"bright\"))\n const result = validatePeerDependencies()\n printDependencyStatus(result)\n\n if (!result.isValid) {\n process.exit(1)\n }\n return\n }\n\n console.log(colorize(\"🔧 ESLint Plugin Functype - Custom Rules\", \"bright\"))\n\n if (!plugin.rules) {\n console.error(colorize(\"❌ No rules found in plugin.\", \"red\"))\n process.exit(1)\n }\n\n console.log(colorize(\"\\n📦 Available Custom Rules:\", \"bright\"))\n console.log(colorize(\"=\".repeat(40), \"blue\"))\n\n const rules = Object.keys(plugin.rules)\n\n rules.forEach((ruleName) => {\n const rule = plugin.rules[ruleName]\n const fullName = `functype/${ruleName}`\n\n console.log(`\\n${colorize(\"●\", \"green\")} ${colorize(fullName, \"bright\")}`)\n\n if (rule.meta?.docs?.description) {\n console.log(` ${colorize(\"Description:\", \"cyan\")} ${rule.meta.docs.description}`)\n }\n\n if (rule.meta?.type) {\n const typeColor = rule.meta.type === \"problem\" ? \"red\" : rule.meta.type === \"suggestion\" ? \"yellow\" : \"blue\"\n console.log(` ${colorize(\"Type:\", \"cyan\")} ${colorize(rule.meta.type, typeColor)}`)\n }\n\n if (rule.meta?.fixable) {\n console.log(` ${colorize(\"Fixable:\", \"cyan\")} ${colorize(\"Yes\", \"green\")}`)\n }\n\n if (showUsage) {\n console.log(` ${colorize(\"Usage:\", \"cyan\")} \"${fullName}\": \"error\"`)\n }\n })\n\n console.log(colorize(`\\n📊 Summary: ${rules.length} custom rules available`, \"bright\"))\n\n if (showUsage) {\n printCustomUsageInfo()\n }\n\n console.log(colorize(\"\\n💡 Tips:\", \"bright\"))\n console.log(\"• Use --verbose to see detailed rule information\")\n console.log(\"• Use --usage to see configuration examples\")\n console.log('• All rules are prefixed with \"functype/\"')\n console.log(\"• Consider using eslint-config-functype for pre-configured setup\")\n\n console.log(colorize(\"\\n🔗 Links:\", \"bright\"))\n console.log(\"• Documentation: https://github.com/jordanburke/eslint-plugin-functype\")\n console.log(\"• Configuration Bundle: https://github.com/jordanburke/eslint-config-functype\")\n console.log(\"• Functype Library: https://github.com/jordanburke/functype\")\n}\n\nfunction printCustomUsageInfo(): void {\n console.log(colorize(\"\\n💡 Usage Examples:\", \"bright\"))\n console.log(colorize(\"=\".repeat(30), \"blue\"))\n console.log(\"\\n\" + colorize(\"ESLint 9+ (flat config):\", \"green\"))\n console.log(' import functypePlugin from \"eslint-plugin-functype\"')\n console.log(\" export default [\")\n console.log(\" {\")\n console.log(\" plugins: { functype: functypePlugin },\")\n console.log(\" rules: {\")\n console.log(' \"functype/prefer-option\": \"error\",')\n console.log(' \"functype/prefer-either\": \"error\",')\n console.log(' \"functype/no-get-unsafe\": \"error\",')\n console.log(\" }\")\n console.log(\" }\")\n console.log(\" ]\")\n console.log(\"\\n\" + colorize(\"With eslint-config-functype (recommended):\", \"green\"))\n console.log(' import functypeConfig from \"eslint-config-functype\"')\n console.log(\" export default [functypeConfig.recommended]\")\n}\n\n// Run the CLI\nmain().catch((error) => {\n console.error(colorize(\"❌ Unexpected error:\", \"red\"), error)\n process.exit(1)\n})\n"],"mappings":";A,uGAMA,MAAME,EAAS,CACb,MAAO,UACP,OAAQ,UACR,IAAK,WACL,MAAO,WACP,OAAQ,WACR,KAAM,WACN,QAAS,WACT,KAAM,UACR,EAEA,SAASC,EAASC,EAAcC,EAAoC,CAClE,OAAOH,EAAOG,GAASD,EAAOF,EAAO,KACvC,CAIA,SAASI,EAAsBC,EAAgC,CAC7D,QAAQ,IAAIJ,EAAS;6BAAiC,QAAQ,CAAC,EAC/D,QAAQ,IAAIA,EAAS,IAAI,OAAO,EAAE,EAAG,MAAM,CAAC,EAGxCI,EAAO,UAAU,OAAS,IAC5B,QAAQ,IAAIJ,EAAS;cAAkB,OAAO,CAAC,EAC/CI,EAAO,UAAU,QAASC,GAAQ,CAChC,IAAMC,EAAOD,EAAI,SAAW,KAAO,KACnC,QAAQ,IAAI,KAAKC,EAAK,GAAGN,EAASK,EAAI,KAAM,OAAO,EAAE,KAAKA,EA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EAGvB,QAAQ,IAAIpB,EAAS;UAAc,QAAQ,CAAC,EAC5C,QAAQ,IAAI,kDAAkD,EAC9D,QAAQ,IAAI,6CAA6C,EACzD,QAAQ,IAAI,2CAA2C,EACvD,QAAQ,IAAI,kEAAkE,EAE9E,QAAQ,IAAIA,EAAS;WAAe,QAAQ,CAAC,EAC7C,QAAQ,IAAI,wEAAwE,EACpF,QAAQ,IAAI,+EAA+E,EAC3F,QAAQ,IAAI,6DAA6D,CAC3E,CAEA,SAASoB,GAA6B,CACpC,QAAQ,IAAIpB,EAAS;oBAAwB,QAAQ,CAAC,EACtD,QAAQ,IAAIA,EAAS,IAAI,OAAO,EAAE,EAAG,MAAM,CAAC,EAC5C,QAAQ,IAAI;EAAOA,EAAS,2BAA4B,OAAO,CAAC,EAChE,QAAQ,IAAI,uDAAuD,EACnE,QAAQ,IAAI,oBAAoB,EAChC,QAAQ,IAAI,OAAO,EACnB,QAAQ,IAAI,8CAA8C,EAC1D,QAAQ,IAAI,gBAAgB,EAC5B,QAAQ,IAAI,4CAA4C,EACxD,QAAQ,IAAI,4CAA4C,EACxD,QAAQ,IAAI,4CAA4C,EACxD,QAAQ,IAAI,SAAS,EACrB,QAAQ,IAAI,OAAO,EACnB,QAAQ,IAAI,KAAK,EACjB,QAAQ,IAAI;EAAOA,EAAS,6CAA8C,OAAO,CAAC,EAClF,QAAQ,IAAI,uDAAuD,EACnE,QAAQ,IAAI,+CAA+C,CAC7D,CAGAU,EAAK,CAAC,CAAC,MAAOW,GAAU,CACtB,QAAQ,MAAMrB,EAAS,sBAAuB,KAAK,EAAGqB,CAAK,EAC3D,QAAQ,KAAK,CAAC,CAChB,CAAC,E"}
@@ -1,45 +1,42 @@
1
- //#region src/configs/recommended.d.ts
2
1
  /**
3
- * Severity policy (#325): a rule is `error` once it is right on ~95–99% of real code and its known
4
- * false-positive classes are closed; it stays `warn` only while those classes are still open. FP here
5
- * is governance — a rule that is reliably right should fail the build, not print advice nobody reads
6
- * (a private app monorepo shipped 85 new violations under "lint OK" because every rule but `no-let` warned).
2
+ * The one preset. Code here is written by coding agents, and an agent acts on what fails its build
3
+ * and passes over a warning, so every rule is `error` or `off`, never `warn`. A rule is `error` once it
4
+ * is right on ~95–99% of real code with its known false-positive classes closed (#325); until it is
5
+ * measured, it is `off`, because at `error` it would teach an agent to write `eslint-disable`.
7
6
  *
8
- * Still `warn`, and why:
9
- * - prefer-option / prefer-either / prefer-try: fire on correct code at serialization boundaries
10
- * (JSON rows, DTOs) and on throws that are correct (bug checks, host contracts). Wire<T> (#325 B),
11
- * invariant() and @interop (#342) close those; graduating them is a measured decision.
12
- * - prefer-flatmap / prefer-do-notation: heuristics without type information; precision unmeasured.
13
- *
14
- * Graduated with a precision condition: prefer-fold checks functype predicate calls (`isSome()`,
15
- * `isLeft()`) only; its null-check heuristic is opt-in (`checkNullable`) because it fired on plain
16
- * nullables — 31 of 31 hits in a private app monorepo. prefer-map leaves loops to no-imperative-loops (`checkForLoops`
17
- * off), so one loop is one error.
18
- *
19
- * collection-naming is a convention, not a heuristic — functype's Map/Set imported under their own names,
20
- * the built-in spelled globalThis.Map — so it has no false-positive class and starts at error.
21
- *
22
- * no-array-mutation is off here only because turning a new error on in a 1.x minor would fail consumers'
23
- * builds on upgrade (91 hits across five consumers, every one a real in-place mutation). It's `error` in
24
- * strict, and planned for `error` here in 2.0. It is type-aware: without type information it reports nothing.
7
+ * In 1.x this was `agent`; `recommended` and `strict` warned on rules still being measured. 2.0 has
8
+ * one preset, and tests.ts relaxes it for test files.
25
9
  *
26
- * no-floating-io (1.17) is off here and `warn` in strict while it is measured: 0 false positives across
27
- * ~1,340 IO-typed calls in five codebases, but no real hits yet either. 2.0 decides `recommended` after
28
- * measuring it against functype-os, whose async methods return IO there. Type-aware, like no-array-mutation.
29
- *
30
- * no-floating-result (1.23) is off here and `error` in strict: a dropped Either or Try is a defect, not a
31
- * style, and on agent-todo's API it found the 20 drops that project fixed by hand as real bugs. Turning a
32
- * new error on here would fail consumers' builds on a 1.x minor, so it moves to `error` here in 2.0. Type-aware.
10
+ * `off`, and why:
11
+ * - prefer-flatmap / prefer-do-notation: heuristics without type information; precision unmeasured.
33
12
  *
34
- * no-serialize-container (1.23) is off here and `error` in strict, for the same reason: a container sent
35
- * to `c.json()` or `JSON.stringify()` is a defect, and turning a new error on here would fail consumers'
36
- * builds on a 1.x minor. It moves to `error` here in 2.0. Type-aware.
13
+ * `error`, with what it was measured on:
14
+ * - prefer-fold checks functype predicate calls (`isSome()`, `isLeft()`), and guards followed by an
15
+ * unwrap (`checkGuards`): a pass-through guard is a hand-written flatMap. Its null-check heuristic
16
+ * is opt-in (`checkNullable`) because it fired on plain nullables: 31 of 31 hits in a private app
17
+ * monorepo. Inside a React component, a guard followed by an unwrap is also reported by
18
+ * must-fold-on-component-return.
19
+ * - prefer-map leaves loops to no-imperative-loops (`checkForLoops` off), so one loop is one error.
20
+ * - collection-naming is a convention, not a heuristic, so it has no false-positive class.
21
+ * - no-array-mutation: 91 hits across five consumers, every one a real in-place mutation.
22
+ * - prefer-list: about 96% precise on five consumers (#362). Supabase's generated types are skipped
23
+ * by shape. A local array changed by a method or an index write is reported once, by
24
+ * no-array-mutation; a mutated field is still reported by both.
25
+ * - prefer-option / prefer-either / prefer-try: at a real boundary the code marks it instead
26
+ * (`@interop <reason>` or `invariant()` for a throw, `Wire<T>` for a data shape).
27
+ * - no-floating-io: 0 false positives across ~1,340 IO-typed calls in five codebases.
28
+ * - no-floating-result: on agent-todo's API it found the 20 drops that project fixed by hand as real
29
+ * bugs, and in functype it found an async `bracket` that dropped a failed release.
30
+ * - no-serialize-container: 4 calls on agent-todo's API, each a bug that project fixed.
31
+ * - no-uncalled-method: 0 hits on 1,126 files of seven consumers on 1.x and 2.x; it finds the
32
+ * `Option(list.head)` a published library shipped against 2.0 (#603).
33
+ * - no-getOrThrow-in-render and must-fold-on-component-return fire only inside a React component or
34
+ * hook, and reported nothing on 1,403 files of React code.
35
+ * - no-get-unsafe: an unwrap outside an `@interop` boundary; allowed in test files.
37
36
  *
38
- * no-getOrThrow-in-render and must-fold-on-component-return are React rules: they fire only inside a
39
- * component (a PascalCase function with JSX) or a hook (`use*`), so non-React code rarely trips them (a
40
- * non-React function named `use*` is read as a hook). Both are new and unmeasured on real React code, so
41
- * they start where no-floating-io did: off here, `warn` in strict. They work without type information and
42
- * are more precise with it.
37
+ * no-array-mutation, no-floating-io, no-floating-result, no-serialize-container and no-uncalled-method
38
+ * are type-aware:
39
+ * without `parserOptions.projectService` they report nothing.
43
40
  */
44
41
  declare const recommendedRules: {
45
42
  "functype/no-let": string;
@@ -47,22 +44,23 @@ declare const recommendedRules: {
47
44
  "functype/prefer-functype-map": string;
48
45
  "functype/prefer-functype-set": string;
49
46
  "functype/prefer-map": string;
50
- "functype/prefer-fold": string;
47
+ "functype/prefer-fold": (string | {
48
+ checkGuards: boolean;
49
+ })[];
51
50
  "functype/collection-naming": string;
51
+ "functype/prefer-list": string;
52
+ "functype/no-array-mutation": string;
52
53
  "functype/prefer-option": string;
53
54
  "functype/prefer-either": string;
54
55
  "functype/prefer-try": string;
55
- "functype/prefer-flatmap": string;
56
- "functype/prefer-do-notation": string;
57
56
  "functype/no-get-unsafe": string;
58
- "functype/prefer-list": string;
59
- "functype/no-array-mutation": string;
60
57
  "functype/no-floating-io": string;
61
58
  "functype/no-floating-result": string;
62
59
  "functype/no-serialize-container": string;
60
+ "functype/no-uncalled-method": string;
63
61
  "functype/no-getOrThrow-in-render": string;
64
62
  "functype/must-fold-on-component-return": string;
63
+ "functype/prefer-flatmap": string;
64
+ "functype/prefer-do-notation": string;
65
65
  };
66
- //#endregion
67
- export { recommendedRules as default };
68
- //# sourceMappingURL=recommended.d.ts.map
66
+ export { recommendedRules as default };
@@ -1,2 +1,2 @@
1
- const e={"functype/no-let":`error`,"functype/no-imperative-loops":`error`,"functype/prefer-functype-map":`error`,"functype/prefer-functype-set":`error`,"functype/prefer-map":`error`,"functype/prefer-fold":`error`,"functype/collection-naming":`error`,"functype/prefer-option":`warn`,"functype/prefer-either":`warn`,"functype/prefer-try":`warn`,"functype/prefer-flatmap":`warn`,"functype/prefer-do-notation":`warn`,"functype/no-get-unsafe":`off`,"functype/prefer-list":`off`,"functype/no-array-mutation":`off`,"functype/no-floating-io":`off`,"functype/no-floating-result":`off`,"functype/no-serialize-container":`off`,"functype/no-getOrThrow-in-render":`off`,"functype/must-fold-on-component-return":`off`};export{e as default};
1
+ const e={"functype/no-let":`error`,"functype/no-imperative-loops":`error`,"functype/prefer-functype-map":`error`,"functype/prefer-functype-set":`error`,"functype/prefer-map":`error`,"functype/prefer-fold":[`error`,{checkGuards:!0}],"functype/collection-naming":`error`,"functype/prefer-list":`error`,"functype/no-array-mutation":`error`,"functype/prefer-option":`error`,"functype/prefer-either":`error`,"functype/prefer-try":`error`,"functype/no-get-unsafe":`error`,"functype/no-floating-io":`error`,"functype/no-floating-result":`error`,"functype/no-serialize-container":`error`,"functype/no-uncalled-method":`error`,"functype/no-getOrThrow-in-render":`error`,"functype/must-fold-on-component-return":`error`,"functype/prefer-flatmap":`off`,"functype/prefer-do-notation":`off`};export{e as default};
2
2
  //# sourceMappingURL=recommended.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recommended.js","names":["recommendedRules"],"sources":["../../src/configs/recommended.ts"],"sourcesContent":["/**\n * Severity policy (#325): a rule is `error` once it is right on ~95–99% of real code and its known\n * false-positive classes are closed; it stays `warn` only while those classes are still open. FP here\n * is governance — a rule that is reliably right should fail the build, not print advice nobody reads\n * (a private app monorepo shipped 85 new violations under \"lint OK\" because every rule but `no-let` warned).\n *\n * Still `warn`, and why:\n * - prefer-option / prefer-either / prefer-try: fire on correct code at serialization boundaries\n * (JSON rows, DTOs) and on throws that are correct (bug checks, host contracts). Wire<T> (#325 B),\n * invariant() and @interop (#342) close those; graduating them is a measured decision.\n * - prefer-flatmap / prefer-do-notation: heuristics without type information; precision unmeasured.\n *\n * Graduated with a precision condition: prefer-fold checks functype predicate calls (`isSome()`,\n * `isLeft()`) only; its null-check heuristic is opt-in (`checkNullable`) because it fired on plain\n * nullables — 31 of 31 hits in a private app monorepo. prefer-map leaves loops to no-imperative-loops (`checkForLoops`\n * off), so one loop is one error.\n *\n * collection-naming is a convention, not a heuristic — functype's Map/Set imported under their own names,\n * the built-in spelled globalThis.Map — so it has no false-positive class and starts at error.\n *\n * no-array-mutation is off here only because turning a new error on in a 1.x minor would fail consumers'\n * builds on upgrade (91 hits across five consumers, every one a real in-place mutation). It's `error` in\n * strict, and planned for `error` here in 2.0. It is type-aware: without type information it reports nothing.\n *\n * no-floating-io (1.17) is off here and `warn` in strict while it is measured: 0 false positives across\n * ~1,340 IO-typed calls in five codebases, but no real hits yet either. 2.0 decides `recommended` after\n * measuring it against functype-os, whose async methods return IO there. Type-aware, like no-array-mutation.\n *\n * no-floating-result (1.23) is off here and `error` in strict: a dropped Either or Try is a defect, not a\n * style, and on agent-todo's API it found the 20 drops that project fixed by hand as real bugs. Turning a\n * new error on here would fail consumers' builds on a 1.x minor, so it moves to `error` here in 2.0. Type-aware.\n *\n * no-serialize-container (1.23) is off here and `error` in strict, for the same reason: a container sent\n * to `c.json()` or `JSON.stringify()` is a defect, and turning a new error on here would fail consumers'\n * builds on a 1.x minor. It moves to `error` here in 2.0. Type-aware.\n *\n * no-getOrThrow-in-render and must-fold-on-component-return are React rules: they fire only inside a\n * component (a PascalCase function with JSX) or a hook (`use*`), so non-React code rarely trips them (a\n * non-React function named `use*` is read as a hook). Both are new and unmeasured on real React code, so\n * they start where no-floating-io did: off here, `warn` in strict. They work without type information and\n * are more precise with it.\n */\nconst recommendedRules = {\n \"functype/no-let\": \"error\",\n \"functype/no-imperative-loops\": \"error\",\n \"functype/prefer-functype-map\": \"error\",\n \"functype/prefer-functype-set\": \"error\",\n \"functype/prefer-map\": \"error\",\n \"functype/prefer-fold\": \"error\",\n \"functype/collection-naming\": \"error\",\n \"functype/prefer-option\": \"warn\",\n \"functype/prefer-either\": \"warn\",\n \"functype/prefer-try\": \"warn\",\n \"functype/prefer-flatmap\": \"warn\",\n \"functype/prefer-do-notation\": \"warn\",\n \"functype/no-get-unsafe\": \"off\",\n \"functype/prefer-list\": \"off\",\n \"functype/no-array-mutation\": \"off\",\n \"functype/no-floating-io\": \"off\",\n \"functype/no-floating-result\": \"off\",\n \"functype/no-serialize-container\": \"off\",\n \"functype/no-getOrThrow-in-render\": \"off\",\n \"functype/must-fold-on-component-return\": \"off\",\n}\n\nexport default recommendedRules\n"],"mappings":"AA0CA,MAAMA,EAAmB,CACvB,kBAAmB,QACnB,+BAAgC,QAChC,+BAAgC,QAChC,+BAAgC,QAChC,sBAAuB,QACvB,uBAAwB,QACxB,6BAA8B,QAC9B,yBAA0B,OAC1B,yBAA0B,OAC1B,sBAAuB,OACvB,0BAA2B,OAC3B,8BAA+B,OAC/B,yBAA0B,MAC1B,uBAAwB,MACxB,6BAA8B,MAC9B,0BAA2B,MAC3B,8BAA+B,MAC/B,kCAAmC,MACnC,mCAAoC,MACpC,yCAA0C,KAC5C"}
1
+ {"version":3,"file":"recommended.js","names":["recommendedRules"],"sources":["../../src/configs/recommended.ts"],"sourcesContent":["/**\n * The one preset. Code here is written by coding agents, and an agent acts on what fails its build\n * and passes over a warning, so every rule is `error` or `off`, never `warn`. A rule is `error` once it\n * is right on ~95–99% of real code with its known false-positive classes closed (#325); until it is\n * measured, it is `off`, because at `error` it would teach an agent to write `eslint-disable`.\n *\n * In 1.x this was `agent`; `recommended` and `strict` warned on rules still being measured. 2.0 has\n * one preset, and tests.ts relaxes it for test files.\n *\n * `off`, and why:\n * - prefer-flatmap / prefer-do-notation: heuristics without type information; precision unmeasured.\n *\n * `error`, with what it was measured on:\n * - prefer-fold checks functype predicate calls (`isSome()`, `isLeft()`), and guards followed by an\n * unwrap (`checkGuards`): a pass-through guard is a hand-written flatMap. Its null-check heuristic\n * is opt-in (`checkNullable`) because it fired on plain nullables: 31 of 31 hits in a private app\n * monorepo. Inside a React component, a guard followed by an unwrap is also reported by\n * must-fold-on-component-return.\n * - prefer-map leaves loops to no-imperative-loops (`checkForLoops` off), so one loop is one error.\n * - collection-naming is a convention, not a heuristic, so it has no false-positive class.\n * - no-array-mutation: 91 hits across five consumers, every one a real in-place mutation.\n * - prefer-list: about 96% precise on five consumers (#362). Supabase's generated types are skipped\n * by shape. A local array changed by a method or an index write is reported once, by\n * no-array-mutation; a mutated field is still reported by both.\n * - prefer-option / prefer-either / prefer-try: at a real boundary the code marks it instead\n * (`@interop <reason>` or `invariant()` for a throw, `Wire<T>` for a data shape).\n * - no-floating-io: 0 false positives across ~1,340 IO-typed calls in five codebases.\n * - no-floating-result: on agent-todo's API it found the 20 drops that project fixed by hand as real\n * bugs, and in functype it found an async `bracket` that dropped a failed release.\n * - no-serialize-container: 4 calls on agent-todo's API, each a bug that project fixed.\n * - no-uncalled-method: 0 hits on 1,126 files of seven consumers on 1.x and 2.x; it finds the\n * `Option(list.head)` a published library shipped against 2.0 (#603).\n * - no-getOrThrow-in-render and must-fold-on-component-return fire only inside a React component or\n * hook, and reported nothing on 1,403 files of React code.\n * - no-get-unsafe: an unwrap outside an `@interop` boundary; allowed in test files.\n *\n * no-array-mutation, no-floating-io, no-floating-result, no-serialize-container and no-uncalled-method\n * are type-aware:\n * without `parserOptions.projectService` they report nothing.\n */\nconst recommendedRules = {\n \"functype/no-let\": \"error\",\n \"functype/no-imperative-loops\": \"error\",\n \"functype/prefer-functype-map\": \"error\",\n \"functype/prefer-functype-set\": \"error\",\n \"functype/prefer-map\": \"error\",\n \"functype/prefer-fold\": [\"error\", { checkGuards: true }],\n \"functype/collection-naming\": \"error\",\n \"functype/prefer-list\": \"error\",\n \"functype/no-array-mutation\": \"error\",\n \"functype/prefer-option\": \"error\",\n \"functype/prefer-either\": \"error\",\n \"functype/prefer-try\": \"error\",\n \"functype/no-get-unsafe\": \"error\",\n \"functype/no-floating-io\": \"error\",\n \"functype/no-floating-result\": \"error\",\n \"functype/no-serialize-container\": \"error\",\n \"functype/no-uncalled-method\": \"error\",\n \"functype/no-getOrThrow-in-render\": \"error\",\n \"functype/must-fold-on-component-return\": \"error\",\n \"functype/prefer-flatmap\": \"off\",\n \"functype/prefer-do-notation\": \"off\",\n}\n\nexport default recommendedRules\n"],"mappings":"AAwCA,MAAMA,EAAmB,CACvB,kBAAmB,QACnB,+BAAgC,QAChC,+BAAgC,QAChC,+BAAgC,QAChC,sBAAuB,QACvB,uBAAwB,CAAC,QAAS,CAAE,YAAa,EAAK,CAAC,EACvD,6BAA8B,QAC9B,uBAAwB,QACxB,6BAA8B,QAC9B,yBAA0B,QAC1B,yBAA0B,QAC1B,sBAAuB,QACvB,yBAA0B,QAC1B,0BAA2B,QAC3B,8BAA+B,QAC/B,kCAAmC,QACnC,8BAA+B,QAC/B,mCAAoC,QACpC,yCAA0C,QAC1C,0BAA2B,MAC3B,8BAA+B,KACjC,E"}