@opsydyn/oxlint-effect 0.1.0 → 0.2.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 +109 -51
- package/dist/index.mjs +679 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,54 +34,112 @@ export default defineConfig({
|
|
|
34
34
|
});
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
37
|
+
## Rule Groups
|
|
38
|
+
|
|
39
|
+
The recommended config enables every rule as an error. The rules are heuristic:
|
|
40
|
+
they flag code shapes that tend to hide Effect flow, domain meaning, or runtime
|
|
41
|
+
boundaries.
|
|
42
|
+
|
|
43
|
+
### React and Runtime Boundaries
|
|
44
|
+
|
|
45
|
+
| Rule | Catches | Why |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| `linteffect/no-react-state` | React state hooks such as `useState`, `useReducer`, and `useEffect`. | Keeps React UI state in the atom/runtime model instead of bypassing it. |
|
|
48
|
+
| `linteffect/no-runtime-runfork` | `Runtime.runFork(...)`. | Detached fibers hide ownership, interruption, and lifecycle boundaries. |
|
|
49
|
+
| `linteffect/no-run-effect-outside-boundary` | Direct `Effect.runPromise`, `Effect.runSync`, `Effect.runFork`, and related `Effect.run*` calls. | Keeps Effect execution owned by app, CLI, worker, route, or test boundaries. |
|
|
50
|
+
| `linteffect/no-or-die-outside-boundary` | `Effect.orDie(...)`, `Effect.orDieWith(...)`, and pipe arguments such as `Effect.orDie`. | Prevents recoverable typed failures from being converted to defects inside domain logic. |
|
|
51
|
+
| `linteffect/prevent-dynamic-imports` | Dynamic `import(...)`. | Static imports keep dependency boundaries visible. |
|
|
52
|
+
| `linteffect/no-render-side-effects` | `Match.value(...).pipe(...)` used as a render-time statement. | Prevents side effects from running during render. |
|
|
53
|
+
| `linteffect/no-inline-runtime-provide` | Inline `Effect.provide(...)` inside local runtime/generator chains. | Keeps dependency assembly at service or application boundaries. |
|
|
54
|
+
|
|
55
|
+
### Effect Composition
|
|
56
|
+
|
|
57
|
+
| Rule | Catches | Why |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| `linteffect/no-effect-as` | Direct `Effect.as(...)` wrappers. | Makes value flow explicit instead of discarding meaning behind a placeholder. |
|
|
60
|
+
| `linteffect/no-effect-do` | `Effect.Do`. | Avoids builder-style hidden sequencing. |
|
|
61
|
+
| `linteffect/no-effect-bind` | `Effect.bind(...)`. | Prefers direct `Effect.gen` or pipeline flow over builder state. |
|
|
62
|
+
| `linteffect/no-effect-async` | `Effect.async(...)`. | Manual callback bridges are easy to leak or resume incorrectly. |
|
|
63
|
+
| `linteffect/no-effect-ignore` | `Effect.ignore(...)` and pipe arguments such as `Effect.ignore`. | Makes ignored failures explicit at boundaries instead of burying failure ownership. |
|
|
64
|
+
| `linteffect/no-effect-never` | `Effect.never`. | Infinite effects should have explicit lifecycle and teardown ownership. |
|
|
65
|
+
| `linteffect/no-effect-fn-generator` | `Effect.fn(function* ...)`. | Avoids wrapper generators that obscure sequencing. |
|
|
66
|
+
| `linteffect/no-nested-effect-gen` | `Effect.gen` nested inside another `Effect.gen`. | Keeps generator-based effects linear. |
|
|
67
|
+
| `linteffect/no-yield-without-star-in-effect-gen` | Plain `yield` inside `Effect.gen`. | Requires `yield*` so generator steps delegate to the Effect interpreter. |
|
|
68
|
+
| `linteffect/no-async-effect-combinator-callback` | `async` callbacks passed to common Effect combinators. | Prevents Promise-returning callbacks from bypassing Effect error, interruption, and tracing semantics. |
|
|
69
|
+
| `linteffect/no-throw-in-effect-logic` | `throw` inside `Effect.gen` or common Effect combinator callbacks. | Keeps failures in typed Effect error channels. |
|
|
70
|
+
| `linteffect/no-try-catch-in-effect-logic` | `try/catch` inside `Effect.gen` or common Effect combinator callbacks. | Uses Effect error combinators instead of local imperative recovery. |
|
|
71
|
+
| `linteffect/no-promise-api-in-effect-logic` | `Promise.all`, `Promise.race`, `.then`, `.catch`, and related Promise APIs inside Effect logic. | Keeps scheduling, cancellation, tracing, and failures inside Effect. |
|
|
72
|
+
| `linteffect/no-swallowed-catch-all` | `Effect.catchAll` handlers that recover with `Effect.succeed`, `Effect.void`, `Effect.asVoid`, or `Effect.ignore`. | Avoids hiding failures without telemetry, re-fail, or explicit typed recovery. |
|
|
73
|
+
| `linteffect/no-manual-effect-channels` | Manual `Effect.Effect<...>` and `Layer.Layer<...>` channel types. | Lets Effect infer channels from real composition. |
|
|
74
|
+
| `linteffect/no-effect-type-alias` | Type aliases around `Effect.Effect<...>`. | Keeps service surfaces concrete and discoverable. |
|
|
75
|
+
| `linteffect/no-public-generic-effect-error` | Exported APIs returning `Effect.Effect<_, Error, _>`. | Public Effect APIs should expose tagged, recoverable domain errors instead of generic `Error`. |
|
|
76
|
+
|
|
77
|
+
### Pipeline Shape and Sequencing
|
|
78
|
+
|
|
79
|
+
| Rule | Catches | Why |
|
|
80
|
+
| --- | --- | --- |
|
|
81
|
+
| `linteffect/no-nested-effect-call` | Deeply nested `Effect.xx(Effect.yy(...))` calls. | Flattens sequencing into readable pipelines. |
|
|
82
|
+
| `linteffect/no-effect-ladder` | Nested Effect combinator ladders in assignments or returns. | Avoids control flow hidden inside expression towers. |
|
|
83
|
+
| `linteffect/no-flatmap-ladder` | Nested `Effect.flatMap` and `map` plus `flatten` ladders. | Encourages one clear bind point after context is built. |
|
|
84
|
+
| `linteffect/no-pipe-ladder` | Nested `pipe(...)` or method `.pipe(...)` chains. | Keeps pipelines flat and scan-friendly. |
|
|
85
|
+
| `linteffect/no-call-tower` | Effect calls passed directly into other Effect calls. | Makes intermediate effects named or piped. |
|
|
86
|
+
| `linteffect/no-effect-orElse-ladder` | `Effect.orElse` wrapped around sequencing chains. | Keeps error handling at an explicit decision point. |
|
|
87
|
+
| `linteffect/no-effect-wrapper-alias` | Const/function aliases that only wrap Effect calls. | Discourages wrapper choreography with no domain meaning. |
|
|
88
|
+
| `linteffect/warn-effect-sync-wrapper` | `Effect.sync(() => someCall())` around non-console calls. | Avoids hiding side effects behind vague sync wrappers. |
|
|
89
|
+
| `linteffect/no-effect-side-effect-wrapper` | `Effect.as` or `Effect.zipRight` around side-effecting operands. | Prevents side effects from being disguised as discarded values. |
|
|
90
|
+
| `linteffect/no-effect-all-step-sequencing` | Sequential side effects hidden in `Effect.all(..., { concurrency: 1 })`. | Reserves `Effect.all` for aggregation, not imperative step lists. |
|
|
91
|
+
| `linteffect/no-effect-succeed-variable` | `Effect.succeed(variable)` used as a branch placeholder. | Encourages selecting plain values before entering Effect flow. |
|
|
92
|
+
|
|
93
|
+
### Branching and Local Control Flow
|
|
94
|
+
|
|
95
|
+
| Rule | Catches | Why |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| `linteffect/no-if-statement` | Imperative `if` statements in Effect files. | Pushes branching toward typed Match/Option/Either decisions. |
|
|
98
|
+
| `linteffect/no-switch-statement` | Imperative `switch` statements in Effect files. | Encourages exhaustive domain matching. |
|
|
99
|
+
| `linteffect/no-ternary` | Ternary expressions in Effect files. | Keeps decisions explicit and named. |
|
|
100
|
+
| `linteffect/no-try-catch` | `try/catch`. | Keeps failures in typed Effect error channels. |
|
|
101
|
+
| `linteffect/no-arrow-ladder` | Nested arrow IIFEs. | Avoids local wrapper control flow. |
|
|
102
|
+
| `linteffect/no-iife-wrapper` | Immediately invoked function wrappers. | Moves decisions into named values or pipelines. |
|
|
103
|
+
| `linteffect/no-return-in-arrow` | `return` inside block-bodied arrow callbacks. | Prefers expression callbacks for simple pipeline steps. |
|
|
104
|
+
| `linteffect/no-return-in-callback` | `return` inside inline function callbacks. | Reduces hidden local control flow. |
|
|
105
|
+
| `linteffect/no-return-null` | `return null` in Effect files. | Uses `Option.none` or typed failures instead of null sentinels. |
|
|
106
|
+
| `linteffect/no-branch-in-object` | Match/Option/Either decisions inside object literals. | Computes decisions first, then builds data from named values. |
|
|
107
|
+
|
|
108
|
+
### Option, Match, and Data Normalization
|
|
109
|
+
|
|
110
|
+
| Rule | Catches | Why |
|
|
111
|
+
| --- | --- | --- |
|
|
112
|
+
| `linteffect/no-option-as` | `Option.as(...)`. | Makes selection explicit with `Option.map` or `Option.match`. |
|
|
113
|
+
| `linteffect/no-match-void-branch` | Match branches returning `Effect.void`. | Avoids no-op branches that hide guard-style control flow. |
|
|
114
|
+
| `linteffect/no-match-effect-branch` | Multi-step sequencing inside Match or Option branches. | Selects data in Match/Option, then runs one Effect pipeline. |
|
|
115
|
+
| `linteffect/no-model-overlay-cast` | `as` assertions on decoded model flow. | Avoids hiding schema drift with unchecked overlays. |
|
|
116
|
+
| `linteffect/no-unknown-boolean-coercion-helper` | Local unknown-to-boolean checks paired with null fallback matching. | Moves boolean normalization to the schema boundary. |
|
|
117
|
+
| `linteffect/no-fromnullable-nullish-coalesce` | `Option.fromNullable(value ?? null)` or `?? undefined`. | Passes nullable sources directly without rewrapping noise. |
|
|
118
|
+
| `linteffect/no-option-boolean-normalization` | Repeated `Option.match` boolean normalization. | Normalizes once at the boundary and reads typed booleans later. |
|
|
119
|
+
| `linteffect/no-string-sentinel-return` | `Effect.succeed("token")` sentinel returns. | Uses domain values, Option/Either, or tagged unions for decisions. |
|
|
120
|
+
| `linteffect/no-string-sentinel-const` | String constants used as state/status tokens. | Avoids ad hoc string state machines. |
|
|
121
|
+
|
|
122
|
+
### Atom, State, and Platform Boundaries
|
|
123
|
+
|
|
124
|
+
| Rule | Catches | Why |
|
|
125
|
+
| --- | --- | --- |
|
|
126
|
+
| `linteffect/no-effect-sync-console` | `console.*` inside `Effect.sync`. | Uses `Effect.log*` or a real logging boundary. |
|
|
127
|
+
| `linteffect/no-atom-registry-effect-sync` | Atom or atom registry operations wrapped in `Effect.sync`. | Keeps atom operations in the atom flow. |
|
|
128
|
+
| `linteffect/no-family-collection-read` | `Atom.family` projections that read broad collection atoms. | Keeps keyed atoms keyed instead of coupling to whole collections. |
|
|
129
|
+
| `linteffect/no-naked-object-state-update` | Raw object spreading, `Object.assign`, JSON rebuilds, and similar state shortcuts. | Preserves explicit model transitions and schema boundaries. |
|
|
130
|
+
| `linteffect/no-wrapgraphql-catchall` | `Effect.catchAll` after `wrapGraphqlCall` or `applyResponse`. | Handles GraphQL envelope errors at the response mapping boundary. |
|
|
131
|
+
|
|
132
|
+
### Domain Modeling
|
|
133
|
+
|
|
134
|
+
| Rule | Catches | Why |
|
|
135
|
+
| --- | --- | --- |
|
|
136
|
+
| `linteffect/no-raw-domain-id-alias` | `type UserId = string` and similar raw ID aliases. | Branded IDs prevent swapped identifiers across boundaries. |
|
|
137
|
+
| `linteffect/no-boolean-domain-flag` | Boolean behavior flags such as `shouldNotifyCustomer`. | Replaces hidden modes with commands, tagged unions, or explicit functions. |
|
|
138
|
+
| `linteffect/no-magic-domain-string` | Raw string comparisons such as `status === "approved"`. | Makes domain vocabularies typed and exhaustive. |
|
|
139
|
+
| `linteffect/no-raw-domain-primitive-params` | Domain-looking functions with several raw string/number params. | Introduces branded values or command objects for meaningful inputs. |
|
|
140
|
+
| `linteffect/no-raw-time-domain-field` | Time-looking fields typed as `number` or `Date`. | Models durations and clock boundaries explicitly. |
|
|
141
|
+
| `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. |
|
|
142
|
+
| `linteffect/no-domain-logic-in-conditional` | Multi-clause business rules embedded in boolean expressions. | Extracts named predicates or validation Effects that can be tested. |
|
|
143
|
+
| `linteffect/no-implicit-state-machine-object` | Multiple boolean lifecycle flags on one object. | Models impossible states away with tagged unions. |
|
|
144
|
+
| `linteffect/no-adhoc-domain-error` | `Effect.fail("...")` and `throw new Error("...")` in domain code. | Uses structured tagged errors for recovery and observability. |
|
|
145
|
+
| `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. |
|