oxlint-plugin-effect 0.2.3 → 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.
Files changed (142) hide show
  1. package/README.md +79 -29
  2. package/dist/presets/index.d.ts +3 -9
  3. package/dist/presets/index.js +3 -17
  4. package/dist/presets/recommended.d.ts +17 -0
  5. package/dist/presets/recommended.js +17 -0
  6. package/dist/rules/index.d.ts +4 -59
  7. package/dist/rules/index.js +4 -114
  8. package/dist/rules/no-async-function.js +8 -13
  9. package/dist/rules/no-dynamic-imports.js +89 -60
  10. package/dist/rules/no-globals.js +164 -127
  11. package/dist/rules/no-new-error.js +26 -13
  12. package/dist/rules/no-new-promise.js +22 -21
  13. package/dist/rules/no-node-builtin-import.js +98 -41
  14. package/dist/rules/no-throw-statement.js +4 -16
  15. package/dist/rules/no-try-catch.js +5 -17
  16. package/package.json +2 -2
  17. package/dist/presets/core.d.ts +0 -49
  18. package/dist/presets/core.js +0 -49
  19. package/dist/presets/effect-native.d.ts +0 -28
  20. package/dist/presets/effect-native.js +0 -28
  21. package/dist/presets/full.d.ts +0 -67
  22. package/dist/presets/full.js +0 -67
  23. package/dist/presets/functional.d.ts +0 -22
  24. package/dist/presets/functional.js +0 -22
  25. package/dist/presets/strict.d.ts +0 -71
  26. package/dist/presets/strict.js +0 -71
  27. package/dist/presets/v3-strict.d.ts +0 -16
  28. package/dist/presets/v3-strict.js +0 -16
  29. package/dist/presets/v3.d.ts +0 -18
  30. package/dist/presets/v3.js +0 -18
  31. package/dist/rules/_effect-context.d.ts +0 -19
  32. package/dist/rules/_effect-context.js +0 -22
  33. package/dist/rules/no-arrow-ladder.d.ts +0 -6
  34. package/dist/rules/no-arrow-ladder.js +0 -61
  35. package/dist/rules/no-catch-all-to-map-error.d.ts +0 -6
  36. package/dist/rules/no-catch-all-to-map-error.js +0 -67
  37. package/dist/rules/no-effect-as.d.ts +0 -6
  38. package/dist/rules/no-effect-as.js +0 -16
  39. package/dist/rules/no-effect-async.d.ts +0 -6
  40. package/dist/rules/no-effect-async.js +0 -16
  41. package/dist/rules/no-effect-fn-generator.d.ts +0 -6
  42. package/dist/rules/no-effect-fn-generator.js +0 -30
  43. package/dist/rules/no-effect-gen-adapter.d.ts +0 -6
  44. package/dist/rules/no-effect-gen-adapter.js +0 -30
  45. package/dist/rules/no-effect-map-flatten.d.ts +0 -6
  46. package/dist/rules/no-effect-map-flatten.js +0 -53
  47. package/dist/rules/no-effect-map-void.d.ts +0 -6
  48. package/dist/rules/no-effect-map-void.js +0 -40
  49. package/dist/rules/no-effect-never.d.ts +0 -6
  50. package/dist/rules/no-effect-never.js +0 -16
  51. package/dist/rules/no-effect-orElse-ladder.d.ts +0 -6
  52. package/dist/rules/no-effect-orElse-ladder.js +0 -53
  53. package/dist/rules/no-effect-succeed-string.d.ts +0 -6
  54. package/dist/rules/no-effect-succeed-string.js +0 -30
  55. package/dist/rules/no-effect-succeed-variable.d.ts +0 -6
  56. package/dist/rules/no-effect-succeed-variable.js +0 -30
  57. package/dist/rules/no-effect-succeed-void.d.ts +0 -6
  58. package/dist/rules/no-effect-succeed-void.js +0 -33
  59. package/dist/rules/no-effect-sync-console.d.ts +0 -6
  60. package/dist/rules/no-effect-sync-console.js +0 -63
  61. package/dist/rules/no-effect-sync-wrapper.d.ts +0 -6
  62. package/dist/rules/no-effect-sync-wrapper.js +0 -37
  63. package/dist/rules/no-effect-type-alias.d.ts +0 -6
  64. package/dist/rules/no-effect-type-alias.js +0 -52
  65. package/dist/rules/no-effect-wrapper-alias.d.ts +0 -6
  66. package/dist/rules/no-effect-wrapper-alias.js +0 -69
  67. package/dist/rules/no-extends-native-error.d.ts +0 -6
  68. package/dist/rules/no-extends-native-error.js +0 -41
  69. package/dist/rules/no-flatmap-ladder.d.ts +0 -6
  70. package/dist/rules/no-flatmap-ladder.js +0 -48
  71. package/dist/rules/no-fromnullable-coalesce.d.ts +0 -6
  72. package/dist/rules/no-fromnullable-coalesce.js +0 -36
  73. package/dist/rules/no-global-error-in-catch.d.ts +0 -6
  74. package/dist/rules/no-global-error-in-catch.js +0 -75
  75. package/dist/rules/no-global-error-in-failure.d.ts +0 -6
  76. package/dist/rules/no-global-error-in-failure.js +0 -54
  77. package/dist/rules/no-hand-rolled-tagged-union.d.ts +0 -6
  78. package/dist/rules/no-hand-rolled-tagged-union.js +0 -70
  79. package/dist/rules/no-if-statement.d.ts +0 -6
  80. package/dist/rules/no-if-statement.js +0 -18
  81. package/dist/rules/no-iife-wrapper.d.ts +0 -6
  82. package/dist/rules/no-iife-wrapper.js +0 -37
  83. package/dist/rules/no-inline-provide.d.ts +0 -6
  84. package/dist/rules/no-inline-provide.js +0 -31
  85. package/dist/rules/no-instanceof-schema.d.ts +0 -6
  86. package/dist/rules/no-instanceof-schema.js +0 -35
  87. package/dist/rules/no-make-unsafe.d.ts +0 -6
  88. package/dist/rules/no-make-unsafe.js +0 -30
  89. package/dist/rules/no-manual-effect-channels.d.ts +0 -6
  90. package/dist/rules/no-manual-effect-channels.js +0 -40
  91. package/dist/rules/no-match-effect-branch.d.ts +0 -6
  92. package/dist/rules/no-match-effect-branch.js +0 -64
  93. package/dist/rules/no-match-void-branch.d.ts +0 -6
  94. package/dist/rules/no-match-void-branch.js +0 -50
  95. package/dist/rules/no-multiple-effect-provide.d.ts +0 -6
  96. package/dist/rules/no-multiple-effect-provide.js +0 -45
  97. package/dist/rules/no-nested-effect-call.d.ts +0 -6
  98. package/dist/rules/no-nested-effect-call.js +0 -97
  99. package/dist/rules/no-nested-effect-gen.d.ts +0 -6
  100. package/dist/rules/no-nested-effect-gen.js +0 -46
  101. package/dist/rules/no-nested-pipe.d.ts +0 -6
  102. package/dist/rules/no-nested-pipe.js +0 -38
  103. package/dist/rules/no-option-as.d.ts +0 -6
  104. package/dist/rules/no-option-as.js +0 -16
  105. package/dist/rules/no-option-boolean-normalization.d.ts +0 -6
  106. package/dist/rules/no-option-boolean-normalization.js +0 -50
  107. package/dist/rules/no-positional-log-error.d.ts +0 -6
  108. package/dist/rules/no-positional-log-error.js +0 -52
  109. package/dist/rules/no-promise-control-flow-in-tests.d.ts +0 -6
  110. package/dist/rules/no-promise-control-flow-in-tests.js +0 -94
  111. package/dist/rules/no-redundant-schema-tag-identifier.d.ts +0 -6
  112. package/dist/rules/no-redundant-schema-tag-identifier.js +0 -46
  113. package/dist/rules/no-return-in-arrow.d.ts +0 -6
  114. package/dist/rules/no-return-in-arrow.js +0 -41
  115. package/dist/rules/no-return-nullish.d.ts +0 -6
  116. package/dist/rules/no-return-nullish.js +0 -47
  117. package/dist/rules/no-run-in-effect-gen.d.ts +0 -6
  118. package/dist/rules/no-run-in-effect-gen.js +0 -48
  119. package/dist/rules/no-runtime-run-fork.d.ts +0 -6
  120. package/dist/rules/no-runtime-run-fork.js +0 -19
  121. package/dist/rules/no-schema-struct-with-tag.d.ts +0 -6
  122. package/dist/rules/no-schema-struct-with-tag.js +0 -48
  123. package/dist/rules/no-schema-struct.d.ts +0 -6
  124. package/dist/rules/no-schema-struct.js +0 -28
  125. package/dist/rules/no-schema-union-of-literals.d.ts +0 -6
  126. package/dist/rules/no-schema-union-of-literals.js +0 -35
  127. package/dist/rules/no-sleep-in-tests.d.ts +0 -6
  128. package/dist/rules/no-sleep-in-tests.js +0 -55
  129. package/dist/rules/no-spread.d.ts +0 -6
  130. package/dist/rules/no-spread.js +0 -26
  131. package/dist/rules/no-string-sentinel-const.d.ts +0 -6
  132. package/dist/rules/no-string-sentinel-const.js +0 -38
  133. package/dist/rules/no-switch-statement.d.ts +0 -6
  134. package/dist/rules/no-switch-statement.js +0 -16
  135. package/dist/rules/no-unnecessary-arrow-block.d.ts +0 -6
  136. package/dist/rules/no-unnecessary-arrow-block.js +0 -34
  137. package/dist/rules/no-unnecessary-effect-gen.d.ts +0 -6
  138. package/dist/rules/no-unnecessary-effect-gen.js +0 -35
  139. package/dist/rules/no-unnecessary-pipe-chain.d.ts +0 -6
  140. package/dist/rules/no-unnecessary-pipe-chain.js +0 -36
  141. package/dist/rules/no-unnecessary-pipe.d.ts +0 -6
  142. package/dist/rules/no-unnecessary-pipe.js +0 -29
