@opsydyn/oxlint-effect 0.2.0 → 0.4.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/dist/index.mjs CHANGED
@@ -280,6 +280,111 @@ function findPromiseApiInEffectLogic(node) {
280
280
  if (match) return match;
281
281
  }
282
282
  }
283
+ const promiseConcurrencyMethods = /* @__PURE__ */ new Set([
284
+ "all",
285
+ "allSettled",
286
+ "any",
287
+ "race"
288
+ ]);
289
+ function isPromiseConcurrencyCall(node) {
290
+ if (typeof node !== "object" || node === null || node.type !== "CallExpression") return false;
291
+ const callee = node.callee;
292
+ return typeof callee === "object" && callee !== null && callee.type === "MemberExpression" && callee.computed !== true && isIdentifier(callee.object, "Promise") && isIdentifier(callee.property) && promiseConcurrencyMethods.has(callee.property.name);
293
+ }
294
+ function findPromiseConcurrencyCall(node, seen = /* @__PURE__ */ new WeakSet()) {
295
+ if (Array.isArray(node)) {
296
+ for (const child of node) {
297
+ const match = findPromiseConcurrencyCall(child, seen);
298
+ if (match) return match;
299
+ }
300
+ return;
301
+ }
302
+ if (typeof node !== "object" || node === null) return;
303
+ if (seen.has(node)) return;
304
+ seen.add(node);
305
+ if (isPromiseConcurrencyCall(node)) return node;
306
+ for (const [key, child] of Object.entries(node)) {
307
+ if (key === "parent") continue;
308
+ const match = findPromiseConcurrencyCall(child, seen);
309
+ if (match) return match;
310
+ }
311
+ }
312
+ function findPromiseConcurrencyInEffectLogic(node) {
313
+ const generator = getEffectGeneratorArgument(node, "gen");
314
+ if (generator) return findPromiseConcurrencyCall(generator.body);
315
+ if (isEffectMemberCallNamed(node, "sync")) {
316
+ const body = callbackBody(firstArgument(node));
317
+ return body ? findPromiseConcurrencyCall(body) : void 0;
318
+ }
319
+ if (!isEffectMemberCall(node)) return;
320
+ const property = node.callee.property;
321
+ if (!isIdentifier(property) || !effectAsyncCallbackCombinators.has(property.name)) return;
322
+ for (const argument of node.arguments) {
323
+ const body = callbackBody(argument);
324
+ const match = body ? findPromiseConcurrencyCall(body) : void 0;
325
+ if (match) return match;
326
+ }
327
+ }
328
+ function callbackHasParameter(node) {
329
+ if (typeof node !== "object" || node === null) return false;
330
+ const callback = node;
331
+ return (callback.type === "ArrowFunctionExpression" || callback.type === "FunctionExpression") && Array.isArray(callback.params) && callback.params.length > 0;
332
+ }
333
+ function isCancellationAwareTryPromise(node) {
334
+ if (!isEffectMemberCallNamed(node, "tryPromise")) return false;
335
+ const argument = firstArgument(node);
336
+ if (callbackHasParameter(argument)) return true;
337
+ return callbackHasParameter(objectPropertyValue(argument, "try"));
338
+ }
339
+ function isNoninterruptiblePromiseEffect(node) {
340
+ if (isEffectMemberCallNamed(node, "promise")) return true;
341
+ return isEffectMemberCallNamed(node, "tryPromise") && !isCancellationAwareTryPromise(node);
342
+ }
343
+ function noninterruptiblePromiseTimeoutNode(node) {
344
+ if (!isEffectMemberCallNamed(node, "timeout")) return;
345
+ const effect = firstArgument(node);
346
+ return isNoninterruptiblePromiseEffect(effect) ? effect : void 0;
347
+ }
348
+ const blockingSyncObjectNames = /* @__PURE__ */ new Set([
349
+ "crypto",
350
+ "fs",
351
+ "zlib"
352
+ ]);
353
+ function isBlockingSyncCall(node) {
354
+ if (typeof node !== "object" || node === null || node.type !== "CallExpression") return false;
355
+ const callee = node.callee;
356
+ if (isIdentifier(callee)) return callee.name.endsWith("Sync");
357
+ if (typeof callee !== "object" || callee === null || callee.type !== "MemberExpression" || callee.computed === true || !isIdentifier(callee.object) || !isIdentifier(callee.property)) return false;
358
+ const objectName = callee.object.name;
359
+ const propertyName = callee.property.name;
360
+ return blockingSyncObjectNames.has(objectName) && propertyName.endsWith("Sync");
361
+ }
362
+ function findBlockingSyncCall(node, seen = /* @__PURE__ */ new WeakSet()) {
363
+ if (Array.isArray(node)) {
364
+ for (const child of node) {
365
+ const match = findBlockingSyncCall(child, seen);
366
+ if (match) return match;
367
+ }
368
+ return;
369
+ }
370
+ if (typeof node !== "object" || node === null) return;
371
+ if (seen.has(node)) return;
372
+ seen.add(node);
373
+ if (isBlockingSyncCall(node)) return node;
374
+ for (const [key, child] of Object.entries(node)) {
375
+ if (key === "parent") continue;
376
+ const match = findBlockingSyncCall(child, seen);
377
+ if (match) return match;
378
+ }
379
+ }
380
+ function findBlockingSyncCallInEffectLogic(node) {
381
+ const generator = getEffectGeneratorArgument(node, "gen");
382
+ if (generator) return findBlockingSyncCall(generator.body);
383
+ if (isEffectMemberCallNamed(node, "sync")) {
384
+ const body = callbackBody(firstArgument(node));
385
+ return body ? findBlockingSyncCall(body) : void 0;
386
+ }
387
+ }
283
388
  const effectRunMethods = /* @__PURE__ */ new Set([
284
389
  "runCallback",
285
390
  "runFork",
@@ -372,6 +477,154 @@ function hasConcurrencyOne(node) {
372
477
  return (isIdentifier(key, "concurrency") || typeof key === "object" && key !== null && key.value === "concurrency") && typeof value === "object" && value !== null && (value.type === "Literal" || value.type === "NumericLiteral") && value.value === 1;
373
478
  });
374
479
  }
