@opsydyn/oxlint-effect 2.4.0 → 2.6.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 +88 -0
- package/dist/index.d.mts +41 -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,87 @@ 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
|
+
### Boolean Blindness Opt-In
|
|
303
|
+
|
|
304
|
+
| Rule | Catches | Prefer |
|
|
305
|
+
| --- | --- | --- |
|
|
306
|
+
| `linteffect/no-positional-boolean-literal` | Bare `true` or `false` passed directly to a function, optional call, or constructor. | A named option such as `submit(order, { notify: true })`, a named value, or separate operations for distinct behaviors. |
|
|
307
|
+
|
|
308
|
+
Enable it with `"linteffect/no-positional-boolean-literal": "warn"` in
|
|
309
|
+
your Oxlint `rules` after registering the plugin. It works in JavaScript and
|
|
310
|
+
TypeScript without an Effect import. It is included in both majors'
|
|
311
|
+
`allRules`, but not in `recommended`, `typeAware`, or `ddd`. It does not resolve
|
|
312
|
+
variables, assertions, spread arguments, or other expressions. There is no
|
|
313
|
+
autofix. See the [annotated example](examples/shared/boolean-blindness/positional.bad.ts)
|
|
314
|
+
and [clean alternatives](examples/shared/boolean-blindness/positional.good.ts).
|
|
315
|
+
|
|
316
|
+
### Effect UI Strict Opt-In
|
|
317
|
+
|
|
318
|
+
The next minor release adds the Effect 4-only `effectUiStrict` preset for
|
|
319
|
+
[`@effect/ui`](https://github.com/Effect-TS/ui). It is not available in 2.4.0.
|
|
320
|
+
It does not change `recommended`, `typeAware`, or the shared group presets.
|
|
321
|
+
Current `allRules` also includes these rules; `effect3.allRules` does not.
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
import { defineConfig } from "oxlint";
|
|
325
|
+
import { effectUiStrict } from "@opsydyn/oxlint-effect";
|
|
326
|
+
|
|
327
|
+
export default defineConfig({
|
|
328
|
+
jsPlugins: [...effectUiStrict.jsPlugins],
|
|
329
|
+
rules: effectUiStrict.rules,
|
|
330
|
+
});
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
When composing with an existing config, spread `effectUiStrictRules` into
|
|
334
|
+
`rules` and register `linteffect` only once. No Effect UI dependency or
|
|
335
|
+
type-aware backend is required by the plugin. The rules are scoped by
|
|
336
|
+
Effect UI imports in each file, not by project dependencies or filenames.
|
|
337
|
+
|
|
338
|
+
| Rule | Catches | Why |
|
|
339
|
+
| --- | --- | --- |
|
|
340
|
+
| `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. |
|
|
341
|
+
| `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. |
|
|
342
|
+
| `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. |
|
|
343
|
+
|
|
344
|
+
The two callback rules resolve real value imports of `Component` and `Html`, including
|
|
345
|
+
aliases and namespace imports from `@effect/ui` and `@effect/ui/html`. They
|
|
346
|
+
check direct or const-bound definitions, inline `make` projections
|
|
347
|
+
(`init`, `update`, `view`, `subscriptions`, `head`), split `update`,
|
|
348
|
+
`view`, and `fragment` functions, and inline HTML `.on` message mappers
|
|
349
|
+
rooted at the view's builder argument. Command issuance, descriptor
|
|
350
|
+
construction, Query result reads, event options and standalone host bootstrap
|
|
351
|
+
remain valid.
|
|
352
|
+
|
|
353
|
+
The runtime rule resolves value imports from `effect` and `effect/Effect`.
|
|
354
|
+
It checks `runSync`, `runSyncExit`, `runPromise`, `runPromiseExit`, `runFork`,
|
|
355
|
+
and `runCallback`, including their `*With(context)` forms only when applied.
|
|
356
|
+
For example, `Effect.runPromise(task)` and `pipe(task, Effect.runFork)`
|
|
357
|
+
violate the rule inside an update. `Effect.runPromiseWith(context)` on its
|
|
358
|
+
own just builds a runner. Method pipelines are checked only on direct
|
|
359
|
+
`Effect.succeed`, `fail`, `sync`, `gen`, `promise`, `tryPromise`, or
|
|
360
|
+
`suspend` calls.
|
|
361
|
+
|
|
362
|
+
The eager-boundary rule checks arguments even outside UI projections. It
|
|
363
|
+
recognises imported `Command.make`, `Mount.make/makeStream`,
|
|
364
|
+
`Subscription.make/direct`, Command and Query service factory applications,
|
|
365
|
+
local service `toLayer` calls, and core `Layer` constructors in files that
|
|
366
|
+
value-import Effect UI. It checks nested argument expressions without entering
|
|
367
|
+
function bodies. For example, `Layer.effect(Tag, Effect.succeed(fetch(url)))`
|
|
368
|
+
starts the request before the Layer builds. Pass
|
|
369
|
+
`Layer.effect(Tag, Effect.promise(() => fetch(url)))` when the service should
|
|
370
|
+
be the response rather than an already-started promise. The service type must
|
|
371
|
+
match that change.
|
|
372
|
+
|
|
373
|
+
These are syntax-local checks, not a proof of purity. Imported helpers,
|
|
374
|
+
unknown callbacks, aliased globals, spread options, stored runner aliases,
|
|
375
|
+
arbitrary runtime objects, and imported service or issued descriptor factories
|
|
376
|
+
are outside their scope. An eager argument inside a verified pure callback can
|
|
377
|
+
trigger both a boundary and a callback rule. There is no autofix. See the
|
|
378
|
+
[pinned examples](examples/effect-ui-consumer/README.md) and
|
|
379
|
+
[Effect UI roadmap](roadmap/16-effect-ui-strict/README.md). This addition
|
|
380
|
+
revises the single measured runtime cap to 33 kB; see
|
|
381
|
+
[ADR 0005](docs/adr/0005-effect-ui-strict-boundaries.md).
|
|
382
|
+
|
|
301
383
|
### Configure One Rule Group
|
|
302
384
|
|
|
303
385
|
Every named preset in the following table is exported as a config-shaped preset
|
|
@@ -523,6 +605,12 @@ Effect flow, domain meaning, or runtime boundaries.
|
|
|
523
605
|
|
|
524
606
|
### Service and Layer Architecture
|
|
525
607
|
|
|
608
|
+
See [service-provision guidance](skills/oxlint-effect/references/service-provision.md)
|
|
609
|
+
for both-major examples of ambient dependencies, intentional pins, and local
|
|
610
|
+
overrides. Redundant re-provision remains review-only: matching a tag and
|
|
611
|
+
instance does not prove a later caller would use that instance, and pinning
|
|
612
|
+
does not extend resource lifetime.
|
|
613
|
+
|
|
526
614
|
| Rule | Catches | Why |
|
|
527
615
|
| --- | --- | --- |
|
|
528
616
|
| `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. |
|
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", {
|
|
@@ -566,6 +575,7 @@ declare const reactAndRuntimeBoundariesRules: {
|
|
|
566
575
|
}];
|
|
567
576
|
"linteffect/no-raw-domain-id-alias": "error";
|
|
568
577
|
"linteffect/no-boolean-domain-flag": "error";
|
|
578
|
+
"linteffect/no-positional-boolean-literal": "error";
|
|
569
579
|
"linteffect/no-magic-domain-string": "error";
|
|
570
580
|
"linteffect/no-raw-domain-primitive-params": "error";
|
|
571
581
|
"linteffect/no-raw-time-domain-field": "error";
|
|
@@ -3866,6 +3876,7 @@ declare const effect3: {
|
|
|
3866
3876
|
}];
|
|
3867
3877
|
"linteffect/no-raw-domain-id-alias": "error";
|
|
3868
3878
|
"linteffect/no-boolean-domain-flag": "error";
|
|
3879
|
+
"linteffect/no-positional-boolean-literal": "error";
|
|
3869
3880
|
"linteffect/no-magic-domain-string": "error";
|
|
3870
3881
|
"linteffect/no-raw-domain-primitive-params": "error";
|
|
3871
3882
|
"linteffect/no-raw-time-domain-field": "error";
|
|
@@ -6720,7 +6731,36 @@ declare const effect3: {
|
|
|
6720
6731
|
};
|
|
6721
6732
|
};
|
|
6722
6733
|
};
|
|
6734
|
+
/** Opt-in Effect UI rules; not part of the shared Effect 3/4 presets. */
|
|
6735
|
+
declare const effectUiStrictRules: {
|
|
6736
|
+
"linteffect/no-effect-ui-io-in-pure-callbacks": ["error", {
|
|
6737
|
+
effectVersion: 4;
|
|
6738
|
+
}];
|
|
6739
|
+
"linteffect/no-effect-ui-runtime-escape": ["error", {
|
|
6740
|
+
effectVersion: 4;
|
|
6741
|
+
}];
|
|
6742
|
+
"linteffect/no-effect-ui-eager-boundary-io": ["error", {
|
|
6743
|
+
effectVersion: 4;
|
|
6744
|
+
}];
|
|
6745
|
+
};
|
|
6746
|
+
declare const effectUiStrict: {
|
|
6747
|
+
readonly jsPlugins: readonly [{
|
|
6748
|
+
readonly name: "linteffect";
|
|
6749
|
+
readonly specifier: "@opsydyn/oxlint-effect";
|
|
6750
|
+
}];
|
|
6751
|
+
readonly rules: {
|
|
6752
|
+
"linteffect/no-effect-ui-io-in-pure-callbacks": ["error", {
|
|
6753
|
+
effectVersion: 4;
|
|
6754
|
+
}];
|
|
6755
|
+
"linteffect/no-effect-ui-runtime-escape": ["error", {
|
|
6756
|
+
effectVersion: 4;
|
|
6757
|
+
}];
|
|
6758
|
+
"linteffect/no-effect-ui-eager-boundary-io": ["error", {
|
|
6759
|
+
effectVersion: 4;
|
|
6760
|
+
}];
|
|
6761
|
+
};
|
|
6762
|
+
};
|
|
6723
6763
|
declare const _default: import("@oxlint/plugins").Plugin;
|
|
6724
6764
|
//#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 };
|
|
6765
|
+
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
6766
|
//# sourceMappingURL=index.d.mts.map
|