@@ -6,55 +6,112 @@ import "../vendor/effect-oxlint/index.js";
6
6
  import * as Option from "effect/Option";
7
7
  import * as Effect from "effect/Effect";
8
8
  //#region src/rules/no-node-builtin-import.ts
9
- /**
10
- * Ban Node.js builtin imports.
11
- *
12
- * Use Effect platform services: FileSystem, Path, HttpClient, Command.
13
- *
14
- * Source: language-service/nodeBuiltinImport
15
- */
16
- const hints = {
17
- fs: "Use FileSystem from 'effect'",
18
- path: "Use Path from 'effect'",
19
- http: "Use HttpClient from 'effect/unstable/http'",
20
- https: "Use HttpClient from 'effect/unstable/http'",
21
- child_process: "Use Command from 'effect'",
22
- crypto: "Use a service wrapper",
23
- os: "Use PlatformInfo from 'effect'",
24
- net: "Use HttpServer from 'effect/unstable/http'",
25
- dns: "Use a service wrapper",
26
- tls: "Use a service wrapper",
27
- dgram: "Use a service wrapper",
28
- stream: "Use Stream from 'effect'",
29
- zlib: "Use a service wrapper",
30
- readline: "Use Terminal from 'effect'",
31
- cluster: "Use a service wrapper",
32
- worker_threads: "Use a service wrapper"
9
+ const replacedModules = new Map([
10
+ ["child_process", "ChildProcessSpawner from 'effect/unstable/process'"],
11
+ ["console", "Console or Effect logging"],
12
+ ["fs", "FileSystem"],
13
+ ["http", "HttpClient or HttpServer from 'effect/unstable/http'"],
14
+ ["https", "HttpClient or HttpServer from 'effect/unstable/http'"],
15
+ ["path", "Path"],
16
+ ["readline", "Terminal or Stdio"],
17
+ ["stream", "Stream, Sink, or Channel"],
18
+ ["timers", "Effect.sleep or Schedule"],
19
+ ["tty", "Terminal or Stdio"],
20
+ ["worker_threads", "Worker from 'effect/unstable/workers'"]
21
+ ]);
22
+ const cryptoOperations = new Set([
23
+ "getRandomValues",
24
+ "randomBytes",
25
+ "randomFill",
26
+ "randomFillSync",
27
+ "randomInt",
28
+ "randomUUID"
29
+ ]);
30
+ const processOperations = new Set([
31
+ "argv",
32
+ "chdir",
33
+ "env",
34
+ "exit",
35
+ "hrtime",
36
+ "nextTick",
37
+ "stderr",
38
+ "stdin",
39
+ "stdout"
40
+ ]);
41
+ const moduleBase = (source) => {
42
+ const withoutPrefix = source.startsWith("node:") ? source.slice(5) : source;
43
+ return withoutPrefix.split("/")[0] ?? withoutPrefix;
33
44
  };
34
- const nodeBuiltins = new Set(Object.keys(hints));
35
- const resolveModule = (source) => {
36
- const base = (source.startsWith("node:") ? source.slice(5) : source).split("/")[0];
37
- return base !== void 0 && nodeBuiltins.has(base) ? base : void 0;
45
+ const importedName = (specifier) => specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
46
+ const memberPath = (node) => {
47
+ if (node.computed || node.property.type !== "Identifier") return void 0;
48
+ if (node.object.type === "Identifier") return [node.object.name, node.property.name];
49
+ if (node.object.type !== "MemberExpression") return void 0;
50
+ const parentPath = memberPath(node.object);
51
+ return parentPath === void 0 ? void 0 : [...parentPath, node.property.name];
52
+ };
53
+ const partialReplacement = (module, path) => {
54
+ const operation = path.at(-1);
55
+ if (operation === void 0) return void 0;
56
+ if (module === "process") return processOperations.has(operation) && path.length === 2 ? "Config, Stdio, Clock, or Effect scheduling" : void 0;
57
+ if (module === "subtle") return operation === "digest" && path.length === 2 ? "Crypto.digest" : void 0;
58
+ if (module === "webcrypto") {
59
+ if (cryptoOperations.has(operation) && path.length === 2) return "Crypto";
60
+ return operation === "digest" && path.at(-2) === "subtle" ? "Crypto.digest" : void 0;
61
+ }
62
+ if (cryptoOperations.has(operation) && path.length === 2) return "Crypto";
63
+ if (path.at(-2) === "webcrypto" && cryptoOperations.has(operation)) return "Crypto";
64
+ return operation === "digest" && path.at(-2) === "subtle" ? "Crypto.digest" : void 0;
38
65
  };
39
66
  const noNodeBuiltinImport = define({
40
67
  name: "no-node-builtin-import",
41
68
  meta: meta({
42
- type: "suggestion",
43
- description: "Avoid Node.js builtin imports. Use Effect platform services."
69
+ type: "problem",
70
+ description: "Avoid Node builtin capabilities that Effect replaces."
44
71
  }),
45
72
  create: function* () {
46
73
  const ctx = yield* RuleContext;
47
- return { ImportDeclaration: (node) => {
48
- const source = Option.getOrUndefined(narrow(node, "ImportDeclaration").pipe(Option.map(importSource)));
49
- if (source === void 0) return Effect.void;
50
- const mod = resolveModule(source);
51
- if (mod === void 0) return Effect.void;
52
- const hint = hints[mod] ?? "Use an Effect service wrapper";
53
- return ctx.report(make({
54
- node,
55
- message: `Avoid importing '${source}'. ${hint}.`
56
- }));
57
- } };
74
+ const partialModuleByAlias = /* @__PURE__ */ new Map();
75
+ const report = (node, used, alternative) => ctx.report(make({
76
+ node,
77
+ message: `Avoid ${used}. Use ${alternative}; platform adapters may disable this rule explicitly.`
78
+ }));
79
+ return {
80
+ ImportDeclaration: (node) => {
81
+ const declaration = Option.getOrUndefined(narrow(node, "ImportDeclaration"));
82
+ if (declaration === void 0) return Effect.void;
83
+ const source = importSource(declaration);
84
+ const module = moduleBase(source);
85
+ const alternative = replacedModules.get(module);
86
+ if (alternative !== void 0) return report(declaration, `importing '${source}'`, alternative);
87
+ if (module !== "crypto" && module !== "process") return Effect.void;
88
+ const diagnostics = [];
89
+ for (const specifier of declaration.specifiers) {
90
+ if (specifier.type === "ImportDefaultSpecifier" || specifier.type === "ImportNamespaceSpecifier") {
91
+ partialModuleByAlias.set(specifier.local.name, module);
92
+ continue;
93
+ }
94
+ const imported = importedName(specifier);
95
+ if (module === "crypto") {
96
+ if (imported === "webcrypto" || imported === "subtle") partialModuleByAlias.set(specifier.local.name, imported);
97
+ else if (cryptoOperations.has(imported)) diagnostics.push(report(specifier, `node:crypto ${imported}`, "Crypto"));
98
+ } else if (processOperations.has(imported)) diagnostics.push(report(specifier, `node:process ${imported}`, "Config, Stdio, Clock, or Effect scheduling"));
99
+ }
100
+ return Effect.all(diagnostics, { discard: true });
101
+ },
102
+ MemberExpression: (node) => {
103
+ const member = Option.getOrUndefined(narrow(node, "MemberExpression"));
104
+ if (member === void 0) return Effect.void;
105
+ const path = memberPath(member);
106
+ if (path === void 0) return Effect.void;
107
+ const alias = path[0];
108
+ if (alias === void 0) return Effect.void;
109
+ const module = partialModuleByAlias.get(alias);
110
+ if (module === void 0) return Effect.void;
111
+ const alternative = partialReplacement(module, path);
112
+ return alternative === void 0 ? Effect.void : report(member, `${path.join(".")}`, alternative);
113
+ }
114
+ };
58
115
  }
59
116
  });
60
117
  //#endregion
@@ -1,20 +1,9 @@
1
1
  import { make } from "../vendor/effect-oxlint/Diagnostic.js";
2
2
  import { RuleContext } from "../vendor/effect-oxlint/RuleContext.js";
3
- import { merge } from "../vendor/effect-oxlint/Visitor.js";
4
3
  import { define, meta } from "../vendor/effect-oxlint/Rule.js";
5
4
  import "../vendor/effect-oxlint/index.js";
6
- import { makeEffectContextTracker } from "./_effect-context.js";
7
- import * as Effect from "effect/Effect";
8
- import * as Ref from "effect/Ref";
9
5
  //#region src/rules/no-throw-statement.ts
10
- /**
11
- * Ban `throw` statements. Context-aware messaging.
12
- *
13
- * Inside Effect.gen/fn: "Use yield* Effect.fail() or yield* new MyError()"
14
- * Outside: "Model errors with Effect.fail() — wrap this function with Effect.fn"
15
- *
16
- * Source: effect convention — errors should be in the type system
17
- */
6
+ /** Ban every throw statement. */
18
7
  const noThrowStatement = define({
19
8
  name: "no-throw-statement",
20
9
  meta: meta({
@@ -23,11 +12,10 @@ const noThrowStatement = define({
23
12
  }),
24
13
  create: function* () {
25
14
  const ctx = yield* RuleContext;
26
- const [depth, tracker] = yield* makeEffectContextTracker;
27
- return merge(tracker, { ThrowStatement: (node) => Effect.flatMap(Ref.get(depth), (d) => ctx.report(make({
15
+ return { ThrowStatement: (node) => ctx.report(make({
28
16
  node,
29
- message: d > 0 ? "Avoid throw inside Effect.gen/fn. Use yield* Effect.fail(new MyError()) or yield* new MyError() for yieldable errors." : "Avoid throw. Model errors with Effect — wrap this function with Effect.fn and use Effect.fail with tagged errors."
30
- }))) });
17
+ message: "Avoid throw. Model expected failures with tagged errors and explicit defects with Effect.die."
18
+ })) };
31
19
  }
32
20
  });
33
21
  //#endregion
@@ -1,33 +1,21 @@
1
1
  import { make } from "../vendor/effect-oxlint/Diagnostic.js";
2
2
  import { RuleContext } from "../vendor/effect-oxlint/RuleContext.js";
3
- import { merge } from "../vendor/effect-oxlint/Visitor.js";
4
3
  import { define, meta } from "../vendor/effect-oxlint/Rule.js";
5
4
  import "../vendor/effect-oxlint/index.js";
6
- import { makeEffectContextTracker } from "./_effect-context.js";
7
- import * as Effect from "effect/Effect";
8
- import * as Ref from "effect/Ref";
9
5
  //#region src/rules/no-try-catch.ts
10
- /**
11
- * Ban `try/catch` statements. Context-aware messaging.
12
- *
13
- * Inside Effect.gen/fn: "Use Effect.try or Effect.tryPromise"
14
- * Outside: "Wrap with Effect.fn and use Effect.try for error handling"
15
- *
16
- * Source: biome-effect-linting-rules/no-try-catch, language-service/tryCatchInEffectGen
17
- */
6
+ /** Ban every try statement, including catch and finally variants. */
18
7
  const noTryCatch = define({
19
8
  name: "no-try-catch",
20
9
  meta: meta({
21
10
  type: "suggestion",
22
- description: "Avoid try/catch. Use Effect.try or Effect.tryPromise."
11
+ description: "Avoid try/catch/finally blocks. Use Effect error handling and finalization operators."
23
12
  }),
24
13
  create: function* () {
25
14
  const ctx = yield* RuleContext;
26
- const [depth, tracker] = yield* makeEffectContextTracker;
27
- return merge(tracker, { TryStatement: (node) => Effect.flatMap(Ref.get(depth), (d) => ctx.report(make({
15
+ return { TryStatement: (node) => ctx.report(make({
28
16
  node,
29
- message: d > 0 ? "Avoid try/catch inside Effect.gen/fn. Use Effect.try({ try: () => ..., catch: (e) => new MyError({ cause: e }) })." : "Avoid try/catch. Wrap this function with Effect.fn and use Effect.try or Effect.tryPromise for error handling."
30
- }))) });
17
+ message: "Avoid try/catch/finally. Use Effect.try or Effect.tryPromise for failures and Effect.ensuring or Effect.acquireUseRelease for finalization."
18
+ })) };
31
19
  }
32
20
  });
33
21
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-plugin-effect",
3
- "version": "0.2.3",
3
+ "version": "0.4.0",
4
4
  "description": "oxlint plugin with Effect-specific lint rules",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -47,7 +47,7 @@
47
47
  "lint:fix": "oxlint --fix",
48
48
  "fmt": "oxfmt",
49
49
  "fmt:check": "oxfmt --check",
50
- "test": "bun test",
50
+ "test": "bun run build && bun test",
51
51
  "gate": "concurrently -n type,style,test -c blue,yellow,green \"bun run typecheck\" \"bun run lint\" \"bun run test\"",
52
52
  "codegen": "bun run scripts/codegen.ts",
53
53
  "add-rule": "bun run scripts/add-rule.ts",
@@ -1,49 +0,0 @@
1
- //#region src/presets/core.d.ts
2
- /**
3
- * Core preset — essential Effect rules.
4
- * Good starting point for projects transitioning to Effect.
5
- */
6
- declare const core: {
7
- readonly "effect/noEffectDo": "error";
8
- readonly "effect/noEffectNever": "error";
9
- readonly "effect/noEffectAs": "error";
10
- readonly "effect/noEffectBind": "error";
11
- readonly "effect/noRunInEffectGen": "error";
12
- readonly "effect/noNestedPipe": "error";
13
- readonly "effect/noNestedEffectGen": "error";
14
- readonly "effect/noUnnecessaryEffectGen": "error";
15
- readonly "effect/noEffectSucceedVoid": "error";
16
- readonly "effect/noEffectMapVoid": "error";
17
- readonly "effect/noUnnecessaryPipe": "warn";
18
- readonly "effect/noEffectFnGenerator": "warn";
19
- readonly "effect/noFlatmapLadder": "error";
20
- readonly "effect/noNestedEffectCall": "error";
21
- readonly "effect/noIifeWrapper": "warn";
22
- readonly "effect/noFromNullableCoalesce": "warn";
23
- readonly "effect/noUnnecessaryArrowBlock": "warn";
24
- readonly "effect/noEffectGenAdapter": "error";
25
- readonly "effect/noEffectSyncConsole": "error";
26
- readonly "effect/noCatchAllToMapError": "error";
27
- readonly "effect/noUnnecessaryPipeChain": "error";
28
- readonly "effect/noMultipleEffectProvide": "error";
29
- readonly "effect/noSchemaUnionOfLiterals": "warn";
30
- readonly "effect/noSchemaStruct": "error";
31
- readonly "effect/noSchemaStructWithTag": "warn";
32
- readonly "effect/noRedundantSchemaTagIdentifier": "warn";
33
- readonly "effect/noEffectMapFlatten": "warn";
34
- readonly "effect/noPositionalLogError": "error";
35
- readonly "effect/noMakeUnsafe": "error";
36
- readonly "effect/noHandRolledTaggedUnion": "error";
37
- readonly "effect/noDynamicImports": "error";
38
- readonly "effect/noThrowStatement": "error";
39
- readonly "effect/noTryCatch": "error";
40
- readonly "effect/noNewPromise": "error";
41
- readonly "effect/noNewError": "error";
42
- readonly "effect/noReturnNullish": "warn";
43
- readonly "effect/noGlobals": "error";
44
- readonly "effect/noInlineProvide": "error";
45
- readonly "effect/noPromiseControlFlowInTests": "error";
46
- readonly "effect/noSleepInTests": "error";
47
- };
48
- //#endregion
49
- export { core };
@@ -1,49 +0,0 @@
1
- //#region src/presets/core.ts
2
- /**
3
- * Core preset — essential Effect rules.
4
- * Good starting point for projects transitioning to Effect.
5
- */
6
- const core = {
7
- "effect/noEffectDo": "error",
8
- "effect/noEffectNever": "error",
9
- "effect/noEffectAs": "error",
10
- "effect/noEffectBind": "error",
11
- "effect/noRunInEffectGen": "error",
12
- "effect/noNestedPipe": "error",
13
- "effect/noNestedEffectGen": "error",
14
- "effect/noUnnecessaryEffectGen": "error",
15
- "effect/noEffectSucceedVoid": "error",
16
- "effect/noEffectMapVoid": "error",
17
- "effect/noUnnecessaryPipe": "warn",
18
- "effect/noEffectFnGenerator": "warn",
19
- "effect/noFlatmapLadder": "error",
20
- "effect/noNestedEffectCall": "error",
21
- "effect/noIifeWrapper": "warn",
22
- "effect/noFromNullableCoalesce": "warn",
23
- "effect/noUnnecessaryArrowBlock": "warn",
24
- "effect/noEffectGenAdapter": "error",
25
- "effect/noEffectSyncConsole": "error",
26
- "effect/noCatchAllToMapError": "error",
27
- "effect/noUnnecessaryPipeChain": "error",
28
- "effect/noMultipleEffectProvide": "error",
29
- "effect/noSchemaUnionOfLiterals": "warn",
30
- "effect/noSchemaStruct": "error",
31
- "effect/noSchemaStructWithTag": "warn",
32
- "effect/noRedundantSchemaTagIdentifier": "warn",
33
- "effect/noEffectMapFlatten": "warn",
34
- "effect/noPositionalLogError": "error",
35
- "effect/noMakeUnsafe": "error",
36
- "effect/noHandRolledTaggedUnion": "error",
37
- "effect/noDynamicImports": "error",
38
- "effect/noThrowStatement": "error",
39
- "effect/noTryCatch": "error",
40
- "effect/noNewPromise": "error",
41
- "effect/noNewError": "error",
42
- "effect/noReturnNullish": "warn",
43
- "effect/noGlobals": "error",
44
- "effect/noInlineProvide": "error",
45
- "effect/noPromiseControlFlowInTests": "error",
46
- "effect/noSleepInTests": "error"
47
- };
48
- //#endregion
49
- export { core };
@@ -1,28 +0,0 @@
1
- //#region src/presets/effect-native.d.ts
2
- /**
3
- * Effect-native preset — for codebases fully committed to Effect.
4
- * All Effect-context rules at error. Enforces Effect platform services
5
- * and tagged errors inside generators.
6
- */
7
- declare const effectNative: {
8
- readonly "effect/noAsyncFunction": "error";
9
- readonly "effect/noNodeBuiltinImport": "error";
10
- readonly "effect/noThrowStatement": "error";
11
- readonly "effect/noTryCatch": "error";
12
- readonly "effect/noNewPromise": "error";
13
- readonly "effect/noNewError": "error";
14
- readonly "effect/noReturnNullish": "error";
15
- readonly "effect/noGlobals": "error";
16
- readonly "effect/noInlineProvide": "error";
17
- readonly "effect/noGlobalErrorInFailure": "error";
18
- readonly "effect/noGlobalErrorInCatch": "error";
19
- readonly "effect/noExtendsNativeError": "error";
20
- readonly "effect/noInstanceofSchema": "error";
21
- readonly "effect/noPositionalLogError": "error";
22
- readonly "effect/noEffectTypeAlias": "error";
23
- readonly "effect/noManualEffectChannels": "error";
24
- readonly "effect/noEffectSyncConsole": "error";
25
- readonly "effect/noEffectSyncWrapper": "warn";
26
- };
27
- //#endregion
28
- export { effectNative };
@@ -1,28 +0,0 @@
1
- //#region src/presets/effect-native.ts
2
- /**
3
- * Effect-native preset — for codebases fully committed to Effect.
4
- * All Effect-context rules at error. Enforces Effect platform services
5
- * and tagged errors inside generators.
6
- */
7
- const effectNative = {
8
- "effect/noAsyncFunction": "error",
9
- "effect/noNodeBuiltinImport": "error",
10
- "effect/noThrowStatement": "error",
11
- "effect/noTryCatch": "error",
12
- "effect/noNewPromise": "error",
13
- "effect/noNewError": "error",
14
- "effect/noReturnNullish": "error",
15
- "effect/noGlobals": "error",
16
- "effect/noInlineProvide": "error",
17
- "effect/noGlobalErrorInFailure": "error",
18
- "effect/noGlobalErrorInCatch": "error",
19
- "effect/noExtendsNativeError": "error",
20
- "effect/noInstanceofSchema": "error",
21
- "effect/noPositionalLogError": "error",
22
- "effect/noEffectTypeAlias": "error",
23
- "effect/noManualEffectChannels": "error",
24
- "effect/noEffectSyncConsole": "error",
25
- "effect/noEffectSyncWrapper": "warn"
26
- };
27
- //#endregion
28
- export { effectNative };
@@ -1,67 +0,0 @@
1
- //#region src/presets/full.d.ts
2
- /**
3
- * Full preset — all Effect-specific rules enabled.
4
- *
5
- * Does NOT include generic JS rules (no-console, no-throw, etc.) —
6
- * configure those via oxlint's built-in rules in .oxlintrc.json.
7
- */
8
- declare const full: {
9
- readonly "effect/noEffectDo": "error";
10
- readonly "effect/noEffectNever": "error";
11
- readonly "effect/noEffectAs": "error";
12
- readonly "effect/noEffectAsync": "error";
13
- readonly "effect/noEffectBind": "error";
14
- readonly "effect/noOptionAs": "error";
15
- readonly "effect/noRunInEffectGen": "error";
16
- readonly "effect/noNodeBuiltinImport": "warn";
17
- readonly "effect/noSpread": "error";
18
- readonly "effect/noNestedPipe": "error";
19
- readonly "effect/noNestedEffectGen": "error";
20
- readonly "effect/noUnnecessaryEffectGen": "error";
21
- readonly "effect/noEffectSucceedVoid": "error";
22
- readonly "effect/noEffectMapVoid": "error";
23
- readonly "effect/noUnnecessaryPipe": "warn";
24
- readonly "effect/noExtendsNativeError": "error";
25
- readonly "effect/noEffectFnGenerator": "warn";
26
- readonly "effect/noInstanceofSchema": "error";
27
- readonly "effect/noFlatmapLadder": "error";
28
- readonly "effect/noNestedEffectCall": "error";
29
- readonly "effect/noIifeWrapper": "warn";
30
- readonly "effect/noEffectSucceedString": "warn";
31
- readonly "effect/noEffectOrElseLadder": "warn";
32
- readonly "effect/noFromNullableCoalesce": "warn";
33
- readonly "effect/noUnnecessaryArrowBlock": "warn";
34
- readonly "effect/noEffectSyncConsole": "error";
35
- readonly "effect/noEffectTypeAlias": "warn";
36
- readonly "effect/noEffectWrapperAlias": "warn";
37
- readonly "effect/noEffectSucceedVariable": "warn";
38
- readonly "effect/noManualEffectChannels": "warn";
39
- readonly "effect/noMatchVoidBranch": "warn";
40
- readonly "effect/noOptionBooleanNormalization": "warn";
41
- readonly "effect/noEffectSyncWrapper": "off";
42
- readonly "effect/noMatchEffectBranch": "warn";
43
- readonly "effect/noUnnecessaryPipeChain": "error";
44
- readonly "effect/noMultipleEffectProvide": "error";
45
- readonly "effect/noSchemaUnionOfLiterals": "warn";
46
- readonly "effect/noSchemaStruct": "error";
47
- readonly "effect/noSchemaStructWithTag": "warn";
48
- readonly "effect/noRedundantSchemaTagIdentifier": "warn";
49
- readonly "effect/noEffectMapFlatten": "warn";
50
- readonly "effect/noGlobalErrorInFailure": "error";
51
- readonly "effect/noGlobalErrorInCatch": "error";
52
- readonly "effect/noPositionalLogError": "error";
53
- readonly "effect/noMakeUnsafe": "error";
54
- readonly "effect/noHandRolledTaggedUnion": "error";
55
- readonly "effect/noDynamicImports": "error";
56
- readonly "effect/noThrowStatement": "error";
57
- readonly "effect/noTryCatch": "error";
58
- readonly "effect/noNewPromise": "error";
59
- readonly "effect/noNewError": "error";
60
- readonly "effect/noReturnNullish": "warn";
61
- readonly "effect/noGlobals": "error";
62
- readonly "effect/noInlineProvide": "error";
63
- readonly "effect/noPromiseControlFlowInTests": "error";
64
- readonly "effect/noSleepInTests": "error";
65
- };
66
- //#endregion
67
- export { full };
@@ -1,67 +0,0 @@
1
- //#region src/presets/full.ts
2
- /**
3
- * Full preset — all Effect-specific rules enabled.
4
- *
5
- * Does NOT include generic JS rules (no-console, no-throw, etc.) —
6
- * configure those via oxlint's built-in rules in .oxlintrc.json.
7
- */
8
- const full = {
9
- "effect/noEffectDo": "error",
10
- "effect/noEffectNever": "error",
11
- "effect/noEffectAs": "error",
12
- "effect/noEffectAsync": "error",
13
- "effect/noEffectBind": "error",
14
- "effect/noOptionAs": "error",
15
- "effect/noRunInEffectGen": "error",
16
- "effect/noNodeBuiltinImport": "warn",
17
- "effect/noSpread": "error",
18
- "effect/noNestedPipe": "error",
19
- "effect/noNestedEffectGen": "error",
20
- "effect/noUnnecessaryEffectGen": "error",
21
- "effect/noEffectSucceedVoid": "error",
22
- "effect/noEffectMapVoid": "error",
23
- "effect/noUnnecessaryPipe": "warn",
24
- "effect/noExtendsNativeError": "error",
25
- "effect/noEffectFnGenerator": "warn",
26
- "effect/noInstanceofSchema": "error",
27
- "effect/noFlatmapLadder": "error",
28
- "effect/noNestedEffectCall": "error",
29
- "effect/noIifeWrapper": "warn",
30
- "effect/noEffectSucceedString": "warn",
31
- "effect/noEffectOrElseLadder": "warn",
32
- "effect/noFromNullableCoalesce": "warn",
33
- "effect/noUnnecessaryArrowBlock": "warn",
34
- "effect/noEffectSyncConsole": "error",
35
- "effect/noEffectTypeAlias": "warn",
36
- "effect/noEffectWrapperAlias": "warn",
37
- "effect/noEffectSucceedVariable": "warn",
38
- "effect/noManualEffectChannels": "warn",
39
- "effect/noMatchVoidBranch": "warn",
40
- "effect/noOptionBooleanNormalization": "warn",
41
- "effect/noEffectSyncWrapper": "off",
42
- "effect/noMatchEffectBranch": "warn",
43
- "effect/noUnnecessaryPipeChain": "error",
44
- "effect/noMultipleEffectProvide": "error",
45
- "effect/noSchemaUnionOfLiterals": "warn",
46
- "effect/noSchemaStruct": "error",
47
- "effect/noSchemaStructWithTag": "warn",
48
- "effect/noRedundantSchemaTagIdentifier": "warn",
49
- "effect/noEffectMapFlatten": "warn",
50
- "effect/noGlobalErrorInFailure": "error",
51
- "effect/noGlobalErrorInCatch": "error",
52
- "effect/noPositionalLogError": "error",
53
- "effect/noMakeUnsafe": "error",
54
- "effect/noHandRolledTaggedUnion": "error",
55
- "effect/noDynamicImports": "error",
56
- "effect/noThrowStatement": "error",
57
- "effect/noTryCatch": "error",
58
- "effect/noNewPromise": "error",
59
- "effect/noNewError": "error",
60
- "effect/noReturnNullish": "warn",
61
- "effect/noGlobals": "error",
62
- "effect/noInlineProvide": "error",
63
- "effect/noPromiseControlFlowInTests": "error",
64
- "effect/noSleepInTests": "error"
65
- };
66
- //#endregion
67
- export { full };
@@ -1,22 +0,0 @@
1
- //#region src/presets/functional.d.ts
2
- /**
3
- * Functional preset — strict functional style for Effect code.
4
- * Bans imperative patterns. Layer on top of core or full.
5
- */
6
- declare const functional: {
7
- readonly "effect/noIfStatement": "error";
8
- readonly "effect/noSwitchStatement": "error";
9
- readonly "effect/noTernary": "error";
10
- readonly "effect/noReturnInArrow": "warn";
11
- readonly "effect/noReturnNull": "warn";
12
- readonly "effect/noEffectSucceedVariable": "error";
13
- readonly "effect/noEffectSucceedString": "error";
14
- readonly "effect/noStringSentinelConst": "warn";
15
- readonly "effect/noMatchVoidBranch": "error";
16
- readonly "effect/noMatchEffectBranch": "error";
17
- readonly "effect/noOptionBooleanNormalization": "error";
18
- readonly "effect/noArrowLadder": "error";
19
- readonly "effect/noSpread": "error";
20
- };
21
- //#endregion
22
- export { functional };
@@ -1,22 +0,0 @@
1
- //#region src/presets/functional.ts
2
- /**
3
- * Functional preset — strict functional style for Effect code.
4
- * Bans imperative patterns. Layer on top of core or full.
5
- */
6
- const functional = {
7
- "effect/noIfStatement": "error",
8
- "effect/noSwitchStatement": "error",
9
- "effect/noTernary": "error",
10
- "effect/noReturnInArrow": "warn",
11
- "effect/noReturnNull": "warn",
12
- "effect/noEffectSucceedVariable": "error",
13
- "effect/noEffectSucceedString": "error",
14
- "effect/noStringSentinelConst": "warn",
15
- "effect/noMatchVoidBranch": "error",
16
- "effect/noMatchEffectBranch": "error",
17
- "effect/noOptionBooleanNormalization": "error",
18
- "effect/noArrowLadder": "error",
19
- "effect/noSpread": "error"
20
- };
21
- //#endregion
22
- export { functional };