@opsydyn/oxlint-effect 2.2.0 → 2.4.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.
package/README.md CHANGED
@@ -53,7 +53,7 @@ installs from npm and checks annotated failures alongside clean repairs.
53
53
 
54
54
  **Version scope:** these changes apply to plugin **2.1.0 and later**. Version
55
55
  **2.0.x** retains the previous recommended bans and option-presence concurrency
56
- checks. This checkout carries the minor changeset; publication is separate.
56
+ checks.
57
57
 
58
58
  `recommended` and `effect3.recommended` allow generator-based `Effect.fn`,
59
59
  explicit `Effect.Effect`/`Layer.Layer` annotations and named Effect type aliases.
@@ -78,9 +78,9 @@ automatic span name. Throwing inside Effect.fn remains a typed-failure warning;
78
78
  supporting the function form does not permit unsafe bodies.
79
79
 
80
80
  Published `2.0.0` makes default exports Effect 4 policy and adds `effect3` for
81
- legacy projects. All 146 registered rules and 18 groups are
82
- locally qualified for their documented forms against the pinned majors:
83
- 146 legacy Effect 3 cases and 141 current Effect 4 cases, with five legacy-only policies.
81
+ legacy projects. Version `2.3.0` adds one opt-in rule, for 147 registered rules
82
+ and 18 groups, qualified for their documented forms against the pinned majors:
83
+ 147 legacy Effect 3 cases and 142 current Effect 4 cases, with five legacy-only policies.
84
84
  Published 1.x packages retain their original Effect 3 behaviour and do not
85
85
  provide the new namespace. See the [compatibility roadmap](roadmap/14-effect4-compatibility/README.md)
86
86
  and [per-rule audit](docs/effect-version-inventory.json) for detection scope.
@@ -91,7 +91,10 @@ the plugin to 2.x to use the explicit legacy presets without upgrading Effect.
91
91
  `bun run test:effect-versions` verifies pinned packed Effect 3.22.1 and 4.0.0
92
92
  consumers, with exact warning counts, clean controls and config typechecks.
93
93
  All Q01-Q52 now have behavioural evidence in the matching packed consumers.
94
- The complete rule/group gate and unchanged 30 KB bundle-size gate pass locally.
94
+ The original compatibility release used a 30 KB runtime cap. Version 2.3.0
95
+ uses an explicitly reviewed 31 KB cap for the cause-loss addition; see
96
+ [ADR 0004](docs/adr/0004-opt-in-cause-loss-policy.md) and the
97
+ [final qualification record](docs/superpowers/reports/2026-11-16-opt-in-cause-loss.md).
95
98
  Accepting a version option alone is not proof of adaptation. The rule/group
96
99
  publication guard passes at 2.0.0; release and registry verification are recorded
97
100
  in the [release checklist](docs/superpowers/reports/2026-10-01-effect4-release-preparation.md).
@@ -216,13 +219,13 @@ the package's recommended syntax-only `linteffect/*` rules and enables Oxc's
216
219
  type-aware engine, but it does not select any `typescript/*` rules or enable
217
220
  `typeCheck` compiler diagnostics.
218
221
 
219
- Install the type-aware engine in the consuming project:
222
+ Install the standard `tsgolint` backend in the consuming project:
220
223
 
221
224
  ```bash
222
225
  bun add -d oxlint oxlint-tsgolint @opsydyn/oxlint-effect
223
226
  ```
224
227
 
225
- The current engine requires TypeScript 7. Keep `oxlint`, `oxlint-tsgolint`,
228
+ The current `oxlint-tsgolint` releases use TypeScript 7. Keep `oxlint`, `oxlint-tsgolint`,
226
229
  TypeScript, and the consumer's project configuration compatible. In a
227
230
  monorepo, build dependent packages so their declarations can be resolved
228
231
  before type-aware linting runs.
