oxlint-plugin-effect 0.3.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.
Files changed (146) hide show
  1. package/README.md +79 -38
  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 -61
  7. package/dist/rules/index.js +4 -118
  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 +4 -16
  16. package/package.json +2 -2
  17. package/dist/presets/core.d.ts +0 -50
  18. package/dist/presets/core.js +0 -50
  19. package/dist/presets/effect-native.d.ts +0 -29
  20. package/dist/presets/effect-native.js +0 -29
  21. package/dist/presets/full.d.ts +0 -68
  22. package/dist/presets/full.js +0 -68
  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 -73
  26. package/dist/presets/strict.js +0 -73
  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-all-step-sequencing.d.ts +0 -6
  38. package/dist/rules/no-effect-all-step-sequencing.js +0 -63
  39. package/dist/rules/no-effect-as.d.ts +0 -6
  40. package/dist/rules/no-effect-as.js +0 -16
  41. package/dist/rules/no-effect-async.d.ts +0 -6
  42. package/dist/rules/no-effect-async.js +0 -16
  43. package/dist/rules/no-effect-fn-generator.d.ts +0 -6
  44. package/dist/rules/no-effect-fn-generator.js +0 -30
  45. package/dist/rules/no-effect-gen-adapter.d.ts +0 -6
  46. package/dist/rules/no-effect-gen-adapter.js +0 -30
  47. package/dist/rules/no-effect-map-flatten.d.ts +0 -6
  48. package/dist/rules/no-effect-map-flatten.js +0 -53
  49. package/dist/rules/no-effect-map-void.d.ts +0 -6
  50. package/dist/rules/no-effect-map-void.js +0 -40
  51. package/dist/rules/no-effect-never.d.ts +0 -6
  52. package/dist/rules/no-effect-never.js +0 -16
  53. package/dist/rules/no-effect-orElse-ladder.d.ts +0 -6
  54. package/dist/rules/no-effect-orElse-ladder.js +0 -53
  55. package/dist/rules/no-effect-succeed-string.d.ts +0 -6
  56. package/dist/rules/no-effect-succeed-string.js +0 -30
  57. package/dist/rules/no-effect-succeed-variable.d.ts +0 -6
  58. package/dist/rules/no-effect-succeed-variable.js +0 -30
  59. package/dist/rules/no-effect-succeed-void.d.ts +0 -6
  60. package/dist/rules/no-effect-succeed-void.js +0 -33
  61. package/dist/rules/no-effect-sync-console.d.ts +0 -6
  62. package/dist/rules/no-effect-sync-console.js +0 -63
  63. package/dist/rules/no-effect-sync-wrapper.d.ts +0 -6
  64. package/dist/rules/no-effect-sync-wrapper.js +0 -37
  65. package/dist/rules/no-effect-type-alias.d.ts +0 -6
  66. package/dist/rules/no-effect-type-alias.js +0 -52
  67. package/dist/rules/no-effect-wrapper-alias.d.ts +0 -6
  68. package/dist/rules/no-effect-wrapper-alias.js +0 -69
  69. package/dist/rules/no-extends-native-error.d.ts +0 -6
  70. package/dist/rules/no-extends-native-error.js +0 -41
  71. package/dist/rules/no-flatmap-ladder.d.ts +0 -6
  72. package/dist/rules/no-flatmap-ladder.js +0 -48
  73. package/dist/rules/no-fromnullable-coalesce.d.ts +0 -6
  74. package/dist/rules/no-fromnullable-coalesce.js +0 -36
  75. package/dist/rules/no-global-error-in-catch.d.ts +0 -6
  76. package/dist/rules/no-global-error-in-catch.js +0 -75
  77. package/dist/rules/no-global-error-in-failure.d.ts +0 -6
  78. package/dist/rules/no-global-error-in-failure.js +0 -54
  79. package/dist/rules/no-hand-rolled-tagged-union.d.ts +0 -6
  80. package/dist/rules/no-hand-rolled-tagged-union.js +0 -70
  81. package/dist/rules/no-if-statement.d.ts +0 -6
  82. package/dist/rules/no-if-statement.js +0 -18
  83. package/dist/rules/no-iife-wrapper.d.ts +0 -6
  84. package/dist/rules/no-iife-wrapper.js +0 -37
  85. package/dist/rules/no-inline-provide.d.ts +0 -6
  86. package/dist/rules/no-inline-provide.js +0 -31
  87. package/dist/rules/no-instanceof-schema.d.ts +0 -6
  88. package/dist/rules/no-instanceof-schema.js +0 -35
  89. package/dist/rules/no-make-unsafe.d.ts +0 -6
  90. package/dist/rules/no-make-unsafe.js +0 -30
  91. package/dist/rules/no-manual-data-guard.d.ts +0 -6
  92. package/dist/rules/no-manual-data-guard.js +0 -56
  93. package/dist/rules/no-manual-effect-channels.d.ts +0 -6
  94. package/dist/rules/no-manual-effect-channels.js +0 -40
  95. package/dist/rules/no-match-effect-branch.d.ts +0 -6
  96. package/dist/rules/no-match-effect-branch.js +0 -64
  97. package/dist/rules/no-match-void-branch.d.ts +0 -6
  98. package/dist/rules/no-match-void-branch.js +0 -50
  99. package/dist/rules/no-multiple-effect-provide.d.ts +0 -6
  100. package/dist/rules/no-multiple-effect-provide.js +0 -45
  101. package/dist/rules/no-nested-effect-call.d.ts +0 -6
  102. package/dist/rules/no-nested-effect-call.js +0 -97
  103. package/dist/rules/no-nested-effect-gen.d.ts +0 -6
  104. package/dist/rules/no-nested-effect-gen.js +0 -46
  105. package/dist/rules/no-nested-pipe.d.ts +0 -6
  106. package/dist/rules/no-nested-pipe.js +0 -38
  107. package/dist/rules/no-option-as.d.ts +0 -6
  108. package/dist/rules/no-option-as.js +0 -16
  109. package/dist/rules/no-option-boolean-normalization.d.ts +0 -6
  110. package/dist/rules/no-option-boolean-normalization.js +0 -50
  111. package/dist/rules/no-positional-log-error.d.ts +0 -6
  112. package/dist/rules/no-positional-log-error.js +0 -52
  113. package/dist/rules/no-promise-control-flow-in-tests.d.ts +0 -6
  114. package/dist/rules/no-promise-control-flow-in-tests.js +0 -94
  115. package/dist/rules/no-redundant-schema-tag-identifier.d.ts +0 -6
  116. package/dist/rules/no-redundant-schema-tag-identifier.js +0 -46
  117. package/dist/rules/no-return-in-arrow.d.ts +0 -6
  118. package/dist/rules/no-return-in-arrow.js +0 -41
  119. package/dist/rules/no-return-nullish.d.ts +0 -6
  120. package/dist/rules/no-return-nullish.js +0 -47
  121. package/dist/rules/no-run-in-effect-gen.d.ts +0 -6
  122. package/dist/rules/no-run-in-effect-gen.js +0 -48
  123. package/dist/rules/no-runtime-run-fork.d.ts +0 -6
  124. package/dist/rules/no-runtime-run-fork.js +0 -19
  125. package/dist/rules/no-schema-struct-with-tag.d.ts +0 -6
  126. package/dist/rules/no-schema-struct-with-tag.js +0 -48
  127. package/dist/rules/no-schema-struct.d.ts +0 -6
  128. package/dist/rules/no-schema-struct.js +0 -28
  129. package/dist/rules/no-schema-union-of-literals.d.ts +0 -6
  130. package/dist/rules/no-schema-union-of-literals.js +0 -35
  131. package/dist/rules/no-sleep-in-tests.d.ts +0 -6
  132. package/dist/rules/no-sleep-in-tests.js +0 -55
  133. package/dist/rules/no-spread.d.ts +0 -6
  134. package/dist/rules/no-spread.js +0 -26
  135. package/dist/rules/no-string-sentinel-const.d.ts +0 -6
  136. package/dist/rules/no-string-sentinel-const.js +0 -38
  137. package/dist/rules/no-switch-statement.d.ts +0 -6
  138. package/dist/rules/no-switch-statement.js +0 -16
  139. package/dist/rules/no-unnecessary-arrow-block.d.ts +0 -6
  140. package/dist/rules/no-unnecessary-arrow-block.js +0 -34
  141. package/dist/rules/no-unnecessary-effect-gen.d.ts +0 -6
  142. package/dist/rules/no-unnecessary-effect-gen.js +0 -35
  143. package/dist/rules/no-unnecessary-pipe-chain.d.ts +0 -6
  144. package/dist/rules/no-unnecessary-pipe-chain.js +0 -36
  145. package/dist/rules/no-unnecessary-pipe.d.ts +0 -6
  146. package/dist/rules/no-unnecessary-pipe.js +0 -29