480
+ function hasConcurrencyOption(node) {
481
+ if (typeof node !== "object" || node === null) return false;
482
+ const object = node;
483
+ if (object.type !== "ObjectExpression" || !Array.isArray(object.properties)) return false;
484
+ return object.properties.some((entry) => {
485
+ if (typeof entry !== "object" || entry === null) return false;
486
+ const key = entry.key;
487
+ return isIdentifier(key, "concurrency") || typeof key === "object" && key !== null && key.value === "concurrency";
488
+ });
489
+ }
490
+ function isCollectionMapCall(node) {
491
+ if (typeof node !== "object" || node === null) return false;
492
+ const call = node;
493
+ return call.type === "CallExpression" && typeof call.callee === "object" && call.callee !== null && call.callee.type === "MemberExpression" && call.callee.computed !== true && isIdentifier(call.callee.property, "map");
494
+ }
495
+ function isUnboundedMappedEffectAll(node) {
496
+ return isEffectMemberCallNamed(node, "all") && isCollectionMapCall(firstArgument(node)) && !hasConcurrencyOption(node.arguments[1]);
497
+ }
498
+ function containsEffectForkCall(node, seen = /* @__PURE__ */ new WeakSet()) {
499
+ if (isEffectMemberCallNamed(node, "fork")) return node;
500
+ if (Array.isArray(node)) {
501
+ for (const child of node) {
502
+ const match = containsEffectForkCall(child, seen);
503
+ if (match) return match;
504
+ }
505
+ return;
506
+ }
507
+ if (typeof node !== "object" || node === null) return;
508
+ if (seen.has(node)) return;
509
+ seen.add(node);
510
+ for (const [key, child] of Object.entries(node)) {
511
+ if (key === "parent") continue;
512
+ const match = containsEffectForkCall(child, seen);
513
+ if (match) return match;
514
+ }
515
+ }
516
+ function containsEffectMemberCallInSet(node, propertyNames, seen = /* @__PURE__ */ new WeakSet()) {
517
+ if (isEffectMemberCall(node)) {
518
+ const property = node.callee.property;
519
+ if (isIdentifier(property) && propertyNames.has(property.name)) return true;
520
+ }
521
+ if (Array.isArray(node)) return node.some((child) => containsEffectMemberCallInSet(child, propertyNames, seen));
522
+ if (typeof node !== "object" || node === null) return false;
523
+ if (seen.has(node)) return false;
524
+ seen.add(node);
525
+ return Object.entries(node).some(([key, child]) => key !== "parent" && containsEffectMemberCallInSet(child, propertyNames, seen));
526
+ }
527
+ const raceCleanupCalls = /* @__PURE__ */ new Set([
528
+ "acquireRelease",
529
+ "acquireUseRelease",
530
+ "ensuring",
531
+ "forkIn",
532
+ "forkScoped",
533
+ "scoped"
534
+ ]);
535
+ function isEffectRaceWithoutCleanup(node) {
536
+ if (!isEffectMemberCallNamed(node, "race") && !isEffectMemberCallNamed(node, "raceAll")) return false;
537
+ return !containsEffectMemberCallInSet(node.arguments, raceCleanupCalls);
538
+ }
539
+ function isUnboundedEffectForEach(node) {
540
+ return isEffectMemberCallNamed(node, "forEach") && !hasConcurrencyOption(node.arguments[2]);
541
+ }
542
+ const retryCalls = /* @__PURE__ */ new Set(["retry"]);
543
+ function isUnboundedConcurrentRetry(node) {
544
+ return (isUnboundedMappedEffectAll(node) || isUnboundedEffectForEach(node)) && containsEffectMemberCallInSet(node.arguments, retryCalls);
545
+ }
546
+ function variableDeclarationIdentifierNames(node) {
547
+ if (typeof node !== "object" || node === null || node.type !== "VariableDeclaration") return [];
548
+ const declarations = node.declarations;
549
+ if (!Array.isArray(declarations)) return [];
550
+ return declarations.flatMap((declaration) => {
551
+ if (typeof declaration !== "object" || declaration === null) return [];
552
+ const id = declaration.id;
553
+ return isIdentifier(id) ? [id.name] : [];
554
+ });
555
+ }
556
+ function collectDeclaredIdentifierNames(node, names = /* @__PURE__ */ new Set(), seen = /* @__PURE__ */ new WeakSet()) {
557
+ if (Array.isArray(node)) {
558
+ for (const child of node) collectDeclaredIdentifierNames(child, names, seen);
559
+ return names;
560
+ }
561
+ if (typeof node !== "object" || node === null) return names;
562
+ if (seen.has(node)) return names;
563
+ seen.add(node);
564
+ if (node.type === "VariableDeclaration") for (const name of variableDeclarationIdentifierNames(node)) names.add(name);
565
+ for (const [key, child] of Object.entries(node)) if (key !== "parent") collectDeclaredIdentifierNames(child, names, seen);
566
+ return names;
567
+ }
568
+ const mutatingCollectionMethods = /* @__PURE__ */ new Set([
569
+ "add",
570
+ "clear",
571
+ "delete",
572
+ "pop",
573
+ "push",
574
+ "reverse",
575
+ "set",
576
+ "shift",
577
+ "sort",
578
+ "splice",
579
+ "unshift"
580
+ ]);
581
+ function mutatedIdentifierName(node) {
582
+ if (typeof node !== "object" || node === null) return;
583
+ const candidate = node;
584
+ if (candidate.type === "AssignmentExpression" && isIdentifier(candidate.left)) return candidate.left.name;
585
+ if (candidate.type === "UpdateExpression" && isIdentifier(candidate.argument)) return candidate.argument.name;
586
+ if (candidate.type === "CallExpression" && typeof candidate.callee === "object" && candidate.callee !== null && candidate.callee.type === "MemberExpression" && candidate.callee.computed !== true && isIdentifier(candidate.callee.object) && isIdentifier(candidate.callee.property) && mutatingCollectionMethods.has(candidate.callee.property.name)) return candidate.callee.object.name;
587
+ }
588
+ function findSharedMutableStateMutation(node, mutableNames, localNames = collectDeclaredIdentifierNames(node), seen = /* @__PURE__ */ new WeakSet()) {
589
+ if (Array.isArray(node)) {
590
+ for (const child of node) {
591
+ const match = findSharedMutableStateMutation(child, mutableNames, localNames, seen);
592
+ if (match) return match;
593
+ }
594
+ return;
595
+ }
596
+ if (typeof node !== "object" || node === null) return;
597
+ if (seen.has(node)) return;
598
+ seen.add(node);
599
+ const mutatedName = mutatedIdentifierName(node);
600
+ if (mutatedName && mutableNames.has(mutatedName) && !localNames.has(mutatedName)) return node;
601
+ for (const [key, child] of Object.entries(node)) {
602
+ if (key === "parent") continue;
603
+ const match = findSharedMutableStateMutation(child, mutableNames, localNames, seen);
604
+ if (match) return match;
605
+ }
606
+ }
607
+ function concurrentEffectWorkNode(node) {
608
+ if (isEffectMemberCallNamed(node, "fork") || isEffectMemberCallNamed(node, "all") || isEffectMemberCallNamed(node, "forEach")) return node.arguments;
609
+ }
610
+ function forkedFiberVariableName(node) {
611
+ if (typeof node !== "object" || node === null || node.type !== "VariableDeclarator") return;
612
+ const declarator = node;
613
+ return isIdentifier(declarator.id) && isEffectMemberCallNamed(declarator.init, "fork") ? declarator.id.name : void 0;
614
+ }
615
+ const fiberObservationCalls = /* @__PURE__ */ new Set([
616
+ "await",
617
+ "interrupt",
618
+ "join"
619
+ ]);
620
+ function observedFiberVariableName(node) {
621
+ if (typeof node !== "object" || node === null || node.type !== "CallExpression") return;
622
+ const call = node;
623
+ const callee = call.callee;
624
+ if (typeof callee !== "object" || callee === null || callee.type !== "MemberExpression" || callee.computed === true || !isIdentifier(callee.object, "Fiber") || !isIdentifier(callee.property) || !fiberObservationCalls.has(callee.property.name) || !Array.isArray(call.arguments)) return;
625
+ const [fiber] = call.arguments;
626
+ return isIdentifier(fiber) ? fiber.name : void 0;
627
+ }
375
628
  function isEffectAsVoidPipeArgument(node) {
376
629
  return isMemberExpression(node, "Effect", "asVoid") || isMemberCall(node, "Effect", "asVoid");
377
630
  }