@@ -270,6 +273,31 @@ API](https://oxc.rs/docs/guide/usage/linter/js-plugins.html) does not support
270
273
  custom type-aware rules, so semantic Effect rules remain deferred until Oxc
271
274
  provides supported typed-plugin access.
272
275
 
276
+ #### Optional tsrs Backend
277
+
278
+ [Oxlint 1.92.0 or newer](https://github.com/oxc-project/oxc/releases/tag/oxlint_v1.92.0)
279
+ can discover `tsrs-lint` as an [alternative backend](https://oxc.rs/blog/2026-11-17-faster-type-aware-linting-with-tsrs)
280
+ for its built-in type-aware rules.
281
+ In a consumer that already uses the plugin, install the pinned preview pair:
282
+
283
+ ```bash
284
+ bun add -d -E oxlint@1.94.0 tsrs@0.25.0-ts7.1.0-beta
285
+ bunx --no-install oxlint --type-aware src
286
+ ```
287
+
288
+ Keep the same `typeAware` preset (or `effect3.typeAware` for Effect 3), rule
289
+ options, and standalone typecheck. There is no new preset or plugin dependency.
290
+ Oxlint prefers the discoverable `tsrs-lint` launcher, even when
291
+ `oxlint-tsgolint` is also installed locally. To roll back, run `bun remove tsrs`
292
+ and retain or restore a compatible `oxlint-tsgolint`; check for a remaining
293
+ `tsrs-lint` on `PATH` or an explicit `OXLINT_TSGOLINT_PATH` override.
294
+
295
+ Use this preview for linting, not to replace a whole-project compiler check.
296
+ The macOS arm64 trial matched Effect 3 and 4 lint diagnostics, but the two
297
+ backends did not report identical compiler diagnostics with `--type-check`.
298
+ Linux and editor integration have not been verified by this project.
299
+ See the [optional packed-consumer check](examples/type-aware-consumer/README.md#optional-tsrs-verification).
300
+
273
301
  ### Configure One Rule Group
274
302
 
275
303
  Every named preset in the following table is exported as a config-shaped preset
@@ -366,6 +394,14 @@ or repair a domain-modeling issue. The skill preserves existing configuration
366
394
  and uses the installed package's APIs and rules. Type-aware linting is opt-in.
367
395
  Intentional `EXPECT`/`QA` failures are retained as diagnostic controls.
368
396
 
397
+ Version 2.3.0 adds [cause-narrowing review guidance](./skills/oxlint-effect/references/cause-narrowing.md),
398
+ with paired current/legacy counterexamples, repairs and executable contracts.
399
+ It checks original cause identity, observer sequencing, error/environment types
400
+ and an explicit public projection. The opt-in `no-error-cause-loss` rule
401
+ diagnoses the three matched cause-erasure examples when explicitly enabled.
402
+ Other `REVIEW-ONLY` cases still document gaps rather than implemented warnings. This is agent
403
+ guidance, not a port of anti-slop's complete lint policy or an LLM judging service.
404
+
369
405
  The [skill](./skills/oxlint-effect/SKILL.md), its focused references, and
370
406
  paired [Effect 4 failures](./skills/oxlint-effect/assets/effect4/domain.bad.ts) and
371
407
  [repairs](./skills/oxlint-effect/assets/effect4/domain.good.ts) are also included in the
@@ -403,7 +439,7 @@ Paired [expected-state failures](./skills/oxlint-effect/assets/effect4/expected-
403
439
  and [repairs](./skills/oxlint-effect/assets/effect4/expected-state.good.ts) cover ordinary
404
440
  absence, broad null recovery and thrown expected rejection. Their
405
441
  [guide](./skills/oxlint-effect/references/expected-state.md) explains the required
406
- caller changes. The corpus now covers all 21 exported DDD rules with representative
442
+ caller changes. The corpus now covers all 22 exported DDD rules with representative
407
443
  annotated failures, full-DDD clean controls and tested contracts.
408
444
  CI checks referenced rules and presets, relative
409
445
  links, npm inclusion, TypeScript contracts, intentional diagnostics, and clean
@@ -739,7 +775,7 @@ support the same `boundaryPaths` option as the other lifecycle rules.
739
775
  Q22's cleanup, scope and success-value examples use pinned Effect 3.21.4/4.0.0
740
776
  consumers. Behavioural qualification is recorded in the
741
777
  [campaign report](docs/superpowers/reports/2026-10-01-effect4-complete-qualification.md#q22-cleanup-manual-scopes-and-resource-success-values);
742
- Q22-Q24 batch closure and the unchanged 30 KB size gate now pass locally.
778
+ Historical Q22-Q24 closure passed the then-current 30 KB size gate.
743
779
 
744
780
  Prefer the supplied `Effect.scope` inside `Effect.scoped`, or acquire a manual
745
781
  `Scope.make()` with `Effect.acquireUseRelease` and release it using
@@ -853,12 +889,56 @@ not currently expose it; it is not part of the v1 export surface.
853
889
  | `linteffect/no-raw-time-domain-field` | Time-looking fields typed as `number` or `Date`. | Models durations and clock boundaries explicitly. |
854
890
  | `linteffect/no-overloaded-options-object` | `opts`, `options`, or `config` typed as `any` or `object`. | Uses Schema decoding or named config models instead of loose bags. |
855
891
  | `linteffect/no-domain-logic-in-conditional` | Multi-clause business rules embedded in boolean expressions. | Extracts named predicates or validation Effects that can be tested. |
856
- | `linteffect/no-implicit-state-machine-object` | Multiple boolean lifecycle flags on one object. | Models impossible states away with tagged unions. |
892
+ | `linteffect/no-implicit-state-machine-object` | Multiple lifecycle flags combined in a condition. Opt in to checking configured boolean pairs in `Schema.Struct` declarations. | Models impossible states away with tagged unions. |
857
893
  | `linteffect/no-adhoc-domain-error` | `Effect.fail("...")` and `throw new Error("...")` in domain code. | Uses structured tagged errors for recovery and observability. |
858
894
  | `linteffect/no-domain-meaning-by-folder-only` | Admin/public/internal meaning encoded only in names around raw IDs. | Represents context in types, commands, policies, or services. |
859
895
 
896
+ Configure pairs when the domain says those flags describe the same lifecycle.
897
+
898
+ ```ts
899
+ rules: {
900
+ "linteffect/no-implicit-state-machine-object": [
901
+ "error",
902
+ { schemaFlagPairs: [["open", "asking"]] },
903
+ ],
904
+ }
905
+ ```
906
+
907
+ This reports an inline Effect `Schema.Struct` containing both named fields as
908
+ direct `Schema.Boolean` members. The rule resolves the Effect Schema import,
909
+ including import aliases. Spreads, computed keys, and wrapped or referenced
910
+ schemas are outside the check. The existing conditional check also runs when
911
+ the option is omitted.
912
+
860
913
  ### Error Modeling
861
914
 
915
+ **Since 2.3.0:** `no-error-cause-loss` is included in `errorModeling`,
916
+ `ddd` and `allRules` for both majors. It is **not** enabled by `recommended` or
917
+ `typeAware`. Version 2.2.0 does not export this rule. Users upgrading with an
918
+ explicit error/DDD group selection may see new diagnostics.
919
+
920
+ Enable it only where the owner requires retaining the original error when
921
+ wrapping it. It checks direct `new` constructor returns in synchronous inline
922
+ `mapError` handlers and `Effect.fail(new ...)` in broad recovery. Legacy recovery
923
+ is `catchAll`/`catchAllCause`; current is `catch`/`catchEager`/`catchCause`, with
924
+ `mapErrorEager` also supported. Direct/data-last calls, block and conditional
925
+ returns, value-import aliases and subpath imports are recognised by binding.
926
+
927
+ Passing the original as an argument, or inside a literal object/array, avoids a
928
+ warning without mandating a field name. Later keys win; a later opaque spread,
929
+ dynamic computed field, helper result, alias, destructured/reassigned parameter, async
930
+ handler or generator stays unknown, **not proven safe**. Named handlers, factory
931
+ `.make`, specialised recovery tables and cross-file constructor storage are not
932
+ inferred. A constructor can still ignore a passed input. Logging is not a bypass.
933
+
934
+ For a single manual Effect 4 rule, use
935
+ `"linteffect/no-error-cause-loss": ["error", { effectVersion: 4 }]`; use `3` for
936
+ legacy consumers. Register the plugin once using the existing configuration.
937
+ See the [cause guide](skills/oxlint-effect/references/cause-narrowing.md) and
938
+ [annotated app example](examples/backend/cause-narrowing-review.ts). There is no
939
+ automatic fix: intentional captured-and-erased public translations may be valid,
940
+ and internal causes must not be exposed in public payloads merely to clear lint.
941
+
862
942
  Public Effect operations should expose one structured, recoverable error
863
943
  channel. The `ddd` preset includes the complete Domain Modeling and Error
864
944
  Modeling groups; DDD-only rules remain opt-in to keep `recommended` compatible
@@ -871,6 +951,7 @@ with existing projects.
871
951
  | `linteffect/no-mixed-effect-error-shapes` | Public error unions mixing `Error`, `unknown`, string, number, or boolean shapes. | A single tagged error union keeps recovery and observability predictable. |
872
952
  | `linteffect/no-effect-fail-error-message` | `Effect.fail(error.message)`, string concatenation, or templates that stringify an error. | Preserves the original error tag, cause, and context instead of collapsing it into a string. |
873
953
  | `linteffect/no-catchall-generic-rethrow` | Plain `catch`/`catchEager` (v4) or `catchAll` (v3) handlers returning `Effect.fail(new Error(...))`. | Preserve the original error or explicitly map to a structured tagged error with its cause. |
954
+ | `linteffect/no-error-cause-loss` | Opt-in inline map/recovery constructors whose visible inputs omit or project away the original handler error. | Pass the original through an owned field or argument where retention is required. Uses lexical identity and effective object keys; opaque inputs stay unknown. Does not prove constructor storage, telemetry delivery or valid public disclosure. |
874
955
  | `linteffect/no-log-only-error-handling` | V4 catch/eager/Cause/defect/filter/tag/reason handlers and maps that log without modelling or retaining failure. Legacy v3 also reports `tapError`. | Re-fail typed errors, retain causes with `failCause`, or retain defects with `die`. V4 observers (`tapError`, `tapCause`, `tapDefect`) stay clean because they preserve failure. |
875
956
  | `linteffect/no-early-catchall-null` | Non-boundary `catch`/`catchEager` (v4) or `catchAll` (v3) recovery with `Effect.succeed(null)`, `undefined`, or an identifier containing fallback/default. | Propagate typed failures or recover at a configured boundary instead of leaking untyped absence. |
876
957
  | `linteffect/no-expected-state-as-error` | `Effect.fail("NotFound")`, `"Missing"`, `"Empty"`, or `"None"`. | Models expected states as `Option`, `Result` (v4), `Either` (v3), or tagged data instead of overloading failure. |
package/dist/index.d.mts CHANGED
@@ -228,6 +228,9 @@ declare const reactAndRuntimeBoundariesRules: {
228
228
  "linteffect/no-catchall-generic-rethrow": ["error", {
229
229
  effectVersion: 4;
230
230
  }];
231
+ "linteffect/no-error-cause-loss": ["error", {
232
+ effectVersion: 4;
233
+ }];
231
234
  "linteffect/no-log-only-error-handling": ["error", {
232
235
  effectVersion: 4;
233
236
  }];
@@ -261,6 +264,9 @@ declare const reactAndRuntimeBoundariesRules: {
261
264
  "linteffect/no-catchall-generic-rethrow": ["error", {
262
265
  effectVersion: 4;
263
266
  }];
267
+ "linteffect/no-error-cause-loss": ["error", {
268
+ effectVersion: 4;
269
+ }];
264
270
  "linteffect/no-log-only-error-handling": ["error", {
265
271
  effectVersion: 4;
266
272
  }];
@@ -535,6 +541,9 @@ declare const reactAndRuntimeBoundariesRules: {
535
541
  "linteffect/no-catchall-generic-rethrow": ["error", {
536
542
  effectVersion: 4;
537
543
  }];
544
+ "linteffect/no-error-cause-loss": ["error", {
545
+ effectVersion: 4;
546
+ }];
538
547
  "linteffect/no-log-only-error-handling": ["error", {
539
548
  effectVersion: 4;
540
549
  }];
@@ -1138,6 +1147,9 @@ declare const reactAndRuntimeBoundariesRules: {
1138
1147
  "linteffect/no-catchall-generic-rethrow": ["error", {
1139
1148
  effectVersion: 4;
1140
1149
  }];
1150
+ "linteffect/no-error-cause-loss": ["error", {
1151
+ effectVersion: 4;
1152
+ }];
1141
1153
  "linteffect/no-log-only-error-handling": ["error", {
1142
1154
  effectVersion: 4;
1143
1155
  }];
@@ -1172,6 +1184,9 @@ declare const reactAndRuntimeBoundariesRules: {
1172
1184
  "linteffect/no-catchall-generic-rethrow": ["error", {
1173
1185
  effectVersion: 4;
1174
1186
  }];
1187
+ "linteffect/no-error-cause-loss": ["error", {
1188
+ effectVersion: 4;
1189
+ }];
1175
1190
  "linteffect/no-log-only-error-handling": ["error", {
1176
1191
  effectVersion: 4;
1177
1192
  }];
@@ -2066,6 +2081,9 @@ declare const reactAndRuntimeBoundariesRules: {
2066
2081
  "linteffect/no-catchall-generic-rethrow": ["error", {
2067
2082
  effectVersion: 4;
2068
2083
  }];
2084
+ "linteffect/no-error-cause-loss": ["error", {
2085
+ effectVersion: 4;
2086
+ }];
2069
2087
  "linteffect/no-log-only-error-handling": ["error", {
2070
2088
  effectVersion: 4;
2071
2089
  }];
@@ -2105,6 +2123,9 @@ declare const reactAndRuntimeBoundariesRules: {
2105
2123
  "linteffect/no-catchall-generic-rethrow": ["error", {
2106
2124
  effectVersion: 4;
2107
2125
  }];
2126
+ "linteffect/no-error-cause-loss": ["error", {
2127
+ effectVersion: 4;
2128
+ }];
2108
2129
  "linteffect/no-log-only-error-handling": ["error", {
2109
2130
  effectVersion: 4;
2110
2131
  }];
@@ -3046,6 +3067,9 @@ declare const reactAndRuntimeBoundariesRules: {
3046
3067
  "linteffect/no-catchall-generic-rethrow": ["error", {
3047
3068
  effectVersion: 4;
3048
3069
  }];
3070
+ "linteffect/no-error-cause-loss": ["error", {
3071
+ effectVersion: 4;
3072
+ }];
3049
3073
  "linteffect/no-log-only-error-handling": ["error", {
3050
3074
  effectVersion: 4;
3051
3075
  }];
@@ -3086,6 +3110,9 @@ declare const reactAndRuntimeBoundariesRules: {
3086
3110
  "linteffect/no-catchall-generic-rethrow": ["error", {
3087
3111
  effectVersion: 4;
3088
3112
  }];
3113
+ "linteffect/no-error-cause-loss": ["error", {
3114
+ effectVersion: 4;
3115
+ }];
3089
3116
  "linteffect/no-log-only-error-handling": ["error", {
3090
3117
  effectVersion: 4;
3091
3118
  }];
@@ -3480,6 +3507,9 @@ declare const effect3: {
3480
3507
  "linteffect/no-catchall-generic-rethrow": ["error", {
3481
3508
  effectVersion: 3;
3482
3509
  }];
3510
+ "linteffect/no-error-cause-loss": ["error", {
3511
+ effectVersion: 3;
3512
+ }];
3483
3513
  "linteffect/no-log-only-error-handling": ["error", {
3484
3514
  effectVersion: 3;
3485
3515
  }];
@@ -3514,6 +3544,9 @@ declare const effect3: {
3514
3544
  "linteffect/no-catchall-generic-rethrow": ["error", {
3515
3545
  effectVersion: 3;
3516
3546
  }];
3547
+ "linteffect/no-error-cause-loss": ["error", {
3548
+ effectVersion: 3;
3549
+ }];
3517
3550
  "linteffect/no-log-only-error-handling": ["error", {
3518
3551
  effectVersion: 3;
3519
3552
  }];
@@ -3808,6 +3841,9 @@ declare const effect3: {
3808
3841
  "linteffect/no-catchall-generic-rethrow": ["error", {
3809
3842
  effectVersion: 3;
3810
3843
  }];
3844
+ "linteffect/no-error-cause-loss": ["error", {
3845
+ effectVersion: 3;
3846
+ }];
3811
3847
  "linteffect/no-log-only-error-handling": ["error", {
3812
3848
  effectVersion: 3;
3813
3849
  }];
@@ -4446,6 +4482,9 @@ declare const effect3: {
4446
4482
  "linteffect/no-catchall-generic-rethrow": ["error", {
4447
4483
  effectVersion: 3;
4448
4484
  }];
4485
+ "linteffect/no-error-cause-loss": ["error", {
4486
+ effectVersion: 3;
4487
+ }];
4449
4488
  "linteffect/no-log-only-error-handling": ["error", {
4450
4489
  effectVersion: 3;
4451
4490
  }];
@@ -4480,6 +4519,9 @@ declare const effect3: {
4480
4519
  "linteffect/no-catchall-generic-rethrow": ["error", {
4481
4520
  effectVersion: 3;
4482
4521
  }];
4522
+ "linteffect/no-error-cause-loss": ["error", {
4523
+ effectVersion: 3;
4524
+ }];
4483
4525
  "linteffect/no-log-only-error-handling": ["error", {
4484
4526
  effectVersion: 3;
4485
4527
  }];
@@ -5431,6 +5473,9 @@ declare const effect3: {
5431
5473
  "linteffect/no-catchall-generic-rethrow": ["error", {
5432
5474
  effectVersion: 3;
5433
5475
  }];
5476
+ "linteffect/no-error-cause-loss": ["error", {
5477
+ effectVersion: 3;
5478
+ }];
5434
5479
  "linteffect/no-log-only-error-handling": ["error", {
5435
5480
  effectVersion: 3;
5436
5481
  }];
@@ -5471,6 +5516,9 @@ declare const effect3: {
5471
5516
  "linteffect/no-catchall-generic-rethrow": ["error", {
5472
5517
  effectVersion: 3;
5473
5518
  }];
5519
+ "linteffect/no-error-cause-loss": ["error", {
5520
+ effectVersion: 3;
5521
+ }];
5474
5522
  "linteffect/no-log-only-error-handling": ["error", {
5475
5523
  effectVersion: 3;
5476
5524
  }];
@@ -6465,6 +6513,9 @@ declare const effect3: {
6465
6513
  "linteffect/no-catchall-generic-rethrow": ["error", {
6466
6514
  effectVersion: 3;
6467
6515
  }];
6516
+ "linteffect/no-error-cause-loss": ["error", {
6517
+ effectVersion: 3;
6518
+ }];
6468
6519
  "linteffect/no-log-only-error-handling": ["error", {
6469
6520
  effectVersion: 3;
6470
6521
  }];
@@ -6505,6 +6556,9 @@ declare const effect3: {
6505
6556
  "linteffect/no-catchall-generic-rethrow": ["error", {
6506
6557
  effectVersion: 3;
6507
6558
  }];
6559
+ "linteffect/no-error-cause-loss": ["error", {
6560
+ effectVersion: 3;
6561
+ }];
6508
6562
  "linteffect/no-log-only-error-handling": ["error", {
6509
6563
  effectVersion: 3;
6510
6564
  }];