@systemfsoftware/oxlint-plugin-effect-platform 2.1.7 → 2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @systemfsoftware/oxlint-plugin-effect-platform
2
2
 
3
- # @systemfsoftware/oxlint-plugin-effect-platform@2.1.7
3
+ # @systemfsoftware/oxlint-plugin-effect-platform@2.2.0
4
4
 
5
- Requires Effect ^4.1.4.
5
+ `runtime-construction-placement` reports a factory that builds a fresh `ManagedRuntime` per call even when its returned closures capture it, and no longer reports `Layer.provide`, which composes a Layer graph and builds no runtime. Its fix message names `Layer.build` in the owner's scope for wiring that belongs to an object with its own lifetime.
package/README.md CHANGED
@@ -59,19 +59,20 @@ 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` or `Layer.provide` inside a function body — wiring rebuilt per call — 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 |
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
70
 
71
71
  What the placement rule leaves alone, each a shape the rule's own fixtures pin:
72
72
 
73
- - A module-scope closure that memoizes the construction — written into a cache binding (`??=`, `||=`, plain assignment) or into a declarator whose binding a nested closure captures.
74
- - Module-scope layer composition: `Layer.provide` at module scope builds a graph, not a runtime. `Cell.provideContext(context)` is silent everywhere — binding a context built once constructs no runtime.
73
+ - 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.
74
+ - 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.
75
+ - 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
76
  - `cell.run(input)` at any depth, in any file.
76
77
  - `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
78
  - 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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { OxlintOverride } from "oxlint";
2
- //#region src/index.d.ts
3
2
  export declare const noNodeBuiltinImports: NonNullable<OxlintOverride['rules']>['no-restricted-imports'];
4
3
  declare const _default: {
5
4
  meta: {
@@ -24,5 +23,4 @@ declare const _default: {
24
23
  };
25
24
  };
26
25
  };
27
- //#endregion
28
26
  export { _default as default };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineRule } from "@oxlint/plugins";
2
2
  import { Effect, Schema } from "effect";
3
- //#region src/rules/entrypoint-interprets-once.config.ts
3
+ // src/rules/entrypoint-interprets-once.config.ts
4
4
  const Options$7 = Schema.Struct({});
5
5
  const ENTRYPOINT_FILE$2 = /(?:^|[\\/])main\.ts$/u;
6
6
  const RUN_MAIN$1 = "runMain";
@@ -31,8 +31,7 @@ const meta$9 = {
31
31
  multipleEdges: INTERPRETS_ONCE_MESSAGE
32
32
  }
33
33
  };
34
- //#endregion
35
- //#region src/rules/entrypoint-interprets-once.ts
34
+ // src/rules/entrypoint-interprets-once.ts
36
35
  const isEntrypointFile$2 = (filename) => ENTRYPOINT_FILE$2.test(filename);
37
36
  const edgeName = (callee) => {
38
37
  if (callee.type === "Identifier") return callee.name === "runMain" ? RUN_MAIN$1 : null;
@@ -88,8 +87,7 @@ const entrypointInterpretsOnce = defineRule({
88
87
  };
89
88
  }
90
89
  });
91
- //#endregion
92
- //#region src/rules/entrypoint-no-exports.config.ts
90
+ // src/rules/entrypoint-no-exports.config.ts
93
91
  const Options$6 = Schema.Struct({});
94
92
  const ENTRYPOINT_FILE$1 = /(?:^|[\\/])main\.ts$/u;
95
93
  const NAMED_EXPORT = "a named export from main.ts";
@@ -104,8 +102,7 @@ const meta$8 = {
104
102
  schema: [Options$6],
105
103
  messages: { entrypointExport: "{{name}} is forbidden. Expected: {{expected}}. Actual: {{actual}}. Fix: {{fix}}." }
106
104
  };
107
- //#endregion
108
- //#region src/rules/entrypoint-no-exports.ts
105
+ // src/rules/entrypoint-no-exports.ts
109
106
  const isEntrypointFile$1 = (filename) => ENTRYPOINT_FILE$1.test(filename);
110
107
  const entrypointNoExports = defineRule({
111
108
  meta: meta$8,
@@ -136,8 +133,7 @@ const entrypointNoExports = defineRule({
136
133
  };
137
134
  }
138
135
  });
