@systemfsoftware/oxlint-plugin-effect-platform 2.1.8 → 3.0.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/CHANGELOG.md +5 -3
- package/README.md +21 -10
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +1093 -231
- package/dist/oxlint-plugin-effect-platform-untrimmed.d.ts +2 -0
- package/dist/oxlint-plugin-effect-platform.d.ts +2 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# @systemfsoftware/oxlint-plugin-effect-platform
|
|
2
2
|
|
|
3
|
-
# @systemfsoftware/oxlint-plugin-effect-platform@
|
|
3
|
+
# @systemfsoftware/oxlint-plugin-effect-platform@3.0.0
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`no-die-on-service-option` reports an `Effect.serviceOption` read whose own `None` branch reaches a defect — `Effect.die`, `Effect.failCause(Cause.die(...))`, `throw`, `Option.getOrThrow`/`Option.getOrThrowWith`, or `Effect.orDie` over an `Effect.fromOption` of the read — and is enabled at `error` in the recommended preset. Optional reads that fall back, skip the work, or fail with a typed error keep passing. A consumer of the recommended preset must fix such reads in the change that takes this release: put the dependency back in the requirement type with `yield* Tag`, or handle absence with a fallback, a skip, or `Effect.fail`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
New rule `node-runtime-needs-engines` reports code that reaches the Node runtime directly (a Node builtin import, a Node global such as `process` or `Buffer`, a static `globalThis` or `Reflect.get` key naming one, or `import.meta.dirname`/`filename`/`resolve`) in a package whose nearest `package.json` declares no `engines.node`, and reports an `engines.node` that is not `^M.m.p` or `>=M.m.p` clauses joined by `||`. Test files are exempt except in a private package. The plugin's own recommended preset does not enable it.
|
|
8
|
+
|
|
9
|
+
Declares the Node.js lines it supports in `engines.node`: 22, 24 and 26 and later, each from the lowest release its runtime dependencies accept. A package manager with engine checks enabled now warns or refuses on an unsupported Node.
|
package/README.md
CHANGED
|
@@ -59,19 +59,21 @@ All six rules are in the recommended set, so the spread enables them at `error`.
|
|
|
59
59
|
|
|
60
60
|
## Rules
|
|
61
61
|
|
|
62
|
-
| Rule | Reports
|
|
63
|
-
| -------------------------------- |
|
|
64
|
-
| `entrypoint-interprets-once` | A `main.ts` with zero or more than one interpretation edge — `runMain` under any namespace, `Effect.run*`, `ManagedRuntime.make`, `Layer.toRuntime`
|
|
65
|
-
| `entrypoint-no-exports` | Any export from `main.ts`: named, default, `export *`, re-export, or type-only
|
|
66
|
-
| `entrypoint-not-imported` | Any static import, re-export, or dynamic `import()` of a `main` module, reported in the importing file — production, barrel, or test
|
|
67
|
-
| `entrypoint-no-promise-wrapper` | `runMain(Effect.tryPromise(...))` or `runMain(Effect.promise(...))`: the outer edge awaits a promise while the real fibers run in a runtime it cannot interrupt
|
|
68
|
-
| `runtime-construction-placement` | `ManagedRuntime.make`
|
|
69
|
-
| `no-unported-time-source` | A direct `Date.now`, `performance.now`, `process.hrtime`, `Math.random`, `crypto.getRandomValues`, `crypto.randomUUID`, `setTimeout`, `setInterval`, or `setImmediate` call, an argument-less `new Date()`, or a static or dynamic import of `node:timers` in production source outside a file listed in the rule's `ports` option
|
|
62
|
+
| Rule | Reports |
|
|
63
|
+
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| `entrypoint-interprets-once` | A `main.ts` with zero or more than one interpretation edge — `runMain` under any namespace, `Effect.run*`, `ManagedRuntime.make`, `Layer.toRuntime` |
|
|
65
|
+
| `entrypoint-no-exports` | Any export from `main.ts`: named, default, `export *`, re-export, or type-only |
|
|
66
|
+
| `entrypoint-not-imported` | Any static import, re-export, or dynamic `import()` of a `main` module, reported in the importing file — production, barrel, or test |
|
|
67
|
+
| `entrypoint-no-promise-wrapper` | `runMain(Effect.tryPromise(...))` or `runMain(Effect.promise(...))`: the outer edge awaits a promise while the real fibers run in a runtime it cannot interrupt |
|
|
68
|
+
| `runtime-construction-placement` | `ManagedRuntime.make` inside a function body — a runtime built per call that nothing finalizes — and `ManagedRuntime.make` at module scope, where importing the module starts fibers nothing can interrupt. It judges runtime code: a file under a `src/` directory segment, or a `*.test.ts` file; a package-root hook, config, or setup file is outside its subject |
|
|
69
|
+
| `no-unported-time-source` | A direct `Date.now`, `performance.now`, `process.hrtime`, `Math.random`, `crypto.getRandomValues`, `crypto.randomUUID`, `setTimeout`, `setInterval`, or `setImmediate` call, an argument-less `new Date()`, or a static or dynamic import of `node:timers` in production source outside a file listed in the rule's `ports` option |
|
|
70
|
+
| `no-die-on-service-option` | An `Effect.serviceOption` read whose own None branch reaches a defect: `Effect.die`, `Effect.failCause(Cause.die(…))`, `throw`, `Option.getOrThrow*`, or `Effect.orDie` over `Effect.fromOption` of the read. The read removes the service from the requirement type, so a defect on absence passes typecheck and fails only at runtime |
|
|
70
71
|
|
|
71
72
|
What the placement rule leaves alone, each a shape the rule's own fixtures pin:
|
|
72
73
|
|
|
73
|
-
- A module-scope closure that memoizes the construction — written into a cache binding (`??=`, `||=`, plain assignment) or
|
|
74
|
-
-
|
|
74
|
+
- A module-scope closure that memoizes the construction — written into a cache binding (`??=`, `||=`, plain assignment), or made in a closure that runs once because a module-scope binding holds the call that invokes it (an invoked factory, a `then` on a module-scope promise). A local that the returned closures capture is not a memo: each call of the factory builds another runtime.
|
|
75
|
+
- No `ManagedRuntime` where the wiring belongs to an object with its own lifetime (one per instance, as a Durable Object is): run `Layer.build` (an Effect that needs a `Scope`) once in a `Scope` the object owns, close that scope when the host tears the object down, and provide the built `Context` to each call with `Effect.provide` before running it. Each call still runs its Effect; what it skips is a per-instance `ManagedRuntime`. A scope the host never closes keeps the layer's resources for the object's whole life, which is that object's lifetime, not a leak per call.
|
|
76
|
+
- Layer composition at any depth: `Layer.provide`, `Layer.provideMerge` and `Layer.merge` build a graph, not a runtime. `Cell.provideContext(context)` is silent everywhere — binding a context built once constructs no runtime.
|
|
75
77
|
- `cell.run(input)` at any depth, in any file.
|
|
76
78
|
- `main.ts`, the interpretation edge: exempt from the module-scope verdict, because the process entry is where building the runtime is the point. Wiring built inside one of its functions still reports.
|
|
77
79
|
- A package-root hook, config, or setup file: outside the rule's subject by location, which is why a test runner's hook module may compose at module scope.
|
|
@@ -87,6 +89,15 @@ What the time-source rule leaves alone, each a shape the rule's own fixtures pin
|
|
|
87
89
|
- A file listed in the rule's `ports` option, matched by repo-relative path or path suffix: the recommended config registers `packages/atom/effect-atom/src/internal/HostTimer.ts` and `packages/schema/effect-schema-law/src/recursion-laws.ts`.
|
|
88
90
|
- Test and fixture files (`.test.ts`, `.spec.ts`, `__tests__/`, `__fixtures__/`, `tests/`, `testResources/`): the regime binds production code.
|
|
89
91
|
|
|
92
|
+
What the service-option rule leaves alone, and what it cannot see:
|
|
93
|
+
|
|
94
|
+
- A None branch that returns a fallback, skips the work, or fails with a typed error (`Effect.fail`, `Effect.fromOption(() => new E())` not wrapped in `Effect.orDie`).
|
|
95
|
+
- A defect reachable only when the read is Some, or elsewhere in the function and not on the read's None path.
|
|
96
|
+
- A fallback object whose methods die: the walk stops at a nested function, except a generator passed to `Effect.gen`, or an `Effect.fn` that is itself the handler.
|
|
97
|
+
- Not seen: a module-level stub that dies indirectly, returned from the None branch of a read in another function; an `Option` returned from a helper and crashed by its caller; absence mapped to `undefined` and then crashed; `Effect.orDie` wrapped around the read rather than after it. These need typed entry points and a test at the invocation boundary.
|
|
98
|
+
|
|
99
|
+
There is no option, allowlist or disable comment. A service that must be present goes back into the requirement type with `yield* Tag`; code implementing a framework interface that fixes its requirement type takes the value as a construction argument instead.
|
|
100
|
+
|
|
90
101
|
## FAQ
|
|
91
102
|
|
|
92
103
|
**Q: Installed, but nothing is reported.**
|
package/dist/index.d.ts
CHANGED
|
@@ -10,10 +10,12 @@ declare const _default: {
|
|
|
10
10
|
'entrypoint-not-imported': import("@oxlint/plugins").Rule;
|
|
11
11
|
'entrypoint-no-promise-wrapper': import("@oxlint/plugins").Rule;
|
|
12
12
|
'runtime-construction-placement': import("@oxlint/plugins").Rule;
|
|
13
|
+
'no-die-on-service-option': import("@oxlint/plugins").Rule;
|
|
13
14
|
'no-logging-in-catch': import("@oxlint/plugins").Rule;
|
|
14
15
|
'no-native-map-in-effect': import("@oxlint/plugins").Rule;
|
|
15
16
|
'no-native-set-in-effect': import("@oxlint/plugins").Rule;
|
|
16
17
|
'no-new-worker-with-wasm-import': import("@oxlint/plugins").Rule;
|
|
18
|
+
'node-runtime-needs-engines': import("@oxlint/plugins").Rule;
|
|
17
19
|
'no-unported-time-source': import("@oxlint/plugins").Rule;
|
|
18
20
|
};
|
|
19
21
|
configs: {
|