@opsydyn/oxlint-effect 2.3.0 → 2.5.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 +92 -1
- package/dist/index.d.mts +39 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/skills/oxlint-effect/SKILL.md +9 -1
- package/skills/oxlint-effect/assets/effect4/service-provision.contracts.ts +66 -0
- package/skills/oxlint-effect/assets/effect4/service-provision.good.ts +34 -0
- package/skills/oxlint-effect/assets/effect4/service-provision.review.ts +17 -0
- package/skills/oxlint-effect/assets/effect4/service-provision.types.ts +19 -0
- package/skills/oxlint-effect/assets/service-provision.contracts.ts +66 -0
- package/skills/oxlint-effect/assets/service-provision.good.ts +36 -0
- package/skills/oxlint-effect/assets/service-provision.review.ts +17 -0
- package/skills/oxlint-effect/assets/service-provision.types.ts +19 -0
- package/skills/oxlint-effect/references/service-provision.md +56 -0
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ installs from npm and checks annotated failures alongside clean repairs.
|
|
|
43
43
|
- [Effect 3 migration](#configure-legacy-effect-3)
|
|
44
44
|
- [Individual groups and composition](#configure-one-rule-group)
|
|
45
45
|
- [Type-aware opt-in](#configure-type-aware-linting)
|
|
46
|
+
- [Effect UI strict opt-in](#effect-ui-strict-opt-in)
|
|
46
47
|
- [Agent skill](#agent-skill)
|
|
47
48
|
- [Editor setup and missing diagnostics](#editor-setup-and-missing-diagnostics)
|
|
48
49
|
- [Rule catalogue](#rule-groups)
|
|
@@ -298,6 +299,73 @@ backends did not report identical compiler diagnostics with `--type-check`.
|
|
|
298
299
|
Linux and editor integration have not been verified by this project.
|
|
299
300
|
See the [optional packed-consumer check](examples/type-aware-consumer/README.md#optional-tsrs-verification).
|
|
300
301
|
|
|
302
|
+
### Effect UI Strict Opt-In
|
|
303
|
+
|
|
304
|
+
The next minor release adds the Effect 4-only `effectUiStrict` preset for
|
|
305
|
+
[`@effect/ui`](https://github.com/Effect-TS/ui). It is not available in 2.4.0.
|
|
306
|
+
It does not change `recommended`, `typeAware`, or the shared group presets.
|
|
307
|
+
Current `allRules` also includes these rules; `effect3.allRules` does not.
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
import { defineConfig } from "oxlint";
|
|
311
|
+
import { effectUiStrict } from "@opsydyn/oxlint-effect";
|
|
312
|
+
|
|
313
|
+
export default defineConfig({
|
|
314
|
+
jsPlugins: [...effectUiStrict.jsPlugins],
|
|
315
|
+
rules: effectUiStrict.rules,
|
|
316
|
+
});
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
When composing with an existing config, spread `effectUiStrictRules` into
|
|
320
|
+
`rules` and register `linteffect` only once. No Effect UI dependency or
|
|
321
|
+
type-aware backend is required by the plugin. The rules are scoped by
|
|
322
|
+
Effect UI imports in each file, not by project dependencies or filenames.
|
|
323
|
+
|
|
324
|
+
| Rule | Catches | Why |
|
|
325
|
+
| --- | --- | --- |
|
|
326
|
+
| `linteffect/no-effect-ui-io-in-pure-callbacks` | Direct global fetch, timers, listeners, network constructors, and document/storage member access in verified Effect UI projections. | Keep state transitions and rendering replayable; move host work into an owned Command, Subscription, Mount, Query, or Layer. |
|
|
327
|
+
| `linteffect/no-effect-ui-runtime-escape` | Direct Effect runners, invoked context-bound runners, and supported runner pipeline steps in those projections. | Keep the UI runtime in charge of starting work; issue a Command with `$.run(...)` instead of starting a separate Effect runtime. |
|
|
328
|
+
| `linteffect/no-effect-ui-eager-boundary-io` | Direct host I/O or Effect runners evaluated while constructing recognised Command, Subscription, Mount, Query, or Layer boundaries. | Work passed to a boundary has already started unless you defer it in the managed callback or a lazy Effect. |
|
|
329
|
+
|
|
330
|
+
The two callback rules resolve real value imports of `Component` and `Html`, including
|
|
331
|
+
aliases and namespace imports from `@effect/ui` and `@effect/ui/html`. They
|
|
332
|
+
check direct or const-bound definitions, inline `make` projections
|
|
333
|
+
(`init`, `update`, `view`, `subscriptions`, `head`), split `update`,
|
|
334
|
+
`view`, and `fragment` functions, and inline HTML `.on` message mappers
|
|
335
|
+
rooted at the view's builder argument. Command issuance, descriptor
|
|
336
|
+
construction, Query result reads, event options and standalone host bootstrap
|
|
337
|
+
remain valid.
|
|
338
|
+
|
|
339
|
+
The runtime rule resolves value imports from `effect` and `effect/Effect`.
|
|
340
|
+
It checks `runSync`, `runSyncExit`, `runPromise`, `runPromiseExit`, `runFork`,
|
|
341
|
+
and `runCallback`, including their `*With(context)` forms only when applied.
|
|
342
|
+
For example, `Effect.runPromise(task)` and `pipe(task, Effect.runFork)`
|
|
343
|
+
violate the rule inside an update. `Effect.runPromiseWith(context)` on its
|
|
344
|
+
own just builds a runner. Method pipelines are checked only on direct
|
|
345
|
+
`Effect.succeed`, `fail`, `sync`, `gen`, `promise`, `tryPromise`, or
|
|
346
|
+
`suspend` calls.
|
|
347
|
+
|
|
348
|
+
The eager-boundary rule checks arguments even outside UI projections. It
|
|
349
|
+
recognises imported `Command.make`, `Mount.make/makeStream`,
|
|
350
|
+
`Subscription.make/direct`, Command and Query service factory applications,
|
|
351
|
+
local service `toLayer` calls, and core `Layer` constructors in files that
|
|
352
|
+
value-import Effect UI. It checks nested argument expressions without entering
|
|
353
|
+
function bodies. For example, `Layer.effect(Tag, Effect.succeed(fetch(url)))`
|
|
354
|
+
starts the request before the Layer builds. Pass
|
|
355
|
+
`Layer.effect(Tag, Effect.promise(() => fetch(url)))` when the service should
|
|
356
|
+
be the response rather than an already-started promise. The service type must
|
|
357
|
+
match that change.
|
|
358
|
+
|
|
359
|
+
These are syntax-local checks, not a proof of purity. Imported helpers,
|
|
360
|
+
unknown callbacks, aliased globals, spread options, stored runner aliases,
|
|
361
|
+
arbitrary runtime objects, and imported service or issued descriptor factories
|
|
362
|
+
are outside their scope. An eager argument inside a verified pure callback can
|
|
363
|
+
trigger both a boundary and a callback rule. There is no autofix. See the
|
|
364
|
+
[pinned examples](examples/effect-ui-consumer/README.md) and
|
|
365
|
+
[Effect UI roadmap](roadmap/16-effect-ui-strict/README.md). This addition
|
|
366
|
+
revises the single measured runtime cap to 33 kB; see
|
|
367
|
+
[ADR 0005](docs/adr/0005-effect-ui-strict-boundaries.md).
|
|
368
|
+
|
|
301
369
|
### Configure One Rule Group
|
|
302
370
|
|
|
303
371
|
Every named preset in the following table is exported as a config-shaped preset
|
|
@@ -523,6 +591,12 @@ Effect flow, domain meaning, or runtime boundaries.
|
|
|
523
591
|
|
|
524
592
|
### Service and Layer Architecture
|
|
525
593
|
|
|
594
|
+
See [service-provision guidance](skills/oxlint-effect/references/service-provision.md)
|
|
595
|
+
for both-major examples of ambient dependencies, intentional pins, and local
|
|
596
|
+
overrides. Redundant re-provision remains review-only: matching a tag and
|
|
597
|
+
instance does not prove a later caller would use that instance, and pinning
|
|
598
|
+
does not extend resource lifetime.
|
|
599
|
+
|
|
526
600
|
| Rule | Catches | Why |
|
|
527
601
|
| --- | --- | --- |
|
|
528
602
|
| `linteffect/prefer-effect-service` | Legacy `Context.Tag`/`GenericTag` definitions; v4 also flags removed `Effect.Service` calls. | V4 repair: use `Context.Service` keys/classes, optional `make` and explicit layers. Bare v4 keys are valid. Legacy `effect3` repair remains `Effect.Service`. The historical rule ID is retained. |
|
|
@@ -889,10 +963,27 @@ not currently expose it; it is not part of the v1 export surface.
|
|
|
889
963
|
| `linteffect/no-raw-time-domain-field` | Time-looking fields typed as `number` or `Date`. | Models durations and clock boundaries explicitly. |
|
|
890
964
|
| `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. |
|
|
891
965
|
| `linteffect/no-domain-logic-in-conditional` | Multi-clause business rules embedded in boolean expressions. | Extracts named predicates or validation Effects that can be tested. |
|
|
892
|
-
| `linteffect/no-implicit-state-machine-object` | Multiple
|
|
966
|
+
| `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. |
|
|
893
967
|
| `linteffect/no-adhoc-domain-error` | `Effect.fail("...")` and `throw new Error("...")` in domain code. | Uses structured tagged errors for recovery and observability. |
|
|
894
968
|
| `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. |
|
|
895
969
|
|
|
970
|
+
Configure pairs when the domain says those flags describe the same lifecycle.
|
|
971
|
+
|
|
972
|
+
```ts
|
|
973
|
+
rules: {
|
|
974
|
+
"linteffect/no-implicit-state-machine-object": [
|
|
975
|
+
"error",
|
|
976
|
+
{ schemaFlagPairs: [["open", "asking"]] },
|
|
977
|
+
],
|
|
978
|
+
}
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
This reports an inline Effect `Schema.Struct` containing both named fields as
|
|
982
|
+
direct `Schema.Boolean` members. The rule resolves the Effect Schema import,
|
|
983
|
+
including import aliases. Spreads, computed keys, and wrapped or referenced
|
|
984
|
+
schemas are outside the check. The existing conditional check also runs when
|
|
985
|
+
the option is omitted.
|
|
986
|
+
|
|
896
987
|
### Error Modeling
|
|
897
988
|
|
|
898
989
|
**Since 2.3.0:** `no-error-cause-loss` is included in `errorModeling`,
|
package/dist/index.d.mts
CHANGED
|
@@ -516,6 +516,15 @@ declare const reactAndRuntimeBoundariesRules: {
|
|
|
516
516
|
effectVersion: 4;
|
|
517
517
|
}];
|
|
518
518
|
"linteffect/no-render-side-effects": "error";
|
|
519
|
+
"linteffect/no-effect-ui-io-in-pure-callbacks": ["error", {
|
|
520
|
+
effectVersion: 4;
|
|
521
|
+
}];
|
|
522
|
+
"linteffect/no-effect-ui-runtime-escape": ["error", {
|
|
523
|
+
effectVersion: 4;
|
|
524
|
+
}];
|
|
525
|
+
"linteffect/no-effect-ui-eager-boundary-io": ["error", {
|
|
526
|
+
effectVersion: 4;
|
|
527
|
+
}];
|
|
519
528
|
"linteffect/no-atom-registry-effect-sync": "error";
|
|
520
529
|
"linteffect/no-family-collection-read": "error";
|
|
521
530
|
"linteffect/no-inline-runtime-provide": ["error", {
|
|
@@ -6720,7 +6729,36 @@ declare const effect3: {
|
|
|
6720
6729
|
};
|
|
6721
6730
|
};
|
|
6722
6731
|
};
|
|
6732
|
+
/** Opt-in Effect UI rules; not part of the shared Effect 3/4 presets. */
|
|
6733
|
+
declare const effectUiStrictRules: {
|
|
6734
|
+
"linteffect/no-effect-ui-io-in-pure-callbacks": ["error", {
|
|
6735
|
+
effectVersion: 4;
|
|
6736
|
+
}];
|
|
6737
|
+
"linteffect/no-effect-ui-runtime-escape": ["error", {
|
|
6738
|
+
effectVersion: 4;
|
|
6739
|
+
}];
|
|
6740
|
+
"linteffect/no-effect-ui-eager-boundary-io": ["error", {
|
|
6741
|
+
effectVersion: 4;
|
|
6742
|
+
}];
|
|
6743
|
+
};
|
|
6744
|
+
declare const effectUiStrict: {
|
|
6745
|
+
readonly jsPlugins: readonly [{
|
|
6746
|
+
readonly name: "linteffect";
|
|
6747
|
+
readonly specifier: "@opsydyn/oxlint-effect";
|
|
6748
|
+
}];
|
|
6749
|
+
readonly rules: {
|
|
6750
|
+
"linteffect/no-effect-ui-io-in-pure-callbacks": ["error", {
|
|
6751
|
+
effectVersion: 4;
|
|
6752
|
+
}];
|
|
6753
|
+
"linteffect/no-effect-ui-runtime-escape": ["error", {
|
|
6754
|
+
effectVersion: 4;
|
|
6755
|
+
}];
|
|
6756
|
+
"linteffect/no-effect-ui-eager-boundary-io": ["error", {
|
|
6757
|
+
effectVersion: 4;
|
|
6758
|
+
}];
|
|
6759
|
+
};
|
|
6760
|
+
};
|
|
6723
6761
|
declare const _default: import("@oxlint/plugins").Plugin;
|
|
6724
6762
|
//#endregion
|
|
6725
|
-
export { EffectRuleEntry, EffectRuleOptions, type EffectVersion, allRules, atomStateAndPlatformBoundaries, atomStateAndPlatformBoundariesRules, behaviorDecoration, behaviorDecorationRules, branchingAndLocalControlFlow, branchingAndLocalControlFlowRules, concurrencySafety, concurrencySafetyRules, ddd, dddRules, _default as default, domainModeling, domainModelingRules, effect3, effectComposition, effectCompositionRules, effectFlow, effectFlowRules, errorModeling, errorModelingRules, jsPlugins, optionMatchAndDataNormalization, optionMatchAndDataNormalizationRules, pipelineShapeAndSequencing, pipelineShapeAndSequencingRules, platformAndBoundaryHygiene, platformAndBoundaryHygieneRules, presets, pureTransformation, pureTransformationRules, reactAndRuntimeBoundaries, reactAndRuntimeBoundariesRules, recommended, recommendedRules, resourceLifetime, resourceLifetimeRules, ruleGroups, serviceAndLayerArchitecture, serviceAndLayerArchitectureRules, styleSeparation, styleSeparationRules, testingObservabilityAndQa, testingObservabilityAndQaRules, typeAware };
|
|
6763
|
+
export { EffectRuleEntry, EffectRuleOptions, type EffectVersion, allRules, atomStateAndPlatformBoundaries, atomStateAndPlatformBoundariesRules, behaviorDecoration, behaviorDecorationRules, branchingAndLocalControlFlow, branchingAndLocalControlFlowRules, concurrencySafety, concurrencySafetyRules, ddd, dddRules, _default as default, domainModeling, domainModelingRules, effect3, effectComposition, effectCompositionRules, effectFlow, effectFlowRules, effectUiStrict, effectUiStrictRules, errorModeling, errorModelingRules, jsPlugins, optionMatchAndDataNormalization, optionMatchAndDataNormalizationRules, pipelineShapeAndSequencing, pipelineShapeAndSequencingRules, platformAndBoundaryHygiene, platformAndBoundaryHygieneRules, presets, pureTransformation, pureTransformationRules, reactAndRuntimeBoundaries, reactAndRuntimeBoundariesRules, recommended, recommendedRules, resourceLifetime, resourceLifetimeRules, ruleGroups, serviceAndLayerArchitecture, serviceAndLayerArchitectureRules, styleSeparation, styleSeparationRules, testingObservabilityAndQa, testingObservabilityAndQaRules, typeAware };
|
|
6726
6764
|
//# sourceMappingURL=index.d.mts.map
|