139
- //#endregion
140
- //#region src/rules/entrypoint-no-promise-wrapper.config.ts
136
+ // src/rules/entrypoint-no-promise-wrapper.config.ts
141
137
  const Options$5 = Schema.Struct({});
142
138
  const ENTRYPOINT_FILE = /(?:^|[\\/])main\.ts$/u;
143
139
  const RUN_MAIN = "runMain";
@@ -151,8 +147,7 @@ const meta$7 = {
151
147
  schema: [Options$5],
152
148
  messages: { promiseWrapper: "{{name}} is forbidden. Expected: {{expected}}. Actual: {{actual}}. Fix: {{fix}}." }
153
149
  };
154
- //#endregion
155
- //#region src/rules/entrypoint-no-promise-wrapper.ts
150
+ // src/rules/entrypoint-no-promise-wrapper.ts
156
151
  const isEntrypointFile = (filename) => ENTRYPOINT_FILE.test(filename);
157
152
  const isRunMainCallee = (callee) => {
158
153
  if (callee.type === "Identifier") return callee.name === RUN_MAIN;
@@ -196,15 +191,13 @@ const entrypointNoPromiseWrapper = defineRule({
196
191
  } };
197
192
  }
198
193
  });
199
- //#endregion
200
- //#region src/rules/entrypoint-not-imported.config.ts
194
+ // src/rules/entrypoint-not-imported.config.ts
201
195
  const Options$4 = Schema.Struct({});
202
196
  const MAIN_MODULE_SOURCE = /(?:^|\/)main(?:\.[cm]?[jt]sx?)?$/u;
203
197
  const ENTRYPOINT_IMPORT_EXPECTED = "the entrypoint imported by nothing - the process interprets it, no module consumes it";
204
198
  const ENTRYPOINT_IMPORT_ACTUAL = "an import of main.ts";
205
199
  const ENTRYPOINT_IMPORT_FIX = "import the cell that owns the binding instead; if main.ts is the only place it exists, it was never an entrypoint - move the behavior into an executor, adapter, or layer and leave main.ts holding only the interpretation edge";