@@ -1692,6 +1945,159 @@ const noEffectOrElseLadder = defineRule({ create(context) {
1692
1945
  if (hasOrElseSequencingFirstArgument(node)) report(context, node, "Rule: avoid Effect.orElse around sequencing chains. Why: it hides error handling and splits the flow. Fix: move error handling to a single terminal decision after the pipeline.");
1693
1946
  } };
1694
1947
  } });
1948
+ const noUnboundedEffectAll = defineRule({ create(context) {
1949
+ let hasEffectEcosystemImport = false;
1950
+ return {
1951
+ ImportDeclaration(node) {
1952
+ const source = getImportSource(node);
1953
+ if (source && isEffectEcosystemImport(source)) hasEffectEcosystemImport = true;
1954
+ },
1955
+ CallExpression(node) {
1956
+ if (hasEffectEcosystemImport && isUnboundedMappedEffectAll(node)) report(context, node, "Rule: avoid unbounded Effect.all over mapped collections. Why: it can launch work for every item at once and fail under load. Fix: pass an explicit `{ concurrency: n }` option or use a bounded batching strategy.");
1957
+ }
1958
+ };
1959
+ } });
1960
+ const noFireAndForgetFork = defineRule({ create(context) {
1961
+ let hasEffectEcosystemImport = false;
1962
+ return {
1963
+ ImportDeclaration(node) {
1964
+ const source = getImportSource(node);
1965
+ if (source && isEffectEcosystemImport(source)) hasEffectEcosystemImport = true;
1966
+ },
1967
+ ExpressionStatement(node) {
1968
+ if (hasEffectEcosystemImport && isEffectMemberCallNamed(node.expression, "fork")) report(context, node.expression, "Rule: avoid fire-and-forget Effect.fork. Why: detached fibers hide failure, interruption, and ownership. Fix: bind the fiber and join/await/interrupt it, or use Effect.forkScoped / Effect.forkIn with an explicit scope.");
1969
+ }
1970
+ };
1971
+ } });
1972
+ const noForkInLoop = defineRule({ create(context) {
1973
+ let hasEffectEcosystemImport = false;
1974
+ const checkLoop = (node) => {
1975
+ if (!hasEffectEcosystemImport) return;
1976
+ const fork = containsEffectForkCall(node.body);
1977
+ if (fork) report(context, fork, "Rule: avoid Effect.fork inside loops. Why: loop-spawned fibers create unbounded concurrency and unclear ownership. Fix: use Effect.forEach / Effect.all with an explicit concurrency limit or a scoped supervisor.");
1978
+ };
1979
+ return {
1980
+ ImportDeclaration(node) {
1981
+ const source = getImportSource(node);
1982
+ if (source && isEffectEcosystemImport(source)) hasEffectEcosystemImport = true;
1983
+ },
1984
+ ForStatement: checkLoop,
1985
+ ForInStatement: checkLoop,
1986
+ ForOfStatement: checkLoop,
1987
+ WhileStatement: checkLoop,
1988
+ DoWhileStatement: checkLoop
1989
+ };
1990
+ } });
1991
+ const noRaceWithoutCleanup = defineRule({ create(context) {
1992
+ let hasEffectEcosystemImport = false;
1993
+ return {
1994
+ ImportDeclaration(node) {
1995
+ const source = getImportSource(node);
1996
+ if (source && isEffectEcosystemImport(source)) hasEffectEcosystemImport = true;
1997
+ },
1998
+ CallExpression(node) {
1999
+ if (hasEffectEcosystemImport && isEffectRaceWithoutCleanup(node)) report(context, node, "Rule: avoid Effect.race without loser cleanup. Why: racing effects without ensuring/scoped cleanup can leak losing work or resources. Fix: wrap raced effects with Effect.ensuring/acquireRelease or use a scoped race boundary.");
2000
+ }
2001
+ };
2002
+ } });
2003
+ const noUnobservedFiber = defineRule({ create(context) {
2004
+ let hasEffectEcosystemImport = false;
2005
+ const forkedFibers = /* @__PURE__ */ new Map();
2006
+ const observedFibers = /* @__PURE__ */ new Set();
2007
+ return {
2008
+ ImportDeclaration(node) {
2009
+ const source = getImportSource(node);
2010
+ if (source && isEffectEcosystemImport(source)) hasEffectEcosystemImport = true;
2011
+ },
2012
+ VariableDeclarator(node) {
2013
+ const name = forkedFiberVariableName(node);
2014
+ if (name) forkedFibers.set(name, node);
2015
+ },
2016
+ CallExpression(node) {
2017
+ const name = observedFiberVariableName(node);
2018
+ if (name) observedFibers.add(name);
2019
+ },
2020
+ "Program:exit"() {
2021
+ if (!hasEffectEcosystemImport) return;
2022
+ for (const [name, node] of forkedFibers) if (!observedFibers.has(name)) report(context, node, "Rule: avoid unobserved forked fibers. Why: forked fiber failures and interruption should be observed. Fix: pass the fiber to Fiber.join, Fiber.await, Fiber.interrupt, or use scoped fork APIs.");
2023
+ }
2024
+ };
2025
+ } });
2026
+ const noUnboundedConcurrentRetry = defineRule({ create(context) {
2027
+ let hasEffectEcosystemImport = false;
2028
+ return {
2029
+ ImportDeclaration(node) {
2030
+ const source = getImportSource(node);
2031
+ if (source && isEffectEcosystemImport(source)) hasEffectEcosystemImport = true;
2032
+ },
2033
+ CallExpression(node) {
2034
+ if (hasEffectEcosystemImport && isUnboundedConcurrentRetry(node)) report(context, node, "Rule: avoid unbounded concurrent retry. Why: retry inside unbounded parallel collection effects can amplify load and create retry storms. Fix: add an explicit concurrency limit or move retry behind a bounded queue/backoff policy.");
2035
+ }
2036
+ };
2037
+ } });
2038
+ const noBlockingCallInEffect = defineRule({ create(context) {
2039
+ let hasEffectEcosystemImport = false;
2040
+ return {
2041
+ ImportDeclaration(node) {
2042
+ const source = getImportSource(node);
2043
+ if (source && isEffectEcosystemImport(source)) hasEffectEcosystemImport = true;
2044
+ },
2045
+ CallExpression(node) {
2046
+ if (!hasEffectEcosystemImport) return;
2047
+ const blockingNode = findBlockingSyncCallInEffectLogic(node);
2048
+ if (blockingNode) report(context, blockingNode, "Rule: avoid blocking sync calls inside Effect logic. Why: sync fs/crypto/zlib calls block the runtime worker and hide throughput costs. Fix: use Effect.async/tryPromise at a platform boundary, stream APIs, or a dedicated blocking executor.");
2049
+ }
2050
+ };
2051
+ } });
2052
+ const noPromiseConcurrencyInEffect = defineRule({ create(context) {
2053
+ let hasEffectEcosystemImport = false;
2054
+ return {
2055
+ ImportDeclaration(node) {
2056
+ const source = getImportSource(node);
2057
+ if (source && isEffectEcosystemImport(source)) hasEffectEcosystemImport = true;
2058
+ },
2059
+ CallExpression(node) {
2060
+ if (!hasEffectEcosystemImport) return;
2061
+ const promiseNode = findPromiseConcurrencyInEffectLogic(node);
2062
+ if (promiseNode) report(context, promiseNode, "Rule: avoid Promise concurrency APIs inside Effect logic. Why: Promise.all/allSettled/race/any bypass Effect concurrency, interruption, tracing, and error channels. Fix: use Effect.all, Effect.forEach, Effect.race, or a boundary adapter with explicit cancellation ownership.");
2063
+ }
2064
+ };
2065
+ } });
2066
+ const noSharedMutableStateAcrossFibers = defineRule({ create(context) {
2067
+ let hasEffectEcosystemImport = false;
2068
+ const mutableNames = /* @__PURE__ */ new Set();
2069
+ return {
2070
+ ImportDeclaration(node) {
2071
+ const source = getImportSource(node);
2072
+ if (source && isEffectEcosystemImport(source)) hasEffectEcosystemImport = true;
2073
+ },
2074
+ VariableDeclaration(node) {
2075
+ if (node.kind !== "let" && node.kind !== "var") return;
2076
+ for (const name of variableDeclarationIdentifierNames(node)) mutableNames.add(name);
2077
+ },
2078
+ CallExpression(node) {
2079
+ if (!hasEffectEcosystemImport) return;
2080
+ const workNode = concurrentEffectWorkNode(node);
2081
+ if (!workNode) return;
2082
+ const mutationNode = findSharedMutableStateMutation(workNode, mutableNames);
2083
+ if (mutationNode) report(context, mutationNode, "Rule: avoid mutating shared state across fibers. Why: outer let/var state mutated from forked or parallel work creates nondeterministic races. Fix: model shared state with Ref/SynchronizedRef/Queue or aggregate immutable results with bounded Effect.all/forEach.");
2084
+ }
2085
+ };
2086
+ } });
2087
+ const noTimeoutWithNoninterruptiblePromise = defineRule({ create(context) {
2088
+ let hasEffectEcosystemImport = false;
2089
+ return {
2090
+ ImportDeclaration(node) {
2091
+ const source = getImportSource(node);
2092
+ if (source && isEffectEcosystemImport(source)) hasEffectEcosystemImport = true;
2093
+ },
2094
+ CallExpression(node) {
2095
+ if (!hasEffectEcosystemImport) return;
2096
+ const promiseNode = noninterruptiblePromiseTimeoutNode(node);
2097
+ if (promiseNode) report(context, promiseNode, "Rule: avoid timeout around noninterruptible Promise effects. Why: timing out Effect.promise or tryPromise without a signal leaves the underlying Promise running after interruption. Fix: use Effect.tryPromise with an AbortSignal parameter and pass it to the async API.");
2098
+ }
2099
+ };
2100
+ } });
1695
2101
  const rules = {
1696
2102
  "no-react-state": noReactState,
1697
2103
  "no-if-statement": noIfStatement,
@@ -1765,21 +2171,165 @@ const rules = {
1765
2171
  "no-flatmap-ladder": noFlatMapLadder,
1766
2172
  "no-pipe-ladder": noPipeLadder,
1767
2173
  "no-call-tower": noCallTower,
1768
- "no-effect-orElse-ladder": noEffectOrElseLadder
2174
+ "no-effect-orElse-ladder": noEffectOrElseLadder,
2175
+ "no-unbounded-effect-all": noUnboundedEffectAll,
2176
+ "no-fire-and-forget-fork": noFireAndForgetFork,
2177
+ "no-fork-in-loop": noForkInLoop,
2178
+ "no-race-without-cleanup": noRaceWithoutCleanup,
2179
+ "no-unobserved-fiber": noUnobservedFiber,
2180
+ "no-unbounded-concurrent-retry": noUnboundedConcurrentRetry,
2181
+ "no-blocking-call-in-effect": noBlockingCallInEffect,
2182
+ "no-promise-concurrency-in-effect": noPromiseConcurrencyInEffect,
2183
+ "no-shared-mutable-state-across-fibers": noSharedMutableStateAcrossFibers,
2184
+ "no-timeout-with-noninterruptible-promise": noTimeoutWithNoninterruptiblePromise
2185
+ };
2186
+ function rulesFromNames(ruleNames) {
2187
+ return Object.fromEntries(ruleNames.map((ruleName) => [`linteffect/${ruleName}`, "error"]));
2188
+ }
2189
+ function presetFor(groupRules) {
2190
+ return {
2191
+ jsPlugins,
2192
+ rules: groupRules
2193
+ };
2194
+ }
2195
+ const jsPlugins = [{
2196
+ name: "linteffect",
2197
+ specifier: "@opsydyn/oxlint-effect"
2198
+ }];
2199
+ const reactAndRuntimeBoundariesRules = rulesFromNames([
2200
+ "no-react-state",
2201
+ "no-runtime-runfork",
2202
+ "no-run-effect-outside-boundary",
2203
+ "no-or-die-outside-boundary",
2204
+ "prevent-dynamic-imports",
2205
+ "no-render-side-effects",
2206
+ "no-inline-runtime-provide"
2207
+ ]);
2208
+ const effectCompositionRules = rulesFromNames([
2209
+ "no-effect-as",
2210
+ "no-effect-do",
2211
+ "no-effect-bind",
2212
+ "no-effect-async",
2213
+ "no-effect-ignore",
2214
+ "no-effect-never",
2215
+ "no-effect-fn-generator",
2216
+ "no-nested-effect-gen",
2217
+ "no-yield-without-star-in-effect-gen",
2218
+ "no-async-effect-combinator-callback",
2219
+ "no-throw-in-effect-logic",
2220
+ "no-try-catch-in-effect-logic",
2221
+ "no-promise-api-in-effect-logic",
2222
+ "no-swallowed-catch-all",
2223
+ "no-manual-effect-channels",
2224
+ "no-effect-type-alias",
2225
+ "no-public-generic-effect-error"
2226
+ ]);
2227
+ const concurrencySafetyRules = rulesFromNames([
2228
+ "no-unbounded-effect-all",
2229
+ "no-fire-and-forget-fork",
2230
+ "no-fork-in-loop",
2231
+ "no-race-without-cleanup",
2232
+ "no-unobserved-fiber",
2233
+ "no-unbounded-concurrent-retry",
2234
+ "no-blocking-call-in-effect",
2235
+ "no-promise-concurrency-in-effect",
2236
+ "no-shared-mutable-state-across-fibers",
2237
+ "no-timeout-with-noninterruptible-promise"
2238
+ ]);
2239
+ const pipelineShapeAndSequencingRules = rulesFromNames([
2240
+ "no-nested-effect-call",
2241
+ "no-effect-ladder",
2242
+ "no-flatmap-ladder",
2243
+ "no-pipe-ladder",
2244
+ "no-call-tower",
2245
+ "no-effect-orElse-ladder",
2246
+ "no-effect-wrapper-alias",
2247
+ "warn-effect-sync-wrapper",
2248
+ "no-effect-side-effect-wrapper",
2249
+ "no-effect-all-step-sequencing",
2250
+ "no-effect-succeed-variable"
2251
+ ]);
2252
+ const branchingAndLocalControlFlowRules = rulesFromNames([
2253
+ "no-if-statement",
2254
+ "no-switch-statement",
2255
+ "no-ternary",
2256
+ "no-try-catch",
2257
+ "no-arrow-ladder",
2258
+ "no-iife-wrapper",
2259
+ "no-return-in-arrow",
2260
+ "no-return-in-callback",
2261
+ "no-return-null",
2262
+ "no-branch-in-object"
2263
+ ]);
2264
+ const optionMatchAndDataNormalizationRules = rulesFromNames([
2265
+ "no-option-as",
2266
+ "no-match-void-branch",
2267
+ "no-match-effect-branch",
2268
+ "no-model-overlay-cast",
2269
+ "no-unknown-boolean-coercion-helper",
2270
+ "no-fromnullable-nullish-coalesce",
2271
+ "no-option-boolean-normalization",
2272
+ "no-string-sentinel-return",
2273
+ "no-string-sentinel-const"
2274
+ ]);
2275
+ const atomStateAndPlatformBoundariesRules = rulesFromNames([
2276
+ "no-effect-sync-console",
2277
+ "no-atom-registry-effect-sync",
2278
+ "no-family-collection-read",
2279
+ "no-naked-object-state-update",
2280
+ "no-wrapgraphql-catchall"
2281
+ ]);
2282
+ const domainModelingRules = rulesFromNames([
2283
+ "no-raw-domain-id-alias",
2284
+ "no-boolean-domain-flag",
2285
+ "no-magic-domain-string",
2286
+ "no-raw-domain-primitive-params",
2287
+ "no-raw-time-domain-field",
2288
+ "no-overloaded-options-object",
2289
+ "no-domain-logic-in-conditional",
2290
+ "no-implicit-state-machine-object",
2291
+ "no-adhoc-domain-error",
2292
+ "no-domain-meaning-by-folder-only"
2293
+ ]);
2294
+ const allRules = rulesFromNames(Object.keys(rules));
2295
+ const ruleGroups = {
2296
+ reactAndRuntimeBoundaries: reactAndRuntimeBoundariesRules,
2297
+ effectComposition: effectCompositionRules,
2298
+ concurrencySafety: concurrencySafetyRules,
2299
+ pipelineShapeAndSequencing: pipelineShapeAndSequencingRules,
2300
+ branchingAndLocalControlFlow: branchingAndLocalControlFlowRules,
2301
+ optionMatchAndDataNormalization: optionMatchAndDataNormalizationRules,
2302
+ atomStateAndPlatformBoundaries: atomStateAndPlatformBoundariesRules,
2303
+ domainModeling: domainModelingRules,
2304
+ ddd: domainModelingRules
1769
2305
  };
1770
- const allRules = Object.fromEntries(Object.keys(rules).map((ruleName) => [`linteffect/${ruleName}`, "error"]));
1771
- const recommended = {
1772
- jsPlugins: [{
1773
- name: "linteffect",
1774
- specifier: "@opsydyn/oxlint-effect"
1775
- }],
1776
- rules: allRules
2306
+ const recommended = presetFor(allRules);
2307
+ const reactAndRuntimeBoundaries = presetFor(reactAndRuntimeBoundariesRules);
2308
+ const effectComposition = presetFor(effectCompositionRules);
2309
+ const concurrencySafety = presetFor(concurrencySafetyRules);
2310
+ const pipelineShapeAndSequencing = presetFor(pipelineShapeAndSequencingRules);
2311
+ const branchingAndLocalControlFlow = presetFor(branchingAndLocalControlFlowRules);
2312
+ const optionMatchAndDataNormalization = presetFor(optionMatchAndDataNormalizationRules);
2313
+ const atomStateAndPlatformBoundaries = presetFor(atomStateAndPlatformBoundariesRules);
2314
+ const domainModeling = presetFor(domainModelingRules);
2315
+ const ddd = domainModeling;
2316
+ const presets = {
2317
+ recommended,
2318
+ reactAndRuntimeBoundaries,
2319
+ effectComposition,
2320
+ concurrencySafety,
2321
+ pipelineShapeAndSequencing,
2322
+ branchingAndLocalControlFlow,
2323
+ optionMatchAndDataNormalization,
2324
+ atomStateAndPlatformBoundaries,
2325
+ domainModeling,
2326
+ ddd
1777
2327
  };
1778
2328
  var src_default = definePlugin({
1779
2329
  meta: { name: "linteffect" },
1780
2330
  rules
1781
2331
  });
1782
2332
  //#endregion
1783
- export { allRules, src_default as default, recommended };
2333
+ export { allRules, atomStateAndPlatformBoundaries, atomStateAndPlatformBoundariesRules, branchingAndLocalControlFlow, branchingAndLocalControlFlowRules, concurrencySafety, concurrencySafetyRules, ddd, src_default as default, domainModeling, domainModelingRules, effectComposition, effectCompositionRules, jsPlugins, optionMatchAndDataNormalization, optionMatchAndDataNormalizationRules, pipelineShapeAndSequencing, pipelineShapeAndSequencingRules, presets, reactAndRuntimeBoundaries, reactAndRuntimeBoundariesRules, recommended, ruleGroups };
1784
2334
 
1785
2335
  //# sourceMappingURL=index.mjs.map