package/README.md CHANGED
@@ -1,44 +1,105 @@
1
1
  # oxlint-plugin-effect
2
2
 
3
- Oxlint plugin for [Effect](https://effect.website) codebases.
3
+ A strict, non-type-aware oxlint plugin for Effect-native TypeScript.
4
4
 
5
- ## Quick Start
5
+ The package has one recommended preset. It protects application code from imperative failure handling, Promise control flow, ambient runtime dependencies, and a small set of non-idiomatic Effect APIs. Effect tsgo remains responsible for semantic and type-aware correctness.
6
+
7
+ ## Install
6
8
 
7
9
  ```bash
8
10
  bun add -D oxlint oxlint-plugin-effect
9
11
  ```
10
12
 
11
- `.oxlintrc.json`:
13
+ Load the plugin and enable the recommended rules in your oxlint configuration:
14
+
15
+ ```ts
16
+ import { recommended } from "oxlint-plugin-effect/presets/recommended";
17
+
18
+ export default {
19
+ jsPlugins: ["oxlint-plugin-effect/plugin"],
20
+ rules: recommended,
21
+ };
22
+ ```
23
+
24
+ If the project uses JSON configuration, copy the exported rule map into `rules`; every recommended rule has `error` severity.
25
+
26
+ ## Recommended Rules
27
+
28
+ | Rule | Contract |
29
+ | ---------------------------- | ----------------------------------------------------------------------------------------- |
30
+ | `effect/noAsyncFunction` | Bans async functions and await expressions |
31
+ | `effect/noTryCatch` | Bans every try/catch/finally statement |
32
+ | `effect/noThrowStatement` | Bans every throw statement |
33
+ | `effect/noNewPromise` | Bans new Promise, Promise calls, and Promise static APIs |
34
+ | `effect/noNewError` | Allows native Error values only as direct arguments to Effect.die, Cause.die, or Exit.die |
35
+ | `effect/noTernary` | Bans conditional expressions while allowing ordinary if statements |
36
+ | `effect/noDynamicImports` | Allows import() only behind a named lazy-loading boundary; bans require() |
37
+ | `effect/noEffectDo` | Bans Effect.Do |
38
+ | `effect/noEffectBind` | Bans Effect.bind |
39
+ | `effect/noGlobals` | Bans ambient capabilities with direct Effect replacements |
40
+ | `effect/noNodeBuiltinImport` | Bans fully replaced Node modules and replaced operations from partial modules |
41
+
42
+ The preset intentionally allows `Effect.as`, `Option.as`, `Effect.never`, `Effect.async`, ordinary `if` and `switch` statements, and runtime runners at explicit application boundaries.
43
+
44
+ ## Platform Boundaries
45
+
46
+ Application code should use Effect services for time, randomness, crypto randomness and supported digests, configuration, files, paths, child processes, stdio, HTTP, sockets, workers, streams, logging, JSON boundaries, encoding, and key-value storage.
47
+
48
+ The rules are capability-based rather than runtime-wide. They do not pretend Effect replaces HMAC, signing, encryption, password hashing, DNS, UDP, compression, module resolution, FFI, VM inspection, or every Buffer/EventEmitter/native-stream operation.
49
+
50
+ Put unmatched host calls in named adapter files and disable only the relevant rule there:
12
51
 
13
52
  ```json
14
53
  {
15
- "jsPlugins": ["oxlint-plugin-effect/plugin"],
16
- "rules": {
17
- "effect/noEffectDo": "error",
18
- "effect/noNestedPipe": "error",
19
- "effect/noThrowStatement": "error",
20
- "effect/noGlobals": "warn"
21
- },
22
54
  "overrides": [
23
55
  {
24
- "files": ["**/*.test.ts", "**/*.test.tsx", "**/tests/**", "**/test/**"],
56
+ "files": ["src/platform/**/*.ts"],
25
57
  "rules": {
26
- "effect/noInlineProvide": "off"
58
+ "effect/noGlobals": "off",
59
+ "effect/noNodeBuiltinImport": "off"
27
60
  }
28
61
  }
29
62
  ]
30
63
  }
31
64
  ```
32
65
 
33
- The `overrides` entry turns off `noInlineProvide` in test files. The rule's intent is "provide layers at the boundary, not scattered through production code" — in tests, `it.effect(() => Effect.gen(function*() { ... }).pipe(Effect.provide(TestLayer)))` is the boundary.
66
+ ## Effect tsgo Pairing
34
67
 
35
- ```bash
36
- oxlint
68
+ Oxlint owns unconditional syntax. Effect tsgo owns floating Effects, missing channels, nested execution, leaking requirements, strict provisioning, schema semantics, and other type-aware diagnostics.
69
+
70
+ When using both tools, disable the tsgo diagnostics duplicated by this preset:
71
+
72
+ ```json
73
+ {
74
+ "diagnosticSeverity": {
75
+ "asyncFunction": "off",
76
+ "cryptoRandomUUID": "off",
77
+ "cryptoRandomUUIDInEffect": "off",
78
+ "globalConsole": "off",
79
+ "globalConsoleInEffect": "off",
80
+ "globalDate": "off",
81
+ "globalDateInEffect": "off",
82
+ "globalFetch": "off",
83
+ "globalFetchInEffect": "off",
84
+ "globalRandom": "off",
85
+ "globalRandomInEffect": "off",
86
+ "globalTimers": "off",
87
+ "globalTimersInEffect": "off",
88
+ "newPromise": "off",
89
+ "nodeBuiltinImport": "off",
90
+ "preferSchemaOverJson": "off",
91
+ "processEnv": "off",
92
+ "processEnvInEffect": "off",
93
+ "tryCatchInEffectGen": "off"
94
+ }
95
+ }
37
96
  ```
38
97
 
98
+ Leave type-aware diagnostics such as `floatingEffect`, `runEffectInsideEffect`, `strictEffectProvide`, `extendsNativeError`, and `unsafeEffectTypeAssertion` enabled.
99
+
39
100
  ## Rule Authoring
40
101
 
41
- The package also exports the Effect-first rule authoring bindings:
102
+ The package exports Effect-first rule-authoring bindings:
42
103
 
43
104
  ```ts
44
105
  import { Diagnostic, Rule, RuleContext } from "oxlint-plugin-effect/rule-bindings";
@@ -50,40 +111,20 @@ export const noThing = Rule.define({
50
111
  description: "Avoid thing.",
51
112
  }),
52
113
  create: function* () {
53
- const ctx = yield* RuleContext;
114
+ const context = yield* RuleContext;
54
115
  return {
55
- Identifier: (node) => ctx.report(Diagnostic.make({ node, message: "Avoid thing." })),
116
+ Identifier: (node) => context.report(Diagnostic.make({ node, message: "Avoid thing." })),
56
117
  };
57
118
  },
58
119
  });
