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.
- package/README.md +79 -38
- package/dist/presets/index.d.ts +3 -9
- package/dist/presets/index.js +3 -17
- package/dist/presets/recommended.d.ts +17 -0
- package/dist/presets/recommended.js +17 -0
- package/dist/rules/index.d.ts +4 -61
- package/dist/rules/index.js +4 -118
- package/dist/rules/no-async-function.js +8 -13
- package/dist/rules/no-dynamic-imports.js +89 -60
- package/dist/rules/no-globals.js +164 -127
- package/dist/rules/no-new-error.js +26 -13
- package/dist/rules/no-new-promise.js +22 -21
- package/dist/rules/no-node-builtin-import.js +98 -41
- package/dist/rules/no-throw-statement.js +4 -16
- package/dist/rules/no-try-catch.js +4 -16
- package/package.json +2 -2
- package/dist/presets/core.d.ts +0 -50
- package/dist/presets/core.js +0 -50
- package/dist/presets/effect-native.d.ts +0 -29
- package/dist/presets/effect-native.js +0 -29
- package/dist/presets/full.d.ts +0 -68
- package/dist/presets/full.js +0 -68
- package/dist/presets/functional.d.ts +0 -22
- package/dist/presets/functional.js +0 -22
- package/dist/presets/strict.d.ts +0 -73
- package/dist/presets/strict.js +0 -73
- package/dist/presets/v3-strict.d.ts +0 -16
- package/dist/presets/v3-strict.js +0 -16
- package/dist/presets/v3.d.ts +0 -18
- package/dist/presets/v3.js +0 -18
- package/dist/rules/_effect-context.d.ts +0 -19
- package/dist/rules/_effect-context.js +0 -22
- package/dist/rules/no-arrow-ladder.d.ts +0 -6
- package/dist/rules/no-arrow-ladder.js +0 -61
- package/dist/rules/no-catch-all-to-map-error.d.ts +0 -6
- package/dist/rules/no-catch-all-to-map-error.js +0 -67
- package/dist/rules/no-effect-all-step-sequencing.d.ts +0 -6
- package/dist/rules/no-effect-all-step-sequencing.js +0 -63
- package/dist/rules/no-effect-as.d.ts +0 -6
- package/dist/rules/no-effect-as.js +0 -16
- package/dist/rules/no-effect-async.d.ts +0 -6
- package/dist/rules/no-effect-async.js +0 -16
- package/dist/rules/no-effect-fn-generator.d.ts +0 -6
- package/dist/rules/no-effect-fn-generator.js +0 -30
- package/dist/rules/no-effect-gen-adapter.d.ts +0 -6
- package/dist/rules/no-effect-gen-adapter.js +0 -30
- package/dist/rules/no-effect-map-flatten.d.ts +0 -6
- package/dist/rules/no-effect-map-flatten.js +0 -53
- package/dist/rules/no-effect-map-void.d.ts +0 -6
- package/dist/rules/no-effect-map-void.js +0 -40
- package/dist/rules/no-effect-never.d.ts +0 -6
- package/dist/rules/no-effect-never.js +0 -16
- package/dist/rules/no-effect-orElse-ladder.d.ts +0 -6
- package/dist/rules/no-effect-orElse-ladder.js +0 -53
- package/dist/rules/no-effect-succeed-string.d.ts +0 -6
- package/dist/rules/no-effect-succeed-string.js +0 -30
- package/dist/rules/no-effect-succeed-variable.d.ts +0 -6
- package/dist/rules/no-effect-succeed-variable.js +0 -30
- package/dist/rules/no-effect-succeed-void.d.ts +0 -6
- package/dist/rules/no-effect-succeed-void.js +0 -33
- package/dist/rules/no-effect-sync-console.d.ts +0 -6
- package/dist/rules/no-effect-sync-console.js +0 -63
- package/dist/rules/no-effect-sync-wrapper.d.ts +0 -6
- package/dist/rules/no-effect-sync-wrapper.js +0 -37
- package/dist/rules/no-effect-type-alias.d.ts +0 -6
- package/dist/rules/no-effect-type-alias.js +0 -52
- package/dist/rules/no-effect-wrapper-alias.d.ts +0 -6
- package/dist/rules/no-effect-wrapper-alias.js +0 -69
- package/dist/rules/no-extends-native-error.d.ts +0 -6
- package/dist/rules/no-extends-native-error.js +0 -41
- package/dist/rules/no-flatmap-ladder.d.ts +0 -6
- package/dist/rules/no-flatmap-ladder.js +0 -48
- package/dist/rules/no-fromnullable-coalesce.d.ts +0 -6
- package/dist/rules/no-fromnullable-coalesce.js +0 -36
- package/dist/rules/no-global-error-in-catch.d.ts +0 -6
- package/dist/rules/no-global-error-in-catch.js +0 -75
- package/dist/rules/no-global-error-in-failure.d.ts +0 -6
- package/dist/rules/no-global-error-in-failure.js +0 -54
- package/dist/rules/no-hand-rolled-tagged-union.d.ts +0 -6
- package/dist/rules/no-hand-rolled-tagged-union.js +0 -70
- package/dist/rules/no-if-statement.d.ts +0 -6
- package/dist/rules/no-if-statement.js +0 -18
- package/dist/rules/no-iife-wrapper.d.ts +0 -6
- package/dist/rules/no-iife-wrapper.js +0 -37
- package/dist/rules/no-inline-provide.d.ts +0 -6
- package/dist/rules/no-inline-provide.js +0 -31
- package/dist/rules/no-instanceof-schema.d.ts +0 -6
- package/dist/rules/no-instanceof-schema.js +0 -35
- package/dist/rules/no-make-unsafe.d.ts +0 -6
- package/dist/rules/no-make-unsafe.js +0 -30
- package/dist/rules/no-manual-data-guard.d.ts +0 -6
- package/dist/rules/no-manual-data-guard.js +0 -56
- package/dist/rules/no-manual-effect-channels.d.ts +0 -6
- package/dist/rules/no-manual-effect-channels.js +0 -40
- package/dist/rules/no-match-effect-branch.d.ts +0 -6
- package/dist/rules/no-match-effect-branch.js +0 -64
- package/dist/rules/no-match-void-branch.d.ts +0 -6
- package/dist/rules/no-match-void-branch.js +0 -50
- package/dist/rules/no-multiple-effect-provide.d.ts +0 -6
- package/dist/rules/no-multiple-effect-provide.js +0 -45
- package/dist/rules/no-nested-effect-call.d.ts +0 -6
- package/dist/rules/no-nested-effect-call.js +0 -97
- package/dist/rules/no-nested-effect-gen.d.ts +0 -6
- package/dist/rules/no-nested-effect-gen.js +0 -46
- package/dist/rules/no-nested-pipe.d.ts +0 -6
- package/dist/rules/no-nested-pipe.js +0 -38
- package/dist/rules/no-option-as.d.ts +0 -6
- package/dist/rules/no-option-as.js +0 -16
- package/dist/rules/no-option-boolean-normalization.d.ts +0 -6
- package/dist/rules/no-option-boolean-normalization.js +0 -50
- package/dist/rules/no-positional-log-error.d.ts +0 -6
- package/dist/rules/no-positional-log-error.js +0 -52
- package/dist/rules/no-promise-control-flow-in-tests.d.ts +0 -6
- package/dist/rules/no-promise-control-flow-in-tests.js +0 -94
- package/dist/rules/no-redundant-schema-tag-identifier.d.ts +0 -6
- package/dist/rules/no-redundant-schema-tag-identifier.js +0 -46
- package/dist/rules/no-return-in-arrow.d.ts +0 -6
- package/dist/rules/no-return-in-arrow.js +0 -41
- package/dist/rules/no-return-nullish.d.ts +0 -6
- package/dist/rules/no-return-nullish.js +0 -47
- package/dist/rules/no-run-in-effect-gen.d.ts +0 -6
- package/dist/rules/no-run-in-effect-gen.js +0 -48
- package/dist/rules/no-runtime-run-fork.d.ts +0 -6
- package/dist/rules/no-runtime-run-fork.js +0 -19
- package/dist/rules/no-schema-struct-with-tag.d.ts +0 -6
- package/dist/rules/no-schema-struct-with-tag.js +0 -48
- package/dist/rules/no-schema-struct.d.ts +0 -6
- package/dist/rules/no-schema-struct.js +0 -28
- package/dist/rules/no-schema-union-of-literals.d.ts +0 -6
- package/dist/rules/no-schema-union-of-literals.js +0 -35
- package/dist/rules/no-sleep-in-tests.d.ts +0 -6
- package/dist/rules/no-sleep-in-tests.js +0 -55
- package/dist/rules/no-spread.d.ts +0 -6
- package/dist/rules/no-spread.js +0 -26
- package/dist/rules/no-string-sentinel-const.d.ts +0 -6
- package/dist/rules/no-string-sentinel-const.js +0 -38
- package/dist/rules/no-switch-statement.d.ts +0 -6
- package/dist/rules/no-switch-statement.js +0 -16
- package/dist/rules/no-unnecessary-arrow-block.d.ts +0 -6
- package/dist/rules/no-unnecessary-arrow-block.js +0 -34
- package/dist/rules/no-unnecessary-effect-gen.d.ts +0 -6
- package/dist/rules/no-unnecessary-effect-gen.js +0 -35
- package/dist/rules/no-unnecessary-pipe-chain.d.ts +0 -6
- package/dist/rules/no-unnecessary-pipe-chain.js +0 -36
- package/dist/rules/no-unnecessary-pipe.d.ts +0 -6
- 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,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 };
|