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
@@ -1,36 +0,0 @@
1
- import { make } from "../vendor/effect-oxlint/Diagnostic.js";
2
- import { RuleContext } from "../vendor/effect-oxlint/RuleContext.js";
3
- import { define, meta } from "../vendor/effect-oxlint/Rule.js";
4
- import "../vendor/effect-oxlint/index.js";
5
- import * as Effect from "effect/Effect";
6
- //#region src/rules/no-unnecessary-pipe-chain.ts
7
- const isMethodPipe = (node) => {
8
- if (node.type !== "CallExpression") return false;
9
- const callee = node["callee"];
10
- if (callee == null || typeof callee !== "object" || !("type" in callee)) return false;
11
- if (callee.type !== "MemberExpression") return false;
12
- const prop = callee["property"];
13
- if (prop == null || typeof prop !== "object" || !("type" in prop)) return false;
14
- return prop.type === "Identifier" && "name" in prop && prop.name === "pipe";
15
- };
16
- const noUnnecessaryPipeChain = define({
17
- name: "no-unnecessary-pipe-chain",
18
- meta: meta({
19
- type: "suggestion",
20
- description: "Avoid chaining .pipe().pipe(). Merge into a single .pipe() call."
21
- }),
22
- create: function* () {
23
- const ctx = yield* RuleContext;
24
- return { CallExpression: (node) => {
25
- if (!isMethodPipe(node)) return Effect.void;
26
- const obj = node["callee"]["object"];
27
- if (obj != null && typeof obj === "object" && isMethodPipe(obj)) return ctx.report(make({
28
- node,
29
- message: "Unnecessary .pipe() chain. Merge into a single .pipe() call."
30
- }));
31
- return Effect.void;
32
- } };
33
- }
34
- });
35
- //#endregion
36
- export { noUnnecessaryPipeChain };
@@ -1,6 +0,0 @@
1
- import * as _$_oxlint_plugins0 from "@oxlint/plugins";
2
-
3
- //#region src/rules/no-unnecessary-pipe.d.ts
4
- declare const noUnnecessaryPipe: _$_oxlint_plugins0.CreateRule;
5
- //#endregion
6
- export { noUnnecessaryPipe };
@@ -1,29 +0,0 @@
1
- import { calleeName } from "../vendor/effect-oxlint/AST.js";
2
- import { make } from "../vendor/effect-oxlint/Diagnostic.js";
3
- import { RuleContext } from "../vendor/effect-oxlint/RuleContext.js";
4
- import { define, meta } from "../vendor/effect-oxlint/Rule.js";
5
- import "../vendor/effect-oxlint/index.js";
6
- import * as Option from "effect/Option";
7
- import * as Effect from "effect/Effect";
8
- //#region src/rules/no-unnecessary-pipe.ts
9
- const noUnnecessaryPipe = define({
10
- name: "no-unnecessary-pipe",
11
- meta: meta({
12
- type: "suggestion",
13
- description: "Unnecessary pipe() with single argument. Use the value directly.",
14
- fixable: "code"
15
- }),
16
- create: function* () {
17
- const ctx = yield* RuleContext;
18
- return { CallExpression: (node) => {
19
- if (Option.getOrUndefined(calleeName(node)) !== "pipe") return Effect.void;
20
- if ("arguments" in node && Array.isArray(node.arguments) && node.arguments.length === 1) return ctx.report(make({
21
- node,
22
- message: "Unnecessary pipe() with single argument. Use the value directly."
23
- }));
24
- return Effect.void;
25
- } };
26
- }
27
- });
28
- //#endregion
29
- export { noUnnecessaryPipe };