206
- //#endregion
207
- //#region src/rules/entrypoint-not-imported.ts
200
+ // src/rules/entrypoint-not-imported.ts
208
201
  const entrypointNotImported = defineRule({
209
202
  meta: {
210
203
  type: "problem",
@@ -278,8 +271,7 @@ const CONSOLE_LOG_METHODS = /* @__PURE__ */ new Set([
278
271
  "info",
279
272
  "debug"
280
273
  ]);
281
- //#endregion
282
- //#region src/rules/no-logging-in-catch.ts
274
+ // src/rules/no-logging-in-catch.ts
283
275
  const noLoggingInCatch = defineRule({
284
276
  meta: {
285
277
  type: "suggestion",
@@ -377,8 +369,7 @@ const noLoggingInCatch = defineRule({
377
369
  };
378
370
  }
379
371
  });
380
- //#endregion
381
- //#region src/rules/no-native-map-in-effect.config.ts
372
+ // src/rules/no-native-map-in-effect.config.ts
382
373
  const Options$3 = Schema.Struct({
383
374
  allow: Schema.Array(Schema.String).pipe(Schema.withDecodingDefaultType(Effect.succeed([]))),
384
375
  expected: Schema.String.pipe(Schema.withDecodingDefaultType(Effect.succeed("HashMap from effect (HashMap.empty() or HashMap.fromIterable())"))),
@@ -390,8 +381,7 @@ const meta$4 = {
390
381
  schema: [Schema.toJsonSchemaDocument(Options$3).schema],
391
382
  messages: { forbiddenMap: "{{actual}} is forbidden when Effect is imported. Expected: {{expected}}. Actual: {{actual}}. Fix: {{fix}}." }
392
383
  };
393
- //#endregion
394
- //#region src/rules/no-native-map-in-effect.ts
384
+ // src/rules/no-native-map-in-effect.ts
395
385
  const isEffectImport$1 = (sourceValue) => sourceValue === "effect" || sourceValue.startsWith("effect/") || sourceValue.startsWith("@effect/");
396
386
  const isInsideEffectGen$1 = (node) => {
397
387
  if (node == null) return false;
@@ -433,8 +423,7 @@ const noNativeMapInEffect = defineRule({
433
423
  };
434
424
  }
435
425
  });
436
- //#endregion
437
- //#region src/rules/no-native-set-in-effect.config.ts
426
+ // src/rules/no-native-set-in-effect.config.ts
438
427
  const Options$2 = Schema.Struct({
439
428
  allow: Schema.Array(Schema.String).pipe(Schema.withDecodingDefaultType(Effect.succeed([]))),
440
429
  expected: Schema.String.pipe(Schema.withDecodingDefaultType(Effect.succeed("HashSet from effect (HashSet.empty() or HashSet.fromIterable())"))),
@@ -446,8 +435,7 @@ const meta$3 = {
446
435
  schema: [Schema.toJsonSchemaDocument(Options$2).schema],
447
436
  messages: { forbiddenSet: "{{actual}} is forbidden when Effect is imported. Expected: {{expected}}. Actual: {{actual}}. Fix: {{fix}}." }
448
437
  };
449
- //#endregion
450
- //#region src/rules/no-native-set-in-effect.ts
438
+ // src/rules/no-native-set-in-effect.ts
451
439
  const isSetCallee = (callee) => callee.type === "Identifier" && callee.name === "Set";
452
440
  const isEffectImport = (sourceValue) => sourceValue === "effect" || sourceValue.startsWith("effect/") || sourceValue.startsWith("@effect/");
453
441
  const isInsideEffectGen = (node) => {
@@ -485,8 +473,7 @@ const noNativeSetInEffect = defineRule({
485
473
  };
486
474
  }
487
475
  });
488
- //#endregion
489
- //#region src/rules/no-new-worker-with-wasm-import.config.ts
476
+ // src/rules/no-new-worker-with-wasm-import.config.ts
490
477
  const Options$1 = Schema.Struct({
491
478
  wasmImportPatterns: Schema.Array(Schema.String).pipe(Schema.withDecodingDefaultType(Effect.succeed([/^(@[^/]+\/)?[^/]+-wasm(\/.*)?$/].map((re) => re.source)))),
492
479
  expected: Schema.String.pipe(Schema.withDecodingDefaultType(Effect.succeed("Bun.spawn subprocess pool"))),
@@ -498,8 +485,7 @@ const meta$2 = {
498
485
  schema: [Schema.toJsonSchemaDocument(Options$1).schema],
499
486
  messages: { forbiddenNewWorkerWithWasm: "{{actual}} is forbidden when a WASM module is imported. Expected: {{expected}}. Actual: {{actual}}. Fix: {{fix}}." }
500
487
  };
501
- //#endregion
502
- //#region src/rules/no-new-worker-with-wasm-import.ts
488
+ // src/rules/no-new-worker-with-wasm-import.ts
503
489
  const isWasmImport = (sourceValue, patterns) => patterns.some((re) => re.test(sourceValue));
504
490
  const isNewWorkerCall = (node) => {
505
491
  if (node.callee.type !== "Identifier" || node.callee.name !== "Worker") return false;
@@ -532,8 +518,7 @@ const noNewWorkerWithWasmImport = defineRule({
532
518
  };
533
519
  }
534
520
  });
535
- //#endregion
536
- //#region src/rules/no-unported-time-source.config.ts
521
+ // src/rules/no-unported-time-source.config.ts
537
522
  const Options = Schema.Struct({ ports: Schema.Array(Schema.String).pipe(Schema.withDecodingDefaultType(Effect.succeed([]))) });
538
523
  const TIME_SOURCE_MESSAGE = "{{name}} is forbidden. Expected: {{expected}}. Actual: {{actual}}. Fix: {{fix}}.";
539
524
  const TIME_SOURCE_EXPECTED = "time, scheduling, and randomness reached through a named, replaceable port — a file listed in this rule's `ports` option, or a source injected as a parameter";
@@ -580,8 +565,7 @@ const meta$1 = {
580
565
  schema: [Schema.toJsonSchemaDocument(Options).schema],
581
566
  messages: { unportedTimeSource: TIME_SOURCE_MESSAGE }
582
567
  };
583
- //#endregion
584
- //#region src/rules/no-unported-time-source.ts
568
+ // src/rules/no-unported-time-source.ts
585
569
  const isScopeLike$1 = (value) => typeof value === "object" && value !== null && "references" in value && "upper" in value;
586
570
  const isIdentifierNode = (node) => node.type === "Identifier";
587
571
  const decodeOptions = (input) => Effect.runSync(Effect.orDie(Schema.decodeUnknownEffect(Options)(input)));
@@ -681,8 +665,7 @@ const noUnportedTimeSource = defineRule({
681
665
  };
682
666
  }
683
667
  });
684
- //#endregion
685
- //#region ../import-origin/dist/index.mjs
668
+ // ../import-origin/dist/index.mjs
686
669
  const isScopeLike = (value) => typeof value === "object" && value !== null && "references" in value && "upper" in value;
687
670
  const isIdentifier = (node) => node.type === "Identifier";
688
671
  const isMemberExpression = (node) => node.type === "MemberExpression";
@@ -876,19 +859,13 @@ const resolveIdentifierOrigin = (identifier, getScope, depth) => {
876
859
  }
877
860
  return base;
878
861
  };
879
- //#endregion
880
- //#region src/rules/runtime-construction-placement.config.ts
862
+ // src/rules/runtime-construction-placement.config.ts
881
863
  const isRuntimeCodeFile = (filename) => /(?:^|[\\/])src[\\/]/u.test(filename) || filename.endsWith(".test.ts");
882
864
  const isInterpretationEdge = (filename) => /(?:^|[\\/])main\.ts$/u.test(filename);
883
- const EFFECT_MODULE = "effect";
884
865
  const TRACKED_WIRING_CALLS = [{
885
- source: EFFECT_MODULE,
866
+ source: "effect",
886
867
  namespace: "ManagedRuntime",
887
868
  member: "make"
888
- }, {
889
- source: EFFECT_MODULE,
890
- namespace: "Layer",
891
- member: "provide"
892
869
  }];
893
870
  const MEMOIZING_ASSIGNMENT_OPERATORS = [
894
871
  "=",
@@ -897,22 +874,21 @@ const MEMOIZING_ASSIGNMENT_OPERATORS = [
897
874
  ];
898
875
  const WIRING_PER_CALL_EXPECTED = "wiring built once per process and deferred to first use in a module-scope lazy memoized closure";
899
876
  const WIRING_PER_CALL_ACTUAL = "the wiring is constructed inside a function body, so every call builds its own runtime";
900
- const WIRING_PER_CALL_FIX = "build the wiring in one module-scope lazy memoized closure and read that runtime where it is needed; a runtime constructed per call is never finalized and the fibers it starts outlive the caller - delete the construction if this module already reads a process-scope runtime";
877
+ const WIRING_PER_CALL_FIX = "build the wiring in one module-scope lazy memoized closure and read that runtime where it is needed, or, when the wiring belongs to an object with its own lifetime, run `Layer.build` once in a `Scope` that object owns and provide the built `Context` to each call with `Effect.provide` before running it, so no `ManagedRuntime` is constructed; a runtime constructed per call is never finalized and the fibers it starts outlive the caller - delete the construction if this module already reads a process-scope runtime";
901
878
  const EAGER_CONSTRUCTION_EXPECTED = "runtime construction deferred to first use, inside a module-scope memoizing closure";
902
879
  const EAGER_CONSTRUCTION_ACTUAL = "the runtime is constructed while the module is imported";
903
880
  const EAGER_CONSTRUCTION_FIX = "wrap the construction in a module-scope memoizing closure and call it where the runtime is needed, so importing the module starts nothing; delete the runtime if this module already reads a process-scope one";
904
881
  const PLACEMENT_MESSAGE = "{{name}} is forbidden. Expected: {{expected}}. Actual: {{actual}}. Fix: {{fix}}.";
905
882
  const meta = {
906
883
  type: "problem",
907
- docs: { description: "`ManagedRuntime.make` or `Layer.provide` inside a function body rebuilds wiring per call; `ManagedRuntime.make` evaluated at module scope constructs the runtime at import time. The rule judges runtime code: files under a `src/` directory segment and `*.test.ts` files; a package-root hook, config, or setup file is outside its subject, `.tst.ts` type-test files run nowhere, and `main.ts` is exempt from the module-scope verdict as the interpretation edge. Lawful and silent in scope: a memoized module-scope closure, module-scope graph composition, `cell.run(input)` at any depth. Shapes, bounds, and examples: the README." },
884
+ docs: { description: "`ManagedRuntime.make` inside a function body builds a runtime per call that nothing finalizes; `ManagedRuntime.make` evaluated at module scope constructs the runtime at import time. The rule judges runtime code: files under a `src/` directory segment and `*.test.ts` files; a package-root hook, config, or setup file is outside its subject, `.tst.ts` type-test files run nowhere, and `main.ts` is exempt from the module-scope verdict as the interpretation edge. Lawful and silent in scope: a memoized module-scope closure, Layer composition (`Layer.provide`, `Layer.provideMerge`, `Layer.merge`) at any depth, `cell.run(input)` at any depth. Shapes, bounds, and examples: the README." },
908
885
  schema: [],
909
886
  messages: {
910
887
  wiringPerCall: PLACEMENT_MESSAGE,
911
888
  eagerConstruction: PLACEMENT_MESSAGE
912
889
  }
913
890
  };
914
- //#endregion
915
- //#region src/rules/runtime-construction-placement.ts
891
+ // src/rules/runtime-construction-placement.ts
916
892
  const isFunctionNode = (node) => node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
917
893
  const staticMemberNameOf = (member) => {
918
894
  if (member.computed === true) {
@@ -1035,44 +1011,22 @@ const isBoundByAModuleScopeBinding = (node) => {
1035
1011
  }
1036
1012
  return false;
1037
1013
  };
1038
- const MAX_WALK_DEPTH = 32;
1039
- const isNode = (value) => value !== null && typeof value === "object" && "type" in value;
1040
- const mentionsName = (value, name, depth) => {
1041
- if (depth > MAX_WALK_DEPTH) return false;
1042
- if (Array.isArray(value)) return value.some((item) => mentionsName(item, name, depth + 1));
1043
- if (!isNode(value)) return false;
1044
- if (value.type === "Identifier") return value.name === name;
1045
- for (const [key, child] of Object.entries(value)) {
1046
- if (key === "parent") continue;
1047
- if (mentionsName(child, name, depth + 1)) return true;
1048
- }
1049
- return false;
1050
- };
1051
- const isReadInsideANestedFunction = (value, enclosing, name, depth) => {
1052
- if (depth > MAX_WALK_DEPTH) return false;
1053
- if (Array.isArray(value)) return value.some((item) => isReadInsideANestedFunction(item, enclosing, name, depth + 1));
1054
- if (!isNode(value)) return false;
1055
- if (value !== enclosing && isFunctionNode(value)) return mentionsName(value, name, depth + 1);
1056
- for (const [key, child] of Object.entries(value)) {
1057
- if (key === "parent") continue;
1058
- if (isReadInsideANestedFunction(child, enclosing, name, depth + 1)) return true;
1059
- }
1060
- return false;
1061
- };
1062
- const isCapturedDeclaratorBinding = (declarator, enclosing) => {
1063
- if (declarator.id.type !== "Identifier") return false;
1064
- return isReadInsideANestedFunction(enclosing, enclosing, declarator.id.name, 0);
1014
+ /**
1015
+ * A closure that runs once: invoked by a call whose result a module-scope binding holds
1016
+ * (an invoked factory, a `then` on a module-scope promise). A cache write inside any
1017
+ * other closure is the only memo; a local the closure captures is rebuilt per call.
1018
+ */
1019
+ const runsOnceAtModuleScope = (enclosing) => {
1020
+ const consumer = enclosing.parent;
1021
+ return consumer !== null && consumer.type === "CallExpression" && isBoundByAModuleScopeBinding(consumer);
1065
1022
  };
1066
1023
  const isMemoizedConstruction = (call, enclosing) => {
1067
1024
  let current = call.parent;
1068
1025
  while (current !== null && current !== enclosing) {
1069
1026
  if (isCacheWrite(current)) return true;
1070
- if (current.type === "VariableDeclarator" && isCapturedDeclaratorBinding(current, enclosing)) return true;
1071
1027
  current = current.parent;
1072
1028
  }
1073
- const consumer = enclosing.parent;
1074
- if (consumer === null || consumer.type !== "CallExpression") return false;
1075
- return isBoundByAModuleScopeBinding(consumer);
1029
+ return runsOnceAtModuleScope(enclosing);
1076
1030
  };
1077
1031
  const runtimeConstructionPlacement = defineRule({
1078
1032
  meta,
@@ -1119,7 +1073,6 @@ const runtimeConstructionPlacement = defineRule({
1119
1073
  });
1120
1074
  return;
1121
1075
  }
1122
- if (tracked.namespace !== "ManagedRuntime") return;
1123
1076
  if (isInterpretationEdge(context.filename)) return;
1124
1077
  context.report({
1125
1078
  node: callee,
@@ -1135,8 +1088,7 @@ const runtimeConstructionPlacement = defineRule({
1135
1088
  };
1136
1089
  }
1137
1090
  });
1138
- //#endregion
1139
- //#region src/index.ts
1091
+ // src/index.ts
1140
1092
  const PLUGIN_NAME = "@systemfsoftware/oxlint-plugin-effect-platform";
1141
1093
  const rule = (name) => `${PLUGIN_NAME}/${name}`;
1142
1094
  /** The files that own the process timers, clocks, and randomness the rest of production source must reach through them. */
@@ -1201,5 +1153,4 @@ var src_default = {
1201
1153
  }]
1202
1154
  } }
1203
1155
  };
1204
- //#endregion
1205
1156
  export { src_default as default, noNodeBuiltinImports };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@systemfsoftware/oxlint-plugin-effect-platform",
3
3
  "license": "Apache-2.0",
4
- "version": "2.1.7",
4
+ "version": "2.2.0",
5
5
  "author": "Ryan Lee <drdgvhbh@gmail.com>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -37,25 +37,25 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "dependencies": {
40
- "@oxc-project/types": "^0.155.0",
40
+ "@oxc-project/types": "^0.159.0",
41
41
  "@oxlint/plugins": "~1.93.0",
42
42
  "oxlint": "~1.93.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@microsoft/api-extractor": "^7.59.4",
45
+ "@microsoft/api-extractor": "^7.60.1",
46
46
  "@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
47
- "@systemfsoftware/oxlint-config-rule-authoring": "^3.0.2",
47
+ "@systemfsoftware/oxlint-config-rule-authoring": "^3.0.3",
48
48
  "@systemfsoftware/oxlint-import-origin": "^0.1.0",
49
49
  "@systemfsoftware/tsconfig": "^2.1.0",
50
- "@systemfsoftware/tsdown-config": "^0.1.2",
51
- "@systemfsoftware/vitest-config": "^0.1.3",
52
- "@types/node": "^26.6.5",
50
+ "@systemfsoftware/tsdown-config": "^0.1.3",
51
+ "@systemfsoftware/vitest-config": "^0.1.4",
52
+ "@types/node": "^26.6.6",
53
53
  "@vitest/coverage-v8": "^5.1.0",
54
54
  "effect": "^4.1.4",
55
55
  "fast-check": "^4.10.2",
56
56
  "oxlint": "~1.93.0",
57
- "rimraf": "^6.1.3",
58
- "tsdown": "^0.23.0",
57
+ "rimraf": "^6.1.4",
58
+ "tsdown": "^0.23.7",
59
59
  "typescript": "^7.0.2",
60
60
  "vitest": "^5.1.0"
61
61
  },
@@ -72,7 +72,7 @@
72
72
  "clean": "rimraf dist",
73
73
  "typecheck": "tsc -b",
74
74
  "test": "vitest run",
75
- "lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint . --format=${f:-default}",
75
+ "lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; effect-tsgo oxlint . --format=${f:-default}",
76
76
  "attw": "attw --pack .",
77
77
  "api:check": "api-extractor-quiet run",
78
78
  "api:update": "api-extractor run --local"