oxlint-plugin-effect 0.2.0 → 0.2.1
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/_virtual/_rolldown/runtime.js +13 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/plugin.d.ts +5 -0
- package/dist/plugin.js +18 -0
- package/dist/presets/core.d.ts +43 -0
- package/dist/presets/core.js +43 -0
- package/dist/presets/effect-native.d.ts +28 -0
- package/dist/presets/effect-native.js +28 -0
- package/dist/presets/full.d.ts +60 -0
- package/dist/presets/full.js +60 -0
- package/dist/presets/functional.d.ts +21 -0
- package/dist/presets/functional.js +21 -0
- package/dist/presets/index.d.ts +13 -0
- package/dist/presets/index.js +18 -0
- package/dist/presets/strict.d.ts +69 -0
- package/dist/presets/strict.js +69 -0
- package/dist/presets/v3.d.ts +15 -0
- package/dist/presets/v3.js +15 -0
- package/dist/rules/_effect-context.d.ts +19 -0
- package/dist/rules/_effect-context.js +22 -0
- package/dist/rules/index.d.ts +66 -0
- package/dist/rules/index.js +124 -0
- package/dist/rules/no-arrow-ladder.d.ts +6 -0
- package/dist/rules/no-arrow-ladder.js +61 -0
- package/dist/rules/no-async-function.d.ts +6 -0
- package/dist/rules/no-async-function.js +46 -0
- package/dist/rules/no-catch-all-to-map-error.d.ts +6 -0
- package/dist/rules/no-catch-all-to-map-error.js +67 -0
- package/dist/rules/no-effect-as.d.ts +6 -0
- package/dist/rules/no-effect-as.js +16 -0
- package/dist/rules/no-effect-async.d.ts +6 -0
- package/dist/rules/no-effect-async.js +16 -0
- package/dist/rules/no-effect-bind.d.ts +6 -0
- package/dist/rules/no-effect-bind.js +16 -0
- package/dist/rules/no-effect-do.d.ts +6 -0
- package/dist/rules/no-effect-do.js +16 -0
- package/dist/rules/no-effect-fn-generator.d.ts +6 -0
- package/dist/rules/no-effect-fn-generator.js +30 -0
- package/dist/rules/no-effect-gen-adapter.d.ts +6 -0
- package/dist/rules/no-effect-gen-adapter.js +30 -0
- package/dist/rules/no-effect-map-flatten.d.ts +6 -0
- package/dist/rules/no-effect-map-flatten.js +53 -0
- package/dist/rules/no-effect-map-void.d.ts +6 -0
- package/dist/rules/no-effect-map-void.js +40 -0
- package/dist/rules/no-effect-never.d.ts +6 -0
- package/dist/rules/no-effect-never.js +16 -0
- package/dist/rules/no-effect-orElse-ladder.d.ts +6 -0
- package/dist/rules/no-effect-orElse-ladder.js +53 -0
- package/dist/rules/no-effect-succeed-string.d.ts +6 -0
- package/dist/rules/no-effect-succeed-string.js +30 -0
- package/dist/rules/no-effect-succeed-variable.d.ts +6 -0
- package/dist/rules/no-effect-succeed-variable.js +30 -0
- package/dist/rules/no-effect-succeed-void.d.ts +6 -0
- package/dist/rules/no-effect-succeed-void.js +33 -0
- package/dist/rules/no-effect-sync-console.d.ts +6 -0
- package/dist/rules/no-effect-sync-console.js +63 -0
- package/dist/rules/no-effect-sync-wrapper.d.ts +6 -0
- package/dist/rules/no-effect-sync-wrapper.js +37 -0
- package/dist/rules/no-effect-type-alias.d.ts +6 -0
- package/dist/rules/no-effect-type-alias.js +52 -0
- package/dist/rules/no-effect-wrapper-alias.d.ts +6 -0
- package/dist/rules/no-effect-wrapper-alias.js +69 -0
- package/dist/rules/no-extends-native-error.d.ts +6 -0
- package/dist/rules/no-extends-native-error.js +41 -0
- package/dist/rules/no-flatmap-ladder.d.ts +6 -0
- package/dist/rules/no-flatmap-ladder.js +48 -0
- package/dist/rules/no-fromnullable-coalesce.d.ts +6 -0
- package/dist/rules/no-fromnullable-coalesce.js +36 -0
- package/dist/rules/no-global-error-in-catch.d.ts +6 -0
- package/dist/rules/no-global-error-in-catch.js +75 -0
- package/dist/rules/no-global-error-in-failure.d.ts +6 -0
- package/dist/rules/no-global-error-in-failure.js +54 -0
- package/dist/rules/no-globals.d.ts +6 -0
- package/dist/rules/no-globals.js +164 -0
- package/dist/rules/no-if-statement.d.ts +6 -0
- package/dist/rules/no-if-statement.js +18 -0
- package/dist/rules/no-iife-wrapper.d.ts +6 -0
- package/dist/rules/no-iife-wrapper.js +37 -0
- package/dist/rules/no-inline-provide.d.ts +6 -0
- package/dist/rules/no-inline-provide.js +31 -0
- package/dist/rules/no-instanceof-schema.d.ts +6 -0
- package/dist/rules/no-instanceof-schema.js +35 -0
- package/dist/rules/no-manual-effect-channels.d.ts +6 -0
- package/dist/rules/no-manual-effect-channels.js +40 -0
- package/dist/rules/no-match-effect-branch.d.ts +6 -0
- package/dist/rules/no-match-effect-branch.js +64 -0
- package/dist/rules/no-match-void-branch.d.ts +6 -0
- package/dist/rules/no-match-void-branch.js +50 -0
- package/dist/rules/no-multiple-effect-provide.d.ts +6 -0
- package/dist/rules/no-multiple-effect-provide.js +45 -0
- package/dist/rules/no-nested-effect-call.d.ts +6 -0
- package/dist/rules/no-nested-effect-call.js +97 -0
- package/dist/rules/no-nested-effect-gen.d.ts +6 -0
- package/dist/rules/no-nested-effect-gen.js +46 -0
- package/dist/rules/no-nested-pipe.d.ts +6 -0
- package/dist/rules/no-nested-pipe.js +38 -0
- package/dist/rules/no-new-error.d.ts +6 -0
- package/dist/rules/no-new-error.js +39 -0
- package/dist/rules/no-new-promise.d.ts +6 -0
- package/dist/rules/no-new-promise.js +38 -0
- package/dist/rules/no-node-builtin-import.d.ts +6 -0
- package/dist/rules/no-node-builtin-import.js +61 -0
- package/dist/rules/no-option-as.d.ts +6 -0
- package/dist/rules/no-option-as.js +16 -0
- package/dist/rules/no-option-boolean-normalization.d.ts +6 -0
- package/dist/rules/no-option-boolean-normalization.js +50 -0
- package/dist/rules/no-positional-log-error.d.ts +6 -0
- package/dist/rules/no-positional-log-error.js +52 -0
- package/dist/rules/no-redundant-schema-tag-identifier.d.ts +6 -0
- package/dist/rules/no-redundant-schema-tag-identifier.js +46 -0
- package/dist/rules/no-return-in-arrow.d.ts +6 -0
- package/dist/rules/no-return-in-arrow.js +41 -0
- package/dist/rules/no-return-nullish.d.ts +6 -0
- package/dist/rules/no-return-nullish.js +47 -0
- package/dist/rules/no-run-in-effect-gen.d.ts +6 -0
- package/dist/rules/no-run-in-effect-gen.js +48 -0
- package/dist/rules/no-runtime-run-fork.d.ts +6 -0
- package/dist/rules/no-runtime-run-fork.js +19 -0
- package/dist/rules/no-schema-struct-with-tag.d.ts +6 -0
- package/dist/rules/no-schema-struct-with-tag.js +48 -0
- package/dist/rules/no-schema-union-of-literals.d.ts +6 -0
- package/dist/rules/no-schema-union-of-literals.js +35 -0
- package/dist/rules/no-string-sentinel-const.d.ts +6 -0
- package/dist/rules/no-string-sentinel-const.js +38 -0
- package/dist/rules/no-switch-statement.d.ts +6 -0
- package/dist/rules/no-switch-statement.js +16 -0
- package/dist/rules/no-ternary.d.ts +6 -0
- package/dist/rules/no-ternary.js +30 -0
- package/dist/rules/no-throw-statement.d.ts +6 -0
- package/dist/rules/no-throw-statement.js +34 -0
- package/dist/rules/no-try-catch.d.ts +6 -0
- package/dist/rules/no-try-catch.js +34 -0
- package/dist/rules/no-unnecessary-arrow-block.d.ts +6 -0
- package/dist/rules/no-unnecessary-arrow-block.js +34 -0
- package/dist/rules/no-unnecessary-effect-gen.d.ts +6 -0
- package/dist/rules/no-unnecessary-effect-gen.js +35 -0
- package/dist/rules/no-unnecessary-pipe-chain.d.ts +6 -0
- package/dist/rules/no-unnecessary-pipe-chain.js +36 -0
- package/dist/rules/no-unnecessary-pipe.d.ts +6 -0
- package/dist/rules/no-unnecessary-pipe.js +29 -0
- package/dist/vendor/effect-oxlint/AST.d.ts +199 -0
- package/dist/vendor/effect-oxlint/AST.js +214 -0
- package/dist/vendor/effect-oxlint/Comment.d.ts +55 -0
- package/dist/vendor/effect-oxlint/Comment.js +67 -0
- package/dist/vendor/effect-oxlint/Diagnostic.d.ts +86 -0
- package/dist/vendor/effect-oxlint/Diagnostic.js +115 -0
- package/dist/vendor/effect-oxlint/Plugin.d.ts +38 -0
- package/dist/vendor/effect-oxlint/Plugin.js +45 -0
- package/dist/vendor/effect-oxlint/Rule.d.ts +218 -0
- package/dist/vendor/effect-oxlint/Rule.js +309 -0
- package/dist/vendor/effect-oxlint/RuleContext.d.ts +77 -0
- package/dist/vendor/effect-oxlint/RuleContext.js +74 -0
- package/dist/vendor/effect-oxlint/Scope.d.ts +100 -0
- package/dist/vendor/effect-oxlint/Scope.js +110 -0
- package/dist/vendor/effect-oxlint/SourceCode.d.ts +180 -0
- package/dist/vendor/effect-oxlint/SourceCode.js +203 -0
- package/dist/vendor/effect-oxlint/Testing.d.ts +510 -0
- package/dist/vendor/effect-oxlint/Testing.js +963 -0
- package/dist/vendor/effect-oxlint/Token.d.ts +98 -0
- package/dist/vendor/effect-oxlint/Token.js +103 -0
- package/dist/vendor/effect-oxlint/Visitor.d.ts +166 -0
- package/dist/vendor/effect-oxlint/Visitor.js +138 -0
- package/dist/vendor/effect-oxlint/index.d.ts +13 -0
- package/dist/vendor/effect-oxlint/index.js +12 -0
- package/package.json +24 -5
- package/.effect-lsp.json +0 -60
- package/.oxlintrc.json +0 -33
- package/CHANGELOG.md +0 -55
- package/scripts/add-rule.ts +0 -87
- package/scripts/codegen.ts +0 -108
- package/src/index.ts +0 -9
- package/src/plugin.ts +0 -16
- package/src/presets/core.ts +0 -47
- package/src/presets/effect-native.ts +0 -34
- package/src/presets/full.ts +0 -70
- package/src/presets/functional.ts +0 -18
- package/src/presets/index.ts +0 -5
- package/src/presets/strict.ts +0 -77
- package/src/rules/_effect-context.ts +0 -28
- package/src/rules/index.ts +0 -72
- package/src/rules/no-arrow-ladder.ts +0 -70
- package/src/rules/no-async-function.ts +0 -47
- package/src/rules/no-catch-all-to-map-error.ts +0 -90
- package/src/rules/no-effect-as.ts +0 -14
- package/src/rules/no-effect-async.ts +0 -14
- package/src/rules/no-effect-bind.ts +0 -13
- package/src/rules/no-effect-do.ts +0 -14
- package/src/rules/no-effect-fn-generator.ts +0 -58
- package/src/rules/no-effect-gen-adapter.ts +0 -51
- package/src/rules/no-effect-map-flatten.ts +0 -82
- package/src/rules/no-effect-map-void.ts +0 -80
- package/src/rules/no-effect-never.ts +0 -14
- package/src/rules/no-effect-orElse-ladder.ts +0 -79
- package/src/rules/no-effect-succeed-string.ts +0 -52
- package/src/rules/no-effect-succeed-variable.ts +0 -50
- package/src/rules/no-effect-succeed-void.ts +0 -63
- package/src/rules/no-effect-sync-console.ts +0 -91
- package/src/rules/no-effect-sync-wrapper.ts +0 -67
- package/src/rules/no-effect-type-alias.ts +0 -71
- package/src/rules/no-effect-wrapper-alias.ts +0 -95
- package/src/rules/no-extends-native-error.ts +0 -54
- package/src/rules/no-flatmap-ladder.ts +0 -77
- package/src/rules/no-fromnullable-coalesce.ts +0 -62
- package/src/rules/no-global-error-in-catch.ts +0 -104
- package/src/rules/no-global-error-in-failure.ts +0 -83
- package/src/rules/no-globals.ts +0 -178
- package/src/rules/no-if-statement.ts +0 -16
- package/src/rules/no-iife-wrapper.ts +0 -51
- package/src/rules/no-inline-provide.ts +0 -41
- package/src/rules/no-instanceof-schema.ts +0 -42
- package/src/rules/no-manual-effect-channels.ts +0 -58
- package/src/rules/no-match-effect-branch.ts +0 -82
- package/src/rules/no-match-void-branch.ts +0 -72
- package/src/rules/no-multiple-effect-provide.ts +0 -75
- package/src/rules/no-nested-effect-call.ts +0 -57
- package/src/rules/no-nested-effect-gen.ts +0 -43
- package/src/rules/no-nested-pipe.ts +0 -73
- package/src/rules/no-new-error.ts +0 -53
- package/src/rules/no-new-promise.ts +0 -50
- package/src/rules/no-node-builtin-import.ts +0 -68
- package/src/rules/no-option-as.ts +0 -13
- package/src/rules/no-option-boolean-normalization.ts +0 -88
- package/src/rules/no-positional-log-error.ts +0 -76
- package/src/rules/no-redundant-schema-tag-identifier.ts +0 -62
- package/src/rules/no-return-in-arrow.ts +0 -76
- package/src/rules/no-return-nullish.ts +0 -80
- package/src/rules/no-run-in-effect-gen.ts +0 -66
- package/src/rules/no-runtime-run-fork.ts +0 -14
- package/src/rules/no-schema-struct-with-tag.ts +0 -64
- package/src/rules/no-schema-union-of-literals.ts +0 -48
- package/src/rules/no-string-sentinel-const.ts +0 -49
- package/src/rules/no-switch-statement.ts +0 -13
- package/src/rules/no-ternary.ts +0 -30
- package/src/rules/no-throw-statement.ts +0 -39
- package/src/rules/no-try-catch.ts +0 -39
- package/src/rules/no-unnecessary-arrow-block.ts +0 -51
- package/src/rules/no-unnecessary-effect-gen.ts +0 -83
- package/src/rules/no-unnecessary-pipe-chain.ts +0 -47
- package/src/rules/no-unnecessary-pipe.ts +0 -45
- package/src/vendor/effect-oxlint/AST.ts +0 -516
- package/src/vendor/effect-oxlint/Comment.ts +0 -86
- package/src/vendor/effect-oxlint/Diagnostic.ts +0 -199
- package/src/vendor/effect-oxlint/Plugin.ts +0 -71
- package/src/vendor/effect-oxlint/Rule.ts +0 -548
- package/src/vendor/effect-oxlint/RuleContext.ts +0 -144
- package/src/vendor/effect-oxlint/Scope.ts +0 -177
- package/src/vendor/effect-oxlint/SourceCode.ts +0 -377
- package/src/vendor/effect-oxlint/Testing.ts +0 -1227
- package/src/vendor/effect-oxlint/Token.ts +0 -131
- package/src/vendor/effect-oxlint/Visitor.ts +0 -287
- package/src/vendor/effect-oxlint/index.ts +0 -88
- package/tests/ban-rules.test.ts +0 -68
- package/tests/context-rules.test.ts +0 -263
- package/tests/pattern-rules.test.ts +0 -247
- package/tsconfig.json +0 -15
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { noEffectAs } from "./no-effect-as.js";
|
|
2
|
+
import { noEffectAsync } from "./no-effect-async.js";
|
|
3
|
+
import { noEffectBind } from "./no-effect-bind.js";
|
|
4
|
+
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
|
+
import { noAsyncFunction } from "./no-async-function.js";
|
|
12
|
+
import { noCatchAllToMapError } from "./no-catch-all-to-map-error.js";
|
|
13
|
+
import { noEffectFnGenerator } from "./no-effect-fn-generator.js";
|
|
14
|
+
import { noEffectGenAdapter } from "./no-effect-gen-adapter.js";
|
|
15
|
+
import { noEffectMapFlatten } from "./no-effect-map-flatten.js";
|
|
16
|
+
import { noEffectMapVoid } from "./no-effect-map-void.js";
|
|
17
|
+
import { noEffectOrElseLadder } from "./no-effect-orElse-ladder.js";
|
|
18
|
+
import { noEffectSucceedString } from "./no-effect-succeed-string.js";
|
|
19
|
+
import { noEffectSucceedVariable } from "./no-effect-succeed-variable.js";
|
|
20
|
+
import { noEffectSucceedVoid } from "./no-effect-succeed-void.js";
|
|
21
|
+
import { noEffectSyncConsole } from "./no-effect-sync-console.js";
|
|
22
|
+
import { noEffectSyncWrapper } from "./no-effect-sync-wrapper.js";
|
|
23
|
+
import { noEffectTypeAlias } from "./no-effect-type-alias.js";
|
|
24
|
+
import { noEffectWrapperAlias } from "./no-effect-wrapper-alias.js";
|
|
25
|
+
import { noExtendsNativeError } from "./no-extends-native-error.js";
|
|
26
|
+
import { noFlatmapLadder } from "./no-flatmap-ladder.js";
|
|
27
|
+
import { noFromNullableCoalesce } from "./no-fromnullable-coalesce.js";
|
|
28
|
+
import { noGlobalErrorInCatch } from "./no-global-error-in-catch.js";
|
|
29
|
+
import { noGlobalErrorInFailure } from "./no-global-error-in-failure.js";
|
|
30
|
+
import { noIifeWrapper } from "./no-iife-wrapper.js";
|
|
31
|
+
import { noInstanceofSchema } from "./no-instanceof-schema.js";
|
|
32
|
+
import { noManualEffectChannels } from "./no-manual-effect-channels.js";
|
|
33
|
+
import { noMatchEffectBranch } from "./no-match-effect-branch.js";
|
|
34
|
+
import { noMatchVoidBranch } from "./no-match-void-branch.js";
|
|
35
|
+
import { noMultipleEffectProvide } from "./no-multiple-effect-provide.js";
|
|
36
|
+
import { noNestedEffectCall } from "./no-nested-effect-call.js";
|
|
37
|
+
import { noNestedEffectGen } from "./no-nested-effect-gen.js";
|
|
38
|
+
import { noNestedPipe } from "./no-nested-pipe.js";
|
|
39
|
+
import { noNodeBuiltinImport } from "./no-node-builtin-import.js";
|
|
40
|
+
import { noOptionBooleanNormalization } from "./no-option-boolean-normalization.js";
|
|
41
|
+
import { noPositionalLogError } from "./no-positional-log-error.js";
|
|
42
|
+
import { noRedundantSchemaTagIdentifier } from "./no-redundant-schema-tag-identifier.js";
|
|
43
|
+
import { noReturnInArrow } from "./no-return-in-arrow.js";
|
|
44
|
+
import { noSchemaStructWithTag } from "./no-schema-struct-with-tag.js";
|
|
45
|
+
import { noSchemaUnionOfLiterals } from "./no-schema-union-of-literals.js";
|
|
46
|
+
import { noStringSentinelConst } from "./no-string-sentinel-const.js";
|
|
47
|
+
import { noTernary } from "./no-ternary.js";
|
|
48
|
+
import { noUnnecessaryArrowBlock } from "./no-unnecessary-arrow-block.js";
|
|
49
|
+
import { noUnnecessaryEffectGen } from "./no-unnecessary-effect-gen.js";
|
|
50
|
+
import { noUnnecessaryPipeChain } from "./no-unnecessary-pipe-chain.js";
|
|
51
|
+
import { noUnnecessaryPipe } from "./no-unnecessary-pipe.js";
|
|
52
|
+
import { noGlobals } from "./no-globals.js";
|
|
53
|
+
import { noInlineProvide } from "./no-inline-provide.js";
|
|
54
|
+
import { noNewError } from "./no-new-error.js";
|
|
55
|
+
import { noNewPromise } from "./no-new-promise.js";
|
|
56
|
+
import { noReturnNullish } from "./no-return-nullish.js";
|
|
57
|
+
import { noRunInEffectGen } from "./no-run-in-effect-gen.js";
|
|
58
|
+
import { noThrowStatement } from "./no-throw-statement.js";
|
|
59
|
+
import { noTryCatch } from "./no-try-catch.js";
|
|
60
|
+
|
|
61
|
+
//#region src/rules/index.d.ts
|
|
62
|
+
declare namespace index_d_exports {
|
|
63
|
+
export { noArrowLadder, noAsyncFunction, noCatchAllToMapError, noEffectAs, noEffectAsync, noEffectBind, noEffectDo, noEffectFnGenerator, noEffectGenAdapter, noEffectMapFlatten, noEffectMapVoid, noEffectNever, noEffectOrElseLadder, noEffectSucceedString, noEffectSucceedVariable, noEffectSucceedVoid, noEffectSyncConsole, noEffectSyncWrapper, noEffectTypeAlias, noEffectWrapperAlias, noExtendsNativeError, noFlatmapLadder, noFromNullableCoalesce, noGlobalErrorInCatch, noGlobalErrorInFailure, noGlobals, noIfStatement, noIifeWrapper, noInlineProvide, noInstanceofSchema, noManualEffectChannels, noMatchEffectBranch, noMatchVoidBranch, noMultipleEffectProvide, noNestedEffectCall, noNestedEffectGen, noNestedPipe, noNewError, noNewPromise, noNodeBuiltinImport, noOptionAs, noOptionBooleanNormalization, noPositionalLogError, noRedundantSchemaTagIdentifier, noReturnInArrow, noReturnNullish, noRunInEffectGen, noRuntimeRunFork, noSchemaStructWithTag, noSchemaUnionOfLiterals, noStringSentinelConst, noSwitchStatement, noTernary, noThrowStatement, noTryCatch, noUnnecessaryArrowBlock, noUnnecessaryEffectGen, noUnnecessaryPipe, noUnnecessaryPipeChain };
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { index_d_exports, noArrowLadder, noAsyncFunction, noCatchAllToMapError, noEffectAs, noEffectAsync, noEffectBind, noEffectDo, noEffectFnGenerator, noEffectGenAdapter, noEffectMapFlatten, noEffectMapVoid, noEffectNever, noEffectOrElseLadder, noEffectSucceedString, noEffectSucceedVariable, noEffectSucceedVoid, noEffectSyncConsole, noEffectSyncWrapper, noEffectTypeAlias, noEffectWrapperAlias, noExtendsNativeError, noFlatmapLadder, noFromNullableCoalesce, noGlobalErrorInCatch, noGlobalErrorInFailure, noGlobals, noIfStatement, noIifeWrapper, noInlineProvide, noInstanceofSchema, noManualEffectChannels, noMatchEffectBranch, noMatchVoidBranch, noMultipleEffectProvide, noNestedEffectCall, noNestedEffectGen, noNestedPipe, noNewError, noNewPromise, noNodeBuiltinImport, noOptionAs, noOptionBooleanNormalization, noPositionalLogError, noRedundantSchemaTagIdentifier, noReturnInArrow, noReturnNullish, noRunInEffectGen, noRuntimeRunFork, noSchemaStructWithTag, noSchemaUnionOfLiterals, noStringSentinelConst, noSwitchStatement, noTernary, noThrowStatement, noTryCatch, noUnnecessaryArrowBlock, noUnnecessaryEffectGen, noUnnecessaryPipe, noUnnecessaryPipeChain };
|
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
import { noEffectBind } from "./no-effect-bind.js";
|
|
5
|
+
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
|
+
import { noAsyncFunction } from "./no-async-function.js";
|
|
13
|
+
import { noCatchAllToMapError } from "./no-catch-all-to-map-error.js";
|
|
14
|
+
import { noEffectFnGenerator } from "./no-effect-fn-generator.js";
|
|
15
|
+
import { noEffectGenAdapter } from "./no-effect-gen-adapter.js";
|
|
16
|
+
import { noEffectMapFlatten } from "./no-effect-map-flatten.js";
|
|
17
|
+
import { noEffectMapVoid } from "./no-effect-map-void.js";
|
|
18
|
+
import { noEffectOrElseLadder } from "./no-effect-orElse-ladder.js";
|
|
19
|
+
import { noEffectSucceedString } from "./no-effect-succeed-string.js";
|
|
20
|
+
import { noEffectSucceedVariable } from "./no-effect-succeed-variable.js";
|
|
21
|
+
import { noEffectSucceedVoid } from "./no-effect-succeed-void.js";
|
|
22
|
+
import { noEffectSyncConsole } from "./no-effect-sync-console.js";
|
|
23
|
+
import { noEffectSyncWrapper } from "./no-effect-sync-wrapper.js";
|
|
24
|
+
import { noEffectTypeAlias } from "./no-effect-type-alias.js";
|
|
25
|
+
import { noEffectWrapperAlias } from "./no-effect-wrapper-alias.js";
|
|
26
|
+
import { noExtendsNativeError } from "./no-extends-native-error.js";
|
|
27
|
+
import { noFlatmapLadder } from "./no-flatmap-ladder.js";
|
|
28
|
+
import { noFromNullableCoalesce } from "./no-fromnullable-coalesce.js";
|
|
29
|
+
import { noGlobalErrorInCatch } from "./no-global-error-in-catch.js";
|
|
30
|
+
import { noGlobalErrorInFailure } from "./no-global-error-in-failure.js";
|
|
31
|
+
import { noIifeWrapper } from "./no-iife-wrapper.js";
|
|
32
|
+
import { noInstanceofSchema } from "./no-instanceof-schema.js";
|
|
33
|
+
import { noManualEffectChannels } from "./no-manual-effect-channels.js";
|
|
34
|
+
import { noMatchEffectBranch } from "./no-match-effect-branch.js";
|
|
35
|
+
import { noMatchVoidBranch } from "./no-match-void-branch.js";
|
|
36
|
+
import { noMultipleEffectProvide } from "./no-multiple-effect-provide.js";
|
|
37
|
+
import { noNestedEffectCall } from "./no-nested-effect-call.js";
|
|
38
|
+
import { noNestedEffectGen } from "./no-nested-effect-gen.js";
|
|
39
|
+
import { noNestedPipe } from "./no-nested-pipe.js";
|
|
40
|
+
import { noNodeBuiltinImport } from "./no-node-builtin-import.js";
|
|
41
|
+
import { noOptionBooleanNormalization } from "./no-option-boolean-normalization.js";
|
|
42
|
+
import { noPositionalLogError } from "./no-positional-log-error.js";
|
|
43
|
+
import { noRedundantSchemaTagIdentifier } from "./no-redundant-schema-tag-identifier.js";
|
|
44
|
+
import { noReturnInArrow } from "./no-return-in-arrow.js";
|
|
45
|
+
import { noSchemaStructWithTag } from "./no-schema-struct-with-tag.js";
|
|
46
|
+
import { noSchemaUnionOfLiterals } from "./no-schema-union-of-literals.js";
|
|
47
|
+
import { noStringSentinelConst } from "./no-string-sentinel-const.js";
|
|
48
|
+
import { noTernary } from "./no-ternary.js";
|
|
49
|
+
import { noUnnecessaryArrowBlock } from "./no-unnecessary-arrow-block.js";
|
|
50
|
+
import { noUnnecessaryEffectGen } from "./no-unnecessary-effect-gen.js";
|
|
51
|
+
import { noUnnecessaryPipeChain } from "./no-unnecessary-pipe-chain.js";
|
|
52
|
+
import { noUnnecessaryPipe } from "./no-unnecessary-pipe.js";
|
|
53
|
+
import { noGlobals } from "./no-globals.js";
|
|
54
|
+
import { noInlineProvide } from "./no-inline-provide.js";
|
|
55
|
+
import { noNewError } from "./no-new-error.js";
|
|
56
|
+
import { noNewPromise } from "./no-new-promise.js";
|
|
57
|
+
import { noReturnNullish } from "./no-return-nullish.js";
|
|
58
|
+
import { noRunInEffectGen } from "./no-run-in-effect-gen.js";
|
|
59
|
+
import { noThrowStatement } from "./no-throw-statement.js";
|
|
60
|
+
import { noTryCatch } from "./no-try-catch.js";
|
|
61
|
+
//#region src/rules/index.ts
|
|
62
|
+
var rules_exports = /* @__PURE__ */ __exportAll({
|
|
63
|
+
noArrowLadder: () => noArrowLadder,
|
|
64
|
+
noAsyncFunction: () => noAsyncFunction,
|
|
65
|
+
noCatchAllToMapError: () => noCatchAllToMapError,
|
|
66
|
+
noEffectAs: () => noEffectAs,
|
|
67
|
+
noEffectAsync: () => noEffectAsync,
|
|
68
|
+
noEffectBind: () => noEffectBind,
|
|
69
|
+
noEffectDo: () => noEffectDo,
|
|
70
|
+
noEffectFnGenerator: () => noEffectFnGenerator,
|
|
71
|
+
noEffectGenAdapter: () => noEffectGenAdapter,
|
|
72
|
+
noEffectMapFlatten: () => noEffectMapFlatten,
|
|
73
|
+
noEffectMapVoid: () => noEffectMapVoid,
|
|
74
|
+
noEffectNever: () => noEffectNever,
|
|
75
|
+
noEffectOrElseLadder: () => noEffectOrElseLadder,
|
|
76
|
+
noEffectSucceedString: () => noEffectSucceedString,
|
|
77
|
+
noEffectSucceedVariable: () => noEffectSucceedVariable,
|
|
78
|
+
noEffectSucceedVoid: () => noEffectSucceedVoid,
|
|
79
|
+
noEffectSyncConsole: () => noEffectSyncConsole,
|
|
80
|
+
noEffectSyncWrapper: () => noEffectSyncWrapper,
|
|
81
|
+
noEffectTypeAlias: () => noEffectTypeAlias,
|
|
82
|
+
noEffectWrapperAlias: () => noEffectWrapperAlias,
|
|
83
|
+
noExtendsNativeError: () => noExtendsNativeError,
|
|
84
|
+
noFlatmapLadder: () => noFlatmapLadder,
|
|
85
|
+
noFromNullableCoalesce: () => noFromNullableCoalesce,
|
|
86
|
+
noGlobalErrorInCatch: () => noGlobalErrorInCatch,
|
|
87
|
+
noGlobalErrorInFailure: () => noGlobalErrorInFailure,
|
|
88
|
+
noGlobals: () => noGlobals,
|
|
89
|
+
noIfStatement: () => noIfStatement,
|
|
90
|
+
noIifeWrapper: () => noIifeWrapper,
|
|
91
|
+
noInlineProvide: () => noInlineProvide,
|
|
92
|
+
noInstanceofSchema: () => noInstanceofSchema,
|
|
93
|
+
noManualEffectChannels: () => noManualEffectChannels,
|
|
94
|
+
noMatchEffectBranch: () => noMatchEffectBranch,
|
|
95
|
+
noMatchVoidBranch: () => noMatchVoidBranch,
|
|
96
|
+
noMultipleEffectProvide: () => noMultipleEffectProvide,
|
|
97
|
+
noNestedEffectCall: () => noNestedEffectCall,
|
|
98
|
+
noNestedEffectGen: () => noNestedEffectGen,
|
|
99
|
+
noNestedPipe: () => noNestedPipe,
|
|
100
|
+
noNewError: () => noNewError,
|
|
101
|
+
noNewPromise: () => noNewPromise,
|
|
102
|
+
noNodeBuiltinImport: () => noNodeBuiltinImport,
|
|
103
|
+
noOptionAs: () => noOptionAs,
|
|
104
|
+
noOptionBooleanNormalization: () => noOptionBooleanNormalization,
|
|
105
|
+
noPositionalLogError: () => noPositionalLogError,
|
|
106
|
+
noRedundantSchemaTagIdentifier: () => noRedundantSchemaTagIdentifier,
|
|
107
|
+
noReturnInArrow: () => noReturnInArrow,
|
|
108
|
+
noReturnNullish: () => noReturnNullish,
|
|
109
|
+
noRunInEffectGen: () => noRunInEffectGen,
|
|
110
|
+
noRuntimeRunFork: () => noRuntimeRunFork,
|
|
111
|
+
noSchemaStructWithTag: () => noSchemaStructWithTag,
|
|
112
|
+
noSchemaUnionOfLiterals: () => noSchemaUnionOfLiterals,
|
|
113
|
+
noStringSentinelConst: () => noStringSentinelConst,
|
|
114
|
+
noSwitchStatement: () => noSwitchStatement,
|
|
115
|
+
noTernary: () => noTernary,
|
|
116
|
+
noThrowStatement: () => noThrowStatement,
|
|
117
|
+
noTryCatch: () => noTryCatch,
|
|
118
|
+
noUnnecessaryArrowBlock: () => noUnnecessaryArrowBlock,
|
|
119
|
+
noUnnecessaryEffectGen: () => noUnnecessaryEffectGen,
|
|
120
|
+
noUnnecessaryPipe: () => noUnnecessaryPipe,
|
|
121
|
+
noUnnecessaryPipeChain: () => noUnnecessaryPipeChain
|
|
122
|
+
});
|
|
123
|
+
//#endregion
|
|
124
|
+
export { noArrowLadder, noAsyncFunction, noCatchAllToMapError, noEffectAs, noEffectAsync, noEffectBind, noEffectDo, noEffectFnGenerator, noEffectGenAdapter, noEffectMapFlatten, noEffectMapVoid, noEffectNever, noEffectOrElseLadder, noEffectSucceedString, noEffectSucceedVariable, noEffectSucceedVoid, noEffectSyncConsole, noEffectSyncWrapper, noEffectTypeAlias, noEffectWrapperAlias, noExtendsNativeError, noFlatmapLadder, noFromNullableCoalesce, noGlobalErrorInCatch, noGlobalErrorInFailure, noGlobals, noIfStatement, noIifeWrapper, noInlineProvide, noInstanceofSchema, noManualEffectChannels, noMatchEffectBranch, noMatchVoidBranch, noMultipleEffectProvide, noNestedEffectCall, noNestedEffectGen, noNestedPipe, noNewError, noNewPromise, noNodeBuiltinImport, noOptionAs, noOptionBooleanNormalization, noPositionalLogError, noRedundantSchemaTagIdentifier, noReturnInArrow, noReturnNullish, noRunInEffectGen, noRuntimeRunFork, noSchemaStructWithTag, noSchemaUnionOfLiterals, noStringSentinelConst, noSwitchStatement, noTernary, noThrowStatement, noTryCatch, noUnnecessaryArrowBlock, noUnnecessaryEffectGen, noUnnecessaryPipe, noUnnecessaryPipeChain, rules_exports };
|
|
@@ -0,0 +1,61 @@
|
|
|
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-arrow-ladder.ts
|
|
7
|
+
/**
|
|
8
|
+
* Ban nested IIFE chains — `((x) => ((y) => ...)(arg2))(arg1)`.
|
|
9
|
+
*
|
|
10
|
+
* Use named const bindings + flat pipeline.
|
|
11
|
+
*
|
|
12
|
+
* Source: biome-effect-linting-rules/no-arrow-ladder
|
|
13
|
+
*/
|
|
14
|
+
const isIife = (node) => {
|
|
15
|
+
if (node == null || typeof node !== "object") return false;
|
|
16
|
+
const n = node;
|
|
17
|
+
if (n["type"] !== "CallExpression") return false;
|
|
18
|
+
const callee = n["callee"];
|
|
19
|
+
if (callee == null || typeof callee !== "object") return false;
|
|
20
|
+
const c = callee;
|
|
21
|
+
return c["type"] === "ArrowFunctionExpression" || c["type"] === "FunctionExpression";
|
|
22
|
+
};
|
|
23
|
+
const containsIife = (node) => {
|
|
24
|
+
if (node == null || typeof node !== "object") return false;
|
|
25
|
+
const n = node;
|
|
26
|
+
if (isIife(n)) return true;
|
|
27
|
+
if ("body" in n) {
|
|
28
|
+
if (Array.isArray(n["body"])) {
|
|
29
|
+
for (const child of n["body"]) if (containsIife(child)) return true;
|
|
30
|
+
} else if (containsIife(n["body"])) return true;
|
|
31
|
+
}
|
|
32
|
+
if ("argument" in n && containsIife(n["argument"])) return true;
|
|
33
|
+
if ("arguments" in n && Array.isArray(n["arguments"])) {
|
|
34
|
+
for (const arg of n["arguments"]) if (containsIife(arg)) return true;
|
|
35
|
+
}
|
|
36
|
+
if ("expression" in n && containsIife(n["expression"])) return true;
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
const noArrowLadder = define({
|
|
40
|
+
name: "no-arrow-ladder",
|
|
41
|
+
meta: meta({
|
|
42
|
+
type: "suggestion",
|
|
43
|
+
description: "Avoid nested IIFE chains. Use named const bindings + flat pipeline."
|
|
44
|
+
}),
|
|
45
|
+
create: function* () {
|
|
46
|
+
const ctx = yield* RuleContext;
|
|
47
|
+
return { CallExpression: (node) => {
|
|
48
|
+
if (!isIife(node)) return Effect.void;
|
|
49
|
+
const callee = node["callee"];
|
|
50
|
+
if (callee == null || typeof callee !== "object") return Effect.void;
|
|
51
|
+
const c = callee;
|
|
52
|
+
if ("body" in c && containsIife(c["body"])) return ctx.report(make({
|
|
53
|
+
node,
|
|
54
|
+
message: "Nested IIFE chain detected. Use named const bindings + flat pipeline."
|
|
55
|
+
}));
|
|
56
|
+
return Effect.void;
|
|
57
|
+
} };
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
//#endregion
|
|
61
|
+
export { noArrowLadder };
|
|
@@ -0,0 +1,46 @@
|
|
|
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-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
|
+
*/
|
|
17
|
+
const noAsyncFunction = define({
|
|
18
|
+
name: "no-async-function",
|
|
19
|
+
meta: meta({
|
|
20
|
+
type: "suggestion",
|
|
21
|
+
description: "Avoid async functions. Use Effect.promise or Effect.tryPromise."
|
|
22
|
+
}),
|
|
23
|
+
create: function* () {
|
|
24
|
+
const ctx = yield* RuleContext;
|
|
25
|
+
const report = (node) => ctx.report(make({
|
|
26
|
+
node,
|
|
27
|
+
message: "Avoid async functions. Use Effect.promise, Effect.tryPromise, or Effect.gen."
|
|
28
|
+
}));
|
|
29
|
+
return {
|
|
30
|
+
FunctionDeclaration: (node) => {
|
|
31
|
+
if ("async" in node && node.async === true) return report(node);
|
|
32
|
+
return Effect.void;
|
|
33
|
+
},
|
|
34
|
+
FunctionExpression: (node) => {
|
|
35
|
+
if ("async" in node && node.async === true) return report(node);
|
|
36
|
+
return Effect.void;
|
|
37
|
+
},
|
|
38
|
+
ArrowFunctionExpression: (node) => {
|
|
39
|
+
if ("async" in node && node.async === true) return report(node);
|
|
40
|
+
return Effect.void;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
//#endregion
|
|
46
|
+
export { noAsyncFunction };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { matchCallOf, memberNames } 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-catch-all-to-map-error.ts
|
|
9
|
+
const catchNames = new Set(["catchAll", "catchAllCause"]);
|
|
10
|
+
/**
|
|
11
|
+
* Check if a node is `Effect.fail(...)` or `Effect.failCause(...)`.
|
|
12
|
+
*/
|
|
13
|
+
const isEffectFailCall = (node) => {
|
|
14
|
+
if (node.type !== "CallExpression") return false;
|
|
15
|
+
const call = node;
|
|
16
|
+
return Option.isSome(matchCallOf(call, "Effect", "fail")) || Option.isSome(matchCallOf(call, "Effect", "failCause"));
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Check if a function body is a single `Effect.fail(...)` expression.
|
|
20
|
+
* Handles: `(e) => Effect.fail(f(e))` and `(e) => { return Effect.fail(f(e)) }`
|
|
21
|
+
*/
|
|
22
|
+
const bodyIsEffectFail = (fn) => {
|
|
23
|
+
const body = fn["body"];
|
|
24
|
+
if (body == null || typeof body !== "object") return false;
|
|
25
|
+
const bodyNode = body;
|
|
26
|
+
if (bodyNode.type !== "BlockStatement") return isEffectFailCall(bodyNode);
|
|
27
|
+
const stmts = bodyNode["body"];
|
|
28
|
+
if (!Array.isArray(stmts) || stmts.length !== 1) return false;
|
|
29
|
+
const stmt = stmts[0];
|
|
30
|
+
if (stmt.type !== "ReturnStatement") return false;
|
|
31
|
+
const arg = stmt["argument"];
|
|
32
|
+
return arg != null && typeof arg === "object" && isEffectFailCall(arg);
|
|
33
|
+
};
|
|
34
|
+
const noCatchAllToMapError = define({
|
|
35
|
+
name: "no-catch-all-to-map-error",
|
|
36
|
+
meta: meta({
|
|
37
|
+
type: "suggestion",
|
|
38
|
+
description: "Use Effect.mapError instead of Effect.catchAll(e => Effect.fail(f(e))).",
|
|
39
|
+
effectVersion: "v3"
|
|
40
|
+
}),
|
|
41
|
+
create: function* () {
|
|
42
|
+
const ctx = yield* RuleContext;
|
|
43
|
+
return { CallExpression: (node) => {
|
|
44
|
+
const call = node;
|
|
45
|
+
const names = Option.getOrUndefined(memberNames(call.callee));
|
|
46
|
+
if (names === void 0) return Effect.void;
|
|
47
|
+
const [obj, prop] = names;
|
|
48
|
+
if (obj !== "Effect" && obj !== "_") return Effect.void;
|
|
49
|
+
if (!catchNames.has(prop)) return Effect.void;
|
|
50
|
+
const args = call.arguments;
|
|
51
|
+
if (args.length === 0) return Effect.void;
|
|
52
|
+
const callback = args[args.length - 1];
|
|
53
|
+
if (callback === void 0) return Effect.void;
|
|
54
|
+
if (callback.type !== "ArrowFunctionExpression" && callback.type !== "FunctionExpression") return Effect.void;
|
|
55
|
+
if (bodyIsEffectFail(callback)) {
|
|
56
|
+
const replacement = prop === "catchAllCause" ? "mapErrorCause" : "mapError";
|
|
57
|
+
return ctx.report(make({
|
|
58
|
+
node,
|
|
59
|
+
message: `Use Effect.${replacement} instead of Effect.${prop}(e => Effect.fail(...)).`
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
return Effect.void;
|
|
63
|
+
} };
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
//#endregion
|
|
67
|
+
export { noCatchAllToMapError };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { banMember } from "../vendor/effect-oxlint/Rule.js";
|
|
2
|
+
import "../vendor/effect-oxlint/index.js";
|
|
3
|
+
//#region src/rules/no-effect-as.ts
|
|
4
|
+
/**
|
|
5
|
+
* Ban `Effect.as`.
|
|
6
|
+
*
|
|
7
|
+
* Use `Effect.map` for value mapping or `Effect.asVoid` after explicit steps.
|
|
8
|
+
*
|
|
9
|
+
* Source: biome-effect-linting-rules/no-effect-as
|
|
10
|
+
*/
|
|
11
|
+
const noEffectAs = banMember("Effect", "as", {
|
|
12
|
+
message: "Avoid Effect.as. Use Effect.map for value mapping or Effect.asVoid.",
|
|
13
|
+
meta: { type: "suggestion" }
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { noEffectAs };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { banMember } from "../vendor/effect-oxlint/Rule.js";
|
|
2
|
+
import "../vendor/effect-oxlint/index.js";
|
|
3
|
+
//#region src/rules/no-effect-async.ts
|
|
4
|
+
/**
|
|
5
|
+
* Ban `Effect.async`.
|
|
6
|
+
*
|
|
7
|
+
* Use `Stream` or structured Effect lifecycles (acquire/use/release).
|
|
8
|
+
*
|
|
9
|
+
* Source: biome-effect-linting-rules/no-effect-async
|
|
10
|
+
*/
|
|
11
|
+
const noEffectAsync = banMember("Effect", "async", {
|
|
12
|
+
message: "Avoid Effect.async. Use Stream or structured Effect lifecycles.",
|
|
13
|
+
meta: { type: "suggestion" }
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { noEffectAsync };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { banMember } from "../vendor/effect-oxlint/Rule.js";
|
|
2
|
+
import "../vendor/effect-oxlint/index.js";
|
|
3
|
+
//#region src/rules/no-effect-bind.ts
|
|
4
|
+
/**
|
|
5
|
+
* Ban `Effect.bind`.
|
|
6
|
+
*
|
|
7
|
+
* Use flat pipe or direct top-level `Effect.gen` with yields.
|
|
8
|
+
*
|
|
9
|
+
* Source: biome-effect-linting-rules/no-effect-bind
|
|
10
|
+
*/
|
|
11
|
+
const noEffectBind = banMember("Effect", "bind", {
|
|
12
|
+
message: "Avoid Effect.bind. Use flat pipe or Effect.gen with yields.",
|
|
13
|
+
meta: { type: "suggestion" }
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { noEffectBind };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { banMember } from "../vendor/effect-oxlint/Rule.js";
|
|
2
|
+
import "../vendor/effect-oxlint/index.js";
|
|
3
|
+
//#region src/rules/no-effect-do.ts
|
|
4
|
+
/**
|
|
5
|
+
* Ban `Effect.Do` — the builder/do-notation entry point.
|
|
6
|
+
*
|
|
7
|
+
* Use flat pipe-based flow or `Effect.gen` instead.
|
|
8
|
+
*
|
|
9
|
+
* Sources: biome-effect-linting-rules/no-effect-do, language-service/effectDoNotation
|
|
10
|
+
*/
|
|
11
|
+
const noEffectDo = banMember("Effect", "Do", {
|
|
12
|
+
message: "Avoid Effect.Do builder notation. Use flat pipe-based flow or Effect.gen.",
|
|
13
|
+
meta: { type: "suggestion" }
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { noEffectDo };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isCallOf } 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 Effect from "effect/Effect";
|
|
7
|
+
//#region src/rules/no-effect-fn-generator.ts
|
|
8
|
+
const noEffectFnGenerator = define({
|
|
9
|
+
name: "no-effect-fn-generator",
|
|
10
|
+
meta: meta({
|
|
11
|
+
type: "suggestion",
|
|
12
|
+
description: "Effect.fn should not directly wrap a generator. Use Effect.fn('name')(function*() {...}) with a span name."
|
|
13
|
+
}),
|
|
14
|
+
create: function* () {
|
|
15
|
+
const ctx = yield* RuleContext;
|
|
16
|
+
return { CallExpression: (node) => {
|
|
17
|
+
if (!isCallOf(node, "Effect", "fn")) return Effect.void;
|
|
18
|
+
if ("arguments" in node && Array.isArray(node.arguments) && node.arguments.length === 1) {
|
|
19
|
+
const arg = node.arguments[0];
|
|
20
|
+
if (arg != null && typeof arg === "object" && "type" in arg && arg.type === "FunctionExpression" && "generator" in arg && arg.generator === true) return ctx.report(make({
|
|
21
|
+
node,
|
|
22
|
+
message: "Use Effect.fn('spanName')(function*() {...}) — provide a trace span name."
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
return Effect.void;
|
|
26
|
+
} };
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { noEffectFnGenerator };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isCallOf } 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 Effect from "effect/Effect";
|
|
7
|
+
//#region src/rules/no-effect-gen-adapter.ts
|
|
8
|
+
const noEffectGenAdapter = define({
|
|
9
|
+
name: "no-effect-gen-adapter",
|
|
10
|
+
meta: meta({
|
|
11
|
+
type: "suggestion",
|
|
12
|
+
description: "Deprecated adapter parameter in Effect.gen. Use `yield*` directly.",
|
|
13
|
+
effectVersion: "v3"
|
|
14
|
+
}),
|
|
15
|
+
create: function* () {
|
|
16
|
+
const ctx = yield* RuleContext;
|
|
17
|
+
return { CallExpression: (node) => {
|
|
18
|
+
if (!isCallOf(node, "Effect", "gen")) return Effect.void;
|
|
19
|
+
if (!("arguments" in node) || !Array.isArray(node.arguments) || node.arguments.length < 1) return Effect.void;
|
|
20
|
+
const arg = node.arguments[0];
|
|
21
|
+
if (arg != null && typeof arg === "object" && "type" in arg && arg.type === "FunctionExpression" && "generator" in arg && arg.generator === true && "params" in arg && Array.isArray(arg.params) && arg.params.length > 0) return ctx.report(make({
|
|
22
|
+
node,
|
|
23
|
+
message: "Deprecated adapter parameter in Effect.gen. Remove the parameter and use `yield*` directly."
|
|
24
|
+
}));
|
|
25
|
+
return Effect.void;
|
|
26
|
+
} };
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { noEffectGenAdapter };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { calleeName, matchCallOf } 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-effect-map-flatten.ts
|
|
9
|
+
const isEffectMap = (node) => {
|
|
10
|
+
if (node.type !== "CallExpression") return false;
|
|
11
|
+
return Option.isSome(matchCallOf(node, "Effect", "map"));
|
|
12
|
+
};
|
|
13
|
+
const isEffectFlatMap = (node) => {
|
|
14
|
+
if (node.type !== "CallExpression") return false;
|
|
15
|
+
return Option.isSome(matchCallOf(node, "Effect", "flatMap"));
|
|
16
|
+
};
|
|
17
|
+
const hasMapFlatMapSequence = (args) => {
|
|
18
|
+
for (let i = 0; i < args.length - 1; i++) {
|
|
19
|
+
const a = args[i];
|
|
20
|
+
const b = args[i + 1];
|
|
21
|
+
if (a && b && isEffectMap(a) && isEffectFlatMap(b)) return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
};
|
|
25
|
+
const noEffectMapFlatten = define({
|
|
26
|
+
name: "no-effect-map-flatten",
|
|
27
|
+
meta: meta({
|
|
28
|
+
type: "suggestion",
|
|
29
|
+
description: "Avoid Effect.map followed by Effect.flatMap in pipe. Fuse into a single Effect.flatMap."
|
|
30
|
+
}),
|
|
31
|
+
create: function* () {
|
|
32
|
+
const ctx = yield* RuleContext;
|
|
33
|
+
return { CallExpression: (node) => {
|
|
34
|
+
const call = node;
|
|
35
|
+
const args = call.arguments;
|
|
36
|
+
if (Option.getOrUndefined(calleeName(call)) === "pipe" && hasMapFlatMapSequence(args)) return ctx.report(make({
|
|
37
|
+
node,
|
|
38
|
+
message: "Effect.map followed by Effect.flatMap can be fused into a single Effect.flatMap."
|
|
39
|
+
}));
|
|
40
|
+
const calleeNode = call.callee;
|
|
41
|
+
if (calleeNode.type === "MemberExpression") {
|
|
42
|
+
const prop = calleeNode["property"];
|
|
43
|
+
if (prop != null && typeof prop === "object" && "name" in prop && prop.name === "pipe" && hasMapFlatMapSequence(args)) return ctx.report(make({
|
|
44
|
+
node,
|
|
45
|
+
message: "Effect.map followed by Effect.flatMap can be fused into a single Effect.flatMap."
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
return Effect.void;
|
|
49
|
+
} };
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
//#endregion
|
|
53
|
+
export { noEffectMapFlatten };
|