59
120
  ```
60
121
 
61
- The same bindings are available from the root export for convenience:
62
-
63
- ```ts
64
- import { Rule, Diagnostic, RuleContext } from "oxlint-plugin-effect";
65
- ```
66
-
67
- ## Rules
68
-
69
- 68 AST-only rules across categories: API bans, global bans, import bans, statement bans, AST patterns, and Effect-context rules. Five presets are available: `core`, `full`, `effect-native`, `functional`, and `strict`.
70
-
71
- `effect/noTryCatch` rejects every JavaScript `try` statement, including
72
- `try/catch`, bare `try/finally`, and `try/catch/finally`. Use Effect's typed
73
- failure channel and scoped finalization operators instead.
74
-
75
- The core presets also reject sequential state mutations hidden in
76
- `Effect.all(..., { concurrency: 1 })`. The stricter `noManualDataGuard` rule
77
- requires unknown input to cross a Schema boundary instead of being promoted by
78
- a hand-written type predicate.
79
-
80
122
  ## Development
81
123
 
82
124
  ```bash
83
125
  bun install
84
126
  bun run gate
85
127
  bun run codegen
86
- bun run add-rule <name> [--context]
87
128
  ```
88
129
 
89
130
  ## License
@@ -1,14 +1,8 @@
1
- import { full } from "./full.js";
2
- import { core } from "./core.js";
3
- import { effectNative } from "./effect-native.js";
4
- import { functional } from "./functional.js";
5
- import { strict } from "./strict.js";
6
- import { v3 } from "./v3.js";
7
- import { v3Strict } from "./v3-strict.js";
1
+ import { recommended } from "./recommended.js";
8
2
 
9
3
  //#region src/presets/index.d.ts
10
4
  declare namespace index_d_exports {
11
- export { core, effectNative, full, functional, strict, v3, v3Strict };
5
+ export { recommended };
12
6
  }
13
7
  //#endregion
14
- export { core, effectNative, full, functional, index_d_exports, strict, v3, v3Strict };
8
+ export { index_d_exports, recommended };
@@ -1,20 +1,6 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
- import { full } from "./full.js";
3
- import { core } from "./core.js";
4
- import { effectNative } from "./effect-native.js";
5
- import { functional } from "./functional.js";
6
- import { strict } from "./strict.js";
7
- import { v3 } from "./v3.js";
8
- import { v3Strict } from "./v3-strict.js";
2
+ import { recommended } from "./recommended.js";
9
3
  //#region src/presets/index.ts
10
- var presets_exports = /* @__PURE__ */ __exportAll({
11
- core: () => core,
12
- effectNative: () => effectNative,
13
- full: () => full,
14
- functional: () => functional,
15
- strict: () => strict,
16
- v3: () => v3,
17
- v3Strict: () => v3Strict
18
- });
4
+ var presets_exports = /* @__PURE__ */ __exportAll({ recommended: () => recommended });
19
5
  //#endregion
20
- export { core, effectNative, full, functional, presets_exports, strict, v3, v3Strict };
6
+ export { presets_exports, recommended };
@@ -0,0 +1,17 @@
1
+ //#region src/presets/recommended.d.ts
2
+ /** Strict, non-type-aware policy for Effect-native application code. */
3
+ declare const recommended: {
4
+ readonly "effect/noAsyncFunction": "error";
5
+ readonly "effect/noDynamicImports": "error";
6
+ readonly "effect/noEffectBind": "error";
7
+ readonly "effect/noEffectDo": "error";
8
+ readonly "effect/noGlobals": "error";
9
+ readonly "effect/noNewError": "error";
10
+ readonly "effect/noNewPromise": "error";
11
+ readonly "effect/noNodeBuiltinImport": "error";
12
+ readonly "effect/noTernary": "error";
13
+ readonly "effect/noThrowStatement": "error";
14
+ readonly "effect/noTryCatch": "error";
15
+ };
16
+ //#endregion
17
+ export { recommended };
@@ -0,0 +1,17 @@
1
+ //#region src/presets/recommended.ts
2
+ /** Strict, non-type-aware policy for Effect-native application code. */
3
+ const recommended = {
4
+ "effect/noAsyncFunction": "error",
5
+ "effect/noDynamicImports": "error",
6
+ "effect/noEffectBind": "error",
7
+ "effect/noEffectDo": "error",
8
+ "effect/noGlobals": "error",
9
+ "effect/noNewError": "error",
10
+ "effect/noNewPromise": "error",
11
+ "effect/noNodeBuiltinImport": "error",
12
+ "effect/noTernary": "error",
13
+ "effect/noThrowStatement": "error",
14
+ "effect/noTryCatch": "error"
15
+ };
16
+ //#endregion
17
+ export { recommended };
@@ -1,75 +1,18 @@
1
- import { noEffectAs } from "./no-effect-as.js";
2
- import { noEffectAsync } from "./no-effect-async.js";
3
1
  import { noEffectBind } from "./no-effect-bind.js";
4
2
  import { noEffectDo } from "./no-effect-do.js";
5
- import { noEffectNever } from "./no-effect-never.js";
6
- import { noOptionAs } from "./no-option-as.js";
7
- import { noRuntimeRunFork } from "./no-runtime-run-fork.js";
8
- import { noIfStatement } from "./no-if-statement.js";
9
- import { noSwitchStatement } from "./no-switch-statement.js";
10
- import { noArrowLadder } from "./no-arrow-ladder.js";
11
3
  import { noAsyncFunction } from "./no-async-function.js";
12
- import { noCatchAllToMapError } from "./no-catch-all-to-map-error.js";
13
4
  import { noDynamicImports } from "./no-dynamic-imports.js";
14
- import { noEffectAllStepSequencing } from "./no-effect-all-step-sequencing.js";
15
- import { noEffectFnGenerator } from "./no-effect-fn-generator.js";
16
- import { noEffectGenAdapter } from "./no-effect-gen-adapter.js";
17
- import { noEffectMapFlatten } from "./no-effect-map-flatten.js";
18
- import { noEffectMapVoid } from "./no-effect-map-void.js";
19
- import { noEffectOrElseLadder } from "./no-effect-orElse-ladder.js";
20
- import { noEffectSucceedString } from "./no-effect-succeed-string.js";
21
- import { noEffectSucceedVariable } from "./no-effect-succeed-variable.js";
22
- import { noEffectSucceedVoid } from "./no-effect-succeed-void.js";
23
- import { noEffectSyncConsole } from "./no-effect-sync-console.js";
24
- import { noEffectSyncWrapper } from "./no-effect-sync-wrapper.js";
25
- import { noEffectTypeAlias } from "./no-effect-type-alias.js";
26
- import { noEffectWrapperAlias } from "./no-effect-wrapper-alias.js";
27
- import { noExtendsNativeError } from "./no-extends-native-error.js";
28
- import { noFlatmapLadder } from "./no-flatmap-ladder.js";
29
- import { noFromNullableCoalesce } from "./no-fromnullable-coalesce.js";
30
- import { noGlobalErrorInCatch } from "./no-global-error-in-catch.js";
31
- import { noGlobalErrorInFailure } from "./no-global-error-in-failure.js";
32
- import { noHandRolledTaggedUnion } from "./no-hand-rolled-tagged-union.js";
33
- import { noIifeWrapper } from "./no-iife-wrapper.js";
34
- import { noInstanceofSchema } from "./no-instanceof-schema.js";
35
- import { noMakeUnsafe } from "./no-make-unsafe.js";
36
- import { noManualDataGuard } from "./no-manual-data-guard.js";
37
- import { noManualEffectChannels } from "./no-manual-effect-channels.js";
38
- import { noMatchEffectBranch } from "./no-match-effect-branch.js";
39
- import { noMatchVoidBranch } from "./no-match-void-branch.js";
40
- import { noMultipleEffectProvide } from "./no-multiple-effect-provide.js";
41
- import { noNestedEffectCall } from "./no-nested-effect-call.js";
42
- import { noNestedEffectGen } from "./no-nested-effect-gen.js";
43
- import { noNestedPipe } from "./no-nested-pipe.js";
44
- import { noNodeBuiltinImport } from "./no-node-builtin-import.js";
45
- import { noOptionBooleanNormalization } from "./no-option-boolean-normalization.js";
46
- import { noPositionalLogError } from "./no-positional-log-error.js";
47
- import { noPromiseControlFlowInTests } from "./no-promise-control-flow-in-tests.js";
48
- import { noRedundantSchemaTagIdentifier } from "./no-redundant-schema-tag-identifier.js";
49
- import { noReturnInArrow } from "./no-return-in-arrow.js";
50
- import { noSchemaStructWithTag } from "./no-schema-struct-with-tag.js";
51
- import { noSchemaStruct } from "./no-schema-struct.js";
52
- import { noSchemaUnionOfLiterals } from "./no-schema-union-of-literals.js";
53
- import { noSleepInTests } from "./no-sleep-in-tests.js";
54
- import { noSpread } from "./no-spread.js";
55
- import { noStringSentinelConst } from "./no-string-sentinel-const.js";
56
- import { noTernary } from "./no-ternary.js";
57
- import { noUnnecessaryArrowBlock } from "./no-unnecessary-arrow-block.js";
58
- import { noUnnecessaryEffectGen } from "./no-unnecessary-effect-gen.js";
59
- import { noUnnecessaryPipeChain } from "./no-unnecessary-pipe-chain.js";
60
- import { noUnnecessaryPipe } from "./no-unnecessary-pipe.js";
61
5
  import { noGlobals } from "./no-globals.js";
62
- import { noInlineProvide } from "./no-inline-provide.js";
63
6
  import { noNewError } from "./no-new-error.js";
64
7
  import { noNewPromise } from "./no-new-promise.js";
65
- import { noReturnNullish } from "./no-return-nullish.js";
66
- import { noRunInEffectGen } from "./no-run-in-effect-gen.js";
8
+ import { noNodeBuiltinImport } from "./no-node-builtin-import.js";
9
+ import { noTernary } from "./no-ternary.js";
67
10
  import { noThrowStatement } from "./no-throw-statement.js";
68
11
  import { noTryCatch } from "./no-try-catch.js";
69
12
 
70
13
  //#region src/rules/index.d.ts
71
14
  declare namespace index_d_exports {
72
- export { noArrowLadder, noAsyncFunction, noCatchAllToMapError, noDynamicImports, noEffectAllStepSequencing, noEffectAs, noEffectAsync, noEffectBind, noEffectDo, noEffectFnGenerator, noEffectGenAdapter, noEffectMapFlatten, noEffectMapVoid, noEffectNever, noEffectOrElseLadder, noEffectSucceedString, noEffectSucceedVariable, noEffectSucceedVoid, noEffectSyncConsole, noEffectSyncWrapper, noEffectTypeAlias, noEffectWrapperAlias, noExtendsNativeError, noFlatmapLadder, noFromNullableCoalesce, noGlobalErrorInCatch, noGlobalErrorInFailure, noGlobals, noHandRolledTaggedUnion, noIfStatement, noIifeWrapper, noInlineProvide, noInstanceofSchema, noMakeUnsafe, noManualDataGuard, noManualEffectChannels, noMatchEffectBranch, noMatchVoidBranch, noMultipleEffectProvide, noNestedEffectCall, noNestedEffectGen, noNestedPipe, noNewError, noNewPromise, noNodeBuiltinImport, noOptionAs, noOptionBooleanNormalization, noPositionalLogError, noPromiseControlFlowInTests, noRedundantSchemaTagIdentifier, noReturnInArrow, noReturnNullish, noRunInEffectGen, noRuntimeRunFork, noSchemaStruct, noSchemaStructWithTag, noSchemaUnionOfLiterals, noSleepInTests, noSpread, noStringSentinelConst, noSwitchStatement, noTernary, noThrowStatement, noTryCatch, noUnnecessaryArrowBlock, noUnnecessaryEffectGen, noUnnecessaryPipe, noUnnecessaryPipeChain };
15
+ export { noAsyncFunction, noDynamicImports, noEffectBind, noEffectDo, noGlobals, noNewError, noNewPromise, noNodeBuiltinImport, noTernary, noThrowStatement, noTryCatch };
73
16
  }
74
17
  //#endregion
75
- export { index_d_exports, noArrowLadder, noAsyncFunction, noCatchAllToMapError, noDynamicImports, noEffectAllStepSequencing, noEffectAs, noEffectAsync, noEffectBind, noEffectDo, noEffectFnGenerator, noEffectGenAdapter, noEffectMapFlatten, noEffectMapVoid, noEffectNever, noEffectOrElseLadder, noEffectSucceedString, noEffectSucceedVariable, noEffectSucceedVoid, noEffectSyncConsole, noEffectSyncWrapper, noEffectTypeAlias, noEffectWrapperAlias, noExtendsNativeError, noFlatmapLadder, noFromNullableCoalesce, noGlobalErrorInCatch, noGlobalErrorInFailure, noGlobals, noHandRolledTaggedUnion, noIfStatement, noIifeWrapper, noInlineProvide, noInstanceofSchema, noMakeUnsafe, noManualDataGuard, noManualEffectChannels, noMatchEffectBranch, noMatchVoidBranch, noMultipleEffectProvide, noNestedEffectCall, noNestedEffectGen, noNestedPipe, noNewError, noNewPromise, noNodeBuiltinImport, noOptionAs, noOptionBooleanNormalization, noPositionalLogError, noPromiseControlFlowInTests, noRedundantSchemaTagIdentifier, noReturnInArrow, noReturnNullish, noRunInEffectGen, noRuntimeRunFork, noSchemaStruct, noSchemaStructWithTag, noSchemaUnionOfLiterals, noSleepInTests, noSpread, noStringSentinelConst, noSwitchStatement, noTernary, noThrowStatement, noTryCatch, noUnnecessaryArrowBlock, noUnnecessaryEffectGen, noUnnecessaryPipe, noUnnecessaryPipeChain };
18
+ export { index_d_exports, noAsyncFunction, noDynamicImports, noEffectBind, noEffectDo, noGlobals, noNewError, noNewPromise, noNodeBuiltinImport, noTernary, noThrowStatement, noTryCatch };
@@ -1,142 +1,28 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
- import { noEffectAs } from "./no-effect-as.js";
3
- import { noEffectAsync } from "./no-effect-async.js";
4
2
  import { noEffectBind } from "./no-effect-bind.js";
5
3
  import { noEffectDo } from "./no-effect-do.js";
6
- import { noEffectNever } from "./no-effect-never.js";
7
- import { noOptionAs } from "./no-option-as.js";
8
- import { noRuntimeRunFork } from "./no-runtime-run-fork.js";
9
- import { noIfStatement } from "./no-if-statement.js";
10
- import { noSwitchStatement } from "./no-switch-statement.js";
11
- import { noArrowLadder } from "./no-arrow-ladder.js";
12
4
  import { noAsyncFunction } from "./no-async-function.js";
13
- import { noCatchAllToMapError } from "./no-catch-all-to-map-error.js";
14
5
  import { noDynamicImports } from "./no-dynamic-imports.js";
15
- import { noEffectAllStepSequencing } from "./no-effect-all-step-sequencing.js";
16
- import { noEffectFnGenerator } from "./no-effect-fn-generator.js";
17
- import { noEffectGenAdapter } from "./no-effect-gen-adapter.js";
18
- import { noEffectMapFlatten } from "./no-effect-map-flatten.js";
19
- import { noEffectMapVoid } from "./no-effect-map-void.js";
20
- import { noEffectOrElseLadder } from "./no-effect-orElse-ladder.js";
21
- import { noEffectSucceedString } from "./no-effect-succeed-string.js";
22
- import { noEffectSucceedVariable } from "./no-effect-succeed-variable.js";
23
- import { noEffectSucceedVoid } from "./no-effect-succeed-void.js";
24
- import { noEffectSyncConsole } from "./no-effect-sync-console.js";
25
- import { noEffectSyncWrapper } from "./no-effect-sync-wrapper.js";
26
- import { noEffectTypeAlias } from "./no-effect-type-alias.js";
27
- import { noEffectWrapperAlias } from "./no-effect-wrapper-alias.js";
28
- import { noExtendsNativeError } from "./no-extends-native-error.js";
29
- import { noFlatmapLadder } from "./no-flatmap-ladder.js";
30
- import { noFromNullableCoalesce } from "./no-fromnullable-coalesce.js";
31
- import { noGlobalErrorInCatch } from "./no-global-error-in-catch.js";
32
- import { noGlobalErrorInFailure } from "./no-global-error-in-failure.js";
33
- import { noHandRolledTaggedUnion } from "./no-hand-rolled-tagged-union.js";
34
- import { noIifeWrapper } from "./no-iife-wrapper.js";
35
- import { noInstanceofSchema } from "./no-instanceof-schema.js";
36
- import { noMakeUnsafe } from "./no-make-unsafe.js";
37
- import { noManualDataGuard } from "./no-manual-data-guard.js";
38
- import { noManualEffectChannels } from "./no-manual-effect-channels.js";
39
- import { noMatchEffectBranch } from "./no-match-effect-branch.js";
40
- import { noMatchVoidBranch } from "./no-match-void-branch.js";
41
- import { noMultipleEffectProvide } from "./no-multiple-effect-provide.js";
42
- import { noNestedEffectCall } from "./no-nested-effect-call.js";
43
- import { noNestedEffectGen } from "./no-nested-effect-gen.js";
44
- import { noNestedPipe } from "./no-nested-pipe.js";
45
- import { noNodeBuiltinImport } from "./no-node-builtin-import.js";
46
- import { noOptionBooleanNormalization } from "./no-option-boolean-normalization.js";
47
- import { noPositionalLogError } from "./no-positional-log-error.js";
48
- import { noPromiseControlFlowInTests } from "./no-promise-control-flow-in-tests.js";
49
- import { noRedundantSchemaTagIdentifier } from "./no-redundant-schema-tag-identifier.js";
50
- import { noReturnInArrow } from "./no-return-in-arrow.js";
51
- import { noSchemaStructWithTag } from "./no-schema-struct-with-tag.js";
52
- import { noSchemaStruct } from "./no-schema-struct.js";
53
- import { noSchemaUnionOfLiterals } from "./no-schema-union-of-literals.js";
54
- import { noSleepInTests } from "./no-sleep-in-tests.js";
55
- import { noSpread } from "./no-spread.js";
56
- import { noStringSentinelConst } from "./no-string-sentinel-const.js";
57
- import { noTernary } from "./no-ternary.js";
58
- import { noUnnecessaryArrowBlock } from "./no-unnecessary-arrow-block.js";
59
- import { noUnnecessaryEffectGen } from "./no-unnecessary-effect-gen.js";
60
- import { noUnnecessaryPipeChain } from "./no-unnecessary-pipe-chain.js";
61
- import { noUnnecessaryPipe } from "./no-unnecessary-pipe.js";
62
6
  import { noGlobals } from "./no-globals.js";
63
- import { noInlineProvide } from "./no-inline-provide.js";
64
7
  import { noNewError } from "./no-new-error.js";
65
8
  import { noNewPromise } from "./no-new-promise.js";
66
- import { noReturnNullish } from "./no-return-nullish.js";
67
- import { noRunInEffectGen } from "./no-run-in-effect-gen.js";
9
+ import { noNodeBuiltinImport } from "./no-node-builtin-import.js";
10
+ import { noTernary } from "./no-ternary.js";
68
11
  import { noThrowStatement } from "./no-throw-statement.js";
69
12
  import { noTryCatch } from "./no-try-catch.js";
70
13
  //#region src/rules/index.ts
71
14
  var rules_exports = /* @__PURE__ */ __exportAll({
72
- noArrowLadder: () => noArrowLadder,
73
15
  noAsyncFunction: () => noAsyncFunction,
74
- noCatchAllToMapError: () => noCatchAllToMapError,
75
16
  noDynamicImports: () => noDynamicImports,
76
- noEffectAllStepSequencing: () => noEffectAllStepSequencing,
77
- noEffectAs: () => noEffectAs,
78
- noEffectAsync: () => noEffectAsync,
79
17
  noEffectBind: () => noEffectBind,
80
18
  noEffectDo: () => noEffectDo,
81
- noEffectFnGenerator: () => noEffectFnGenerator,
82
- noEffectGenAdapter: () => noEffectGenAdapter,
83
- noEffectMapFlatten: () => noEffectMapFlatten,
84
- noEffectMapVoid: () => noEffectMapVoid,
85
- noEffectNever: () => noEffectNever,
86
- noEffectOrElseLadder: () => noEffectOrElseLadder,
87
- noEffectSucceedString: () => noEffectSucceedString,
88
- noEffectSucceedVariable: () => noEffectSucceedVariable,
89
- noEffectSucceedVoid: () => noEffectSucceedVoid,
90
- noEffectSyncConsole: () => noEffectSyncConsole,
91
- noEffectSyncWrapper: () => noEffectSyncWrapper,
92
- noEffectTypeAlias: () => noEffectTypeAlias,
93
- noEffectWrapperAlias: () => noEffectWrapperAlias,
94
- noExtendsNativeError: () => noExtendsNativeError,
95
- noFlatmapLadder: () => noFlatmapLadder,
96
- noFromNullableCoalesce: () => noFromNullableCoalesce,
97
- noGlobalErrorInCatch: () => noGlobalErrorInCatch,
98
- noGlobalErrorInFailure: () => noGlobalErrorInFailure,
99
19
  noGlobals: () => noGlobals,
100
- noHandRolledTaggedUnion: () => noHandRolledTaggedUnion,
101
- noIfStatement: () => noIfStatement,
102
- noIifeWrapper: () => noIifeWrapper,
103
- noInlineProvide: () => noInlineProvide,
104
- noInstanceofSchema: () => noInstanceofSchema,
105
- noMakeUnsafe: () => noMakeUnsafe,
106
- noManualDataGuard: () => noManualDataGuard,
107
- noManualEffectChannels: () => noManualEffectChannels,
108
- noMatchEffectBranch: () => noMatchEffectBranch,
109
- noMatchVoidBranch: () => noMatchVoidBranch,
110
- noMultipleEffectProvide: () => noMultipleEffectProvide,
111
- noNestedEffectCall: () => noNestedEffectCall,
112
- noNestedEffectGen: () => noNestedEffectGen,
113
- noNestedPipe: () => noNestedPipe,
114
20
  noNewError: () => noNewError,
115
21
  noNewPromise: () => noNewPromise,
116
22
  noNodeBuiltinImport: () => noNodeBuiltinImport,
117
- noOptionAs: () => noOptionAs,
118
- noOptionBooleanNormalization: () => noOptionBooleanNormalization,
119
- noPositionalLogError: () => noPositionalLogError,
120
- noPromiseControlFlowInTests: () => noPromiseControlFlowInTests,
121
- noRedundantSchemaTagIdentifier: () => noRedundantSchemaTagIdentifier,
122
- noReturnInArrow: () => noReturnInArrow,
123
- noReturnNullish: () => noReturnNullish,
124
- noRunInEffectGen: () => noRunInEffectGen,
125
- noRuntimeRunFork: () => noRuntimeRunFork,
126
- noSchemaStruct: () => noSchemaStruct,
127
- noSchemaStructWithTag: () => noSchemaStructWithTag,
128
- noSchemaUnionOfLiterals: () => noSchemaUnionOfLiterals,
129
- noSleepInTests: () => noSleepInTests,
130
- noSpread: () => noSpread,
131
- noStringSentinelConst: () => noStringSentinelConst,
132
- noSwitchStatement: () => noSwitchStatement,
133
23
  noTernary: () => noTernary,
134
24
  noThrowStatement: () => noThrowStatement,
135
- noTryCatch: () => noTryCatch,
136
- noUnnecessaryArrowBlock: () => noUnnecessaryArrowBlock,
137
- noUnnecessaryEffectGen: () => noUnnecessaryEffectGen,
138
- noUnnecessaryPipe: () => noUnnecessaryPipe,
139
- noUnnecessaryPipeChain: () => noUnnecessaryPipeChain
25
+ noTryCatch: () => noTryCatch
140
26
  });
141
27
  //#endregion
142
- export { noArrowLadder, noAsyncFunction, noCatchAllToMapError, noDynamicImports, noEffectAllStepSequencing, noEffectAs, noEffectAsync, noEffectBind, noEffectDo, noEffectFnGenerator, noEffectGenAdapter, noEffectMapFlatten, noEffectMapVoid, noEffectNever, noEffectOrElseLadder, noEffectSucceedString, noEffectSucceedVariable, noEffectSucceedVoid, noEffectSyncConsole, noEffectSyncWrapper, noEffectTypeAlias, noEffectWrapperAlias, noExtendsNativeError, noFlatmapLadder, noFromNullableCoalesce, noGlobalErrorInCatch, noGlobalErrorInFailure, noGlobals, noHandRolledTaggedUnion, noIfStatement, noIifeWrapper, noInlineProvide, noInstanceofSchema, noMakeUnsafe, noManualDataGuard, noManualEffectChannels, noMatchEffectBranch, noMatchVoidBranch, noMultipleEffectProvide, noNestedEffectCall, noNestedEffectGen, noNestedPipe, noNewError, noNewPromise, noNodeBuiltinImport, noOptionAs, noOptionBooleanNormalization, noPositionalLogError, noPromiseControlFlowInTests, noRedundantSchemaTagIdentifier, noReturnInArrow, noReturnNullish, noRunInEffectGen, noRuntimeRunFork, noSchemaStruct, noSchemaStructWithTag, noSchemaUnionOfLiterals, noSleepInTests, noSpread, noStringSentinelConst, noSwitchStatement, noTernary, noThrowStatement, noTryCatch, noUnnecessaryArrowBlock, noUnnecessaryEffectGen, noUnnecessaryPipe, noUnnecessaryPipeChain, rules_exports };
28
+ export { noAsyncFunction, noDynamicImports, noEffectBind, noEffectDo, noGlobals, noNewError, noNewPromise, noNodeBuiltinImport, noTernary, noThrowStatement, noTryCatch, rules_exports };
@@ -4,27 +4,18 @@ import { define, meta } from "../vendor/effect-oxlint/Rule.js";
4
4
  import "../vendor/effect-oxlint/index.js";
5
5
  import * as Effect from "effect/Effect";
6
6
  //#region src/rules/no-async-function.ts
7
- /**
8
- * Ban `async` functions.
9
- *
10
- * Use Effect.promise, Effect.tryPromise, or Effect.gen instead.
11
- *
12
- * Source: language-service/asyncFunction
13
- *
14
- * Note: This is an effectNative rule — off by default.
15
- * Only enable in codebases fully committed to Effect.
16
- */
7
+ /** Ban async functions and await expressions. */
17
8
  const noAsyncFunction = define({
18
9
  name: "no-async-function",
19
10
  meta: meta({
20
11
  type: "suggestion",
21
- description: "Avoid async functions. Use Effect.promise or Effect.tryPromise."
12
+ description: "Avoid async/await. Compose asynchronous work with Effect."
22
13
  }),
23
14
  create: function* () {
24
15
  const ctx = yield* RuleContext;
25
16
  const report = (node) => ctx.report(make({
26
17
  node,
27
- message: "Avoid async functions. Use Effect.promise, Effect.tryPromise, or Effect.gen."
18
+ message: "Avoid async functions. Use Effect.gen with Effect.promise or Effect.tryPromise."
28
19
  }));
29
20
  return {
30
21
  FunctionDeclaration: (node) => {
@@ -38,7 +29,11 @@ const noAsyncFunction = define({
38
29
  ArrowFunctionExpression: (node) => {
39
30
  if ("async" in node && node.async === true) return report(node);
40
31
  return Effect.void;
41
- }
32
+ },
33
+ AwaitExpression: (node) => ctx.report(make({
34
+ node,
35
+ message: "Avoid await. Yield Effect.promise or Effect.tryPromise inside Effect.gen."
36
+ }))
42
37
  };
43
38
  }
44
39
  });