oxlint-plugin-effect 0.2.0 → 0.2.2
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 +14 -0
- package/dist/presets/index.js +20 -0
- package/dist/presets/strict.d.ts +64 -0
- package/dist/presets/strict.js +64 -0
- package/dist/presets/v3-strict.d.ts +16 -0
- package/dist/presets/v3-strict.js +16 -0
- package/dist/presets/v3.d.ts +18 -0
- package/dist/presets/v3.js +18 -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,98 @@
|
|
|
1
|
+
import { Token } from "@oxlint/plugins";
|
|
2
|
+
|
|
3
|
+
//#region src/vendor/effect-oxlint/Token.d.ts
|
|
4
|
+
declare namespace Token_d_exports {
|
|
5
|
+
export { isBoolean, isIdentifier, isKeyword, isNull, isNumeric, isPrivateIdentifier, isPunctuator, isRegularExpression, isString, isTemplate, type, value };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Check whether a token is a keyword with the given value.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* Token.isKeyword(token, 'const') // true if keyword "const"
|
|
13
|
+
* Token.isKeyword(token, 'return') // true if keyword "return"
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @since 0.2.0
|
|
17
|
+
*/
|
|
18
|
+
declare const isKeyword: {
|
|
19
|
+
(keyword: string): (token: Token) => boolean;
|
|
20
|
+
(token: Token, keyword: string): boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Check whether a token is a punctuator with the given value.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* Token.isPunctuator(token, '{') // true if punctuator "{"
|
|
28
|
+
* Token.isPunctuator(token, ';') // true if punctuator ";"
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @since 0.2.0
|
|
32
|
+
*/
|
|
33
|
+
declare const isPunctuator: {
|
|
34
|
+
(value: string): (token: Token) => boolean;
|
|
35
|
+
(token: Token, value: string): boolean;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Check whether a token is an identifier.
|
|
39
|
+
*
|
|
40
|
+
* @since 0.2.0
|
|
41
|
+
*/
|
|
42
|
+
declare const isIdentifier: (token: Token) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Check whether a token is a string literal.
|
|
45
|
+
*
|
|
46
|
+
* @since 0.2.0
|
|
47
|
+
*/
|
|
48
|
+
declare const isString: (token: Token) => boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Check whether a token is a numeric literal.
|
|
51
|
+
*
|
|
52
|
+
* @since 0.2.0
|
|
53
|
+
*/
|
|
54
|
+
declare const isNumeric: (token: Token) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Check whether a token is a boolean literal.
|
|
57
|
+
*
|
|
58
|
+
* @since 0.2.0
|
|
59
|
+
*/
|
|
60
|
+
declare const isBoolean: (token: Token) => boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Check whether a token is a null literal.
|
|
63
|
+
*
|
|
64
|
+
* @since 0.2.0
|
|
65
|
+
*/
|
|
66
|
+
declare const isNull: (token: Token) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Check whether a token is a template literal part.
|
|
69
|
+
*
|
|
70
|
+
* @since 0.2.0
|
|
71
|
+
*/
|
|
72
|
+
declare const isTemplate: (token: Token) => boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Check whether a token is a regular expression literal.
|
|
75
|
+
*
|
|
76
|
+
* @since 0.2.0
|
|
77
|
+
*/
|
|
78
|
+
declare const isRegularExpression: (token: Token) => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Check whether a token is a private identifier (e.g. `#foo`).
|
|
81
|
+
*
|
|
82
|
+
* @since 0.2.0
|
|
83
|
+
*/
|
|
84
|
+
declare const isPrivateIdentifier: (token: Token) => boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Get the string value of a token.
|
|
87
|
+
*
|
|
88
|
+
* @since 0.2.0
|
|
89
|
+
*/
|
|
90
|
+
declare const value: (token: Token) => string;
|
|
91
|
+
/**
|
|
92
|
+
* Get the type discriminant of a token.
|
|
93
|
+
*
|
|
94
|
+
* @since 0.2.0
|
|
95
|
+
*/
|
|
96
|
+
declare const type: (token: Token) => string;
|
|
97
|
+
//#endregion
|
|
98
|
+
export { Token_d_exports, isBoolean, isIdentifier, isKeyword, isNull, isNumeric, isPrivateIdentifier, isPunctuator, isRegularExpression, isString, isTemplate, type, value };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { dual } from "effect/Function";
|
|
3
|
+
//#region src/vendor/effect-oxlint/Token.ts
|
|
4
|
+
var Token_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
isBoolean: () => isBoolean,
|
|
6
|
+
isIdentifier: () => isIdentifier,
|
|
7
|
+
isKeyword: () => isKeyword,
|
|
8
|
+
isNull: () => isNull,
|
|
9
|
+
isNumeric: () => isNumeric,
|
|
10
|
+
isPrivateIdentifier: () => isPrivateIdentifier,
|
|
11
|
+
isPunctuator: () => isPunctuator,
|
|
12
|
+
isRegularExpression: () => isRegularExpression,
|
|
13
|
+
isString: () => isString,
|
|
14
|
+
isTemplate: () => isTemplate,
|
|
15
|
+
type: () => type,
|
|
16
|
+
value: () => value
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Check whether a token is a keyword with the given value.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* Token.isKeyword(token, 'const') // true if keyword "const"
|
|
24
|
+
* Token.isKeyword(token, 'return') // true if keyword "return"
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @since 0.2.0
|
|
28
|
+
*/
|
|
29
|
+
const isKeyword = dual(2, (token, keyword) => token.type === "Keyword" && token.value === keyword);
|
|
30
|
+
/**
|
|
31
|
+
* Check whether a token is a punctuator with the given value.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* Token.isPunctuator(token, '{') // true if punctuator "{"
|
|
36
|
+
* Token.isPunctuator(token, ';') // true if punctuator ";"
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @since 0.2.0
|
|
40
|
+
*/
|
|
41
|
+
const isPunctuator = dual(2, (token, value) => token.type === "Punctuator" && token.value === value);
|
|
42
|
+
/**
|
|
43
|
+
* Check whether a token is an identifier.
|
|
44
|
+
*
|
|
45
|
+
* @since 0.2.0
|
|
46
|
+
*/
|
|
47
|
+
const isIdentifier = (token) => token.type === "Identifier";
|
|
48
|
+
/**
|
|
49
|
+
* Check whether a token is a string literal.
|
|
50
|
+
*
|
|
51
|
+
* @since 0.2.0
|
|
52
|
+
*/
|
|
53
|
+
const isString = (token) => token.type === "String";
|
|
54
|
+
/**
|
|
55
|
+
* Check whether a token is a numeric literal.
|
|
56
|
+
*
|
|
57
|
+
* @since 0.2.0
|
|
58
|
+
*/
|
|
59
|
+
const isNumeric = (token) => token.type === "Numeric";
|
|
60
|
+
/**
|
|
61
|
+
* Check whether a token is a boolean literal.
|
|
62
|
+
*
|
|
63
|
+
* @since 0.2.0
|
|
64
|
+
*/
|
|
65
|
+
const isBoolean = (token) => token.type === "Boolean";
|
|
66
|
+
/**
|
|
67
|
+
* Check whether a token is a null literal.
|
|
68
|
+
*
|
|
69
|
+
* @since 0.2.0
|
|
70
|
+
*/
|
|
71
|
+
const isNull = (token) => token.type === "Null";
|
|
72
|
+
/**
|
|
73
|
+
* Check whether a token is a template literal part.
|
|
74
|
+
*
|
|
75
|
+
* @since 0.2.0
|
|
76
|
+
*/
|
|
77
|
+
const isTemplate = (token) => token.type === "Template";
|
|
78
|
+
/**
|
|
79
|
+
* Check whether a token is a regular expression literal.
|
|
80
|
+
*
|
|
81
|
+
* @since 0.2.0
|
|
82
|
+
*/
|
|
83
|
+
const isRegularExpression = (token) => token.type === "RegularExpression";
|
|
84
|
+
/**
|
|
85
|
+
* Check whether a token is a private identifier (e.g. `#foo`).
|
|
86
|
+
*
|
|
87
|
+
* @since 0.2.0
|
|
88
|
+
*/
|
|
89
|
+
const isPrivateIdentifier = (token) => token.type === "PrivateIdentifier";
|
|
90
|
+
/**
|
|
91
|
+
* Get the string value of a token.
|
|
92
|
+
*
|
|
93
|
+
* @since 0.2.0
|
|
94
|
+
*/
|
|
95
|
+
const value = (token) => token.value;
|
|
96
|
+
/**
|
|
97
|
+
* Get the type discriminant of a token.
|
|
98
|
+
*
|
|
99
|
+
* @since 0.2.0
|
|
100
|
+
*/
|
|
101
|
+
const type = (token) => token.type;
|
|
102
|
+
//#endregion
|
|
103
|
+
export { Token_exports, isBoolean, isIdentifier, isKeyword, isNull, isNumeric, isPrivateIdentifier, isPunctuator, isRegularExpression, isString, isTemplate, type, value };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { RuleContext } from "./RuleContext.js";
|
|
2
|
+
import * as Option from "effect/Option";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Ref from "effect/Ref";
|
|
5
|
+
import { ESTree, Visitor } from "@oxlint/plugins";
|
|
6
|
+
|
|
7
|
+
//#region src/vendor/effect-oxlint/Visitor.d.ts
|
|
8
|
+
declare namespace Visitor_d_exports {
|
|
9
|
+
export { EffectHandler, EffectVisitor, TypedEffectVisitor, VisitorNodeType, accumulate, filter, merge, on, onExit, toOxlintVisitor, tracked };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An effectful visitor handler.
|
|
13
|
+
*
|
|
14
|
+
* Receives an AST node and returns an `Effect<void>` that may read/write
|
|
15
|
+
* `Ref` state and report diagnostics via `RuleContext`.
|
|
16
|
+
*
|
|
17
|
+
* @since 0.1.0
|
|
18
|
+
*/
|
|
19
|
+
type EffectHandler<N = ESTree.Node> = {
|
|
20
|
+
bivarianceHack(node: N): Effect.Effect<void, never, RuleContext>;
|
|
21
|
+
}['bivarianceHack'];
|
|
22
|
+
/**
|
|
23
|
+
* A map from AST node type names (and `"NodeType:exit"` variants) to
|
|
24
|
+
* effectful handlers.
|
|
25
|
+
*
|
|
26
|
+
* This is the internal representation — handlers accept `ESTree.Node`.
|
|
27
|
+
*
|
|
28
|
+
* @since 0.1.0
|
|
29
|
+
*/
|
|
30
|
+
type EffectVisitor = {
|
|
31
|
+
readonly [key: string]: EffectHandler;
|
|
32
|
+
};
|
|
33
|
+
/** @internal Extract the node parameter type from an oxlint visitor handler. */
|
|
34
|
+
type ExtractNode<H> = H extends ((node: infer N) => unknown) | {
|
|
35
|
+
bivarianceHack(node: infer N): void;
|
|
36
|
+
} ? N : ESTree.Node;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a visitor key to its narrowed node type.
|
|
39
|
+
*
|
|
40
|
+
* For known keys (e.g. `'CallExpression'`), returns the specific
|
|
41
|
+
* ESTree node type. For unknown keys, falls back to `ESTree.Node`.
|
|
42
|
+
*
|
|
43
|
+
* @since 0.2.0
|
|
44
|
+
*/
|
|
45
|
+
type VisitorNodeType<K extends string> = K extends keyof Visitor ? ExtractNode<Exclude<Visitor[K], undefined>> : ESTree.Node;
|
|
46
|
+
/**
|
|
47
|
+
* Typed visitor map where known oxlint visitor keys provide the
|
|
48
|
+
* correctly narrowed node type to handlers (e.g. `MemberExpression`
|
|
49
|
+
* handlers receive `ESTree.MemberExpression`).
|
|
50
|
+
*
|
|
51
|
+
* Return this from `Rule.define`'s `create` generator. Callers get
|
|
52
|
+
* typed nodes in their handlers without manual narrowing.
|
|
53
|
+
*
|
|
54
|
+
* @since 0.2.0
|
|
55
|
+
*/
|
|
56
|
+
type TypedEffectVisitor = { readonly [K in keyof Visitor]?: EffectHandler<ExtractNode<Exclude<Visitor[K], undefined>>> };
|
|
57
|
+
/**
|
|
58
|
+
* Create a single-entry visitor that handles one node type.
|
|
59
|
+
*
|
|
60
|
+
* The handler is a generator function that can `yield*` Effects.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* Visitor.on('ThrowStatement', function*(node) {
|
|
65
|
+
* const depth = yield* Ref.get(myDepthRef)
|
|
66
|
+
* if (depth > 0) {
|
|
67
|
+
* yield* RuleContext.report({ node, message: '...' })
|
|
68
|
+
* }
|
|
69
|
+
* })
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @since 0.1.0
|
|
73
|
+
*/
|
|
74
|
+
declare const on: <K extends string>(nodeType: K, handler: EffectHandler<VisitorNodeType<K>>) => EffectVisitor;
|
|
75
|
+
/**
|
|
76
|
+
* Create a single-entry visitor for the exit phase of a node type.
|
|
77
|
+
*
|
|
78
|
+
* @since 0.1.0
|
|
79
|
+
*/
|
|
80
|
+
declare const onExit: <K extends string>(nodeType: K, handler: EffectHandler<VisitorNodeType<K>>) => EffectVisitor;
|
|
81
|
+
/**
|
|
82
|
+
* Merge multiple visitors into one.
|
|
83
|
+
*
|
|
84
|
+
* When two visitors handle the same node type, both handlers run
|
|
85
|
+
* sequentially (left to right).
|
|
86
|
+
*
|
|
87
|
+
* @since 0.1.0
|
|
88
|
+
*/
|
|
89
|
+
declare const merge: (...visitors: ReadonlyArray<EffectVisitor>) => EffectVisitor;
|
|
90
|
+
/**
|
|
91
|
+
* Create an enter/exit visitor pair that increments a `Ref<number>` on
|
|
92
|
+
* enter and decrements on exit, but only when the predicate matches.
|
|
93
|
+
*
|
|
94
|
+
* This replaces the common `let depth = 0` mutable counter pattern.
|
|
95
|
+
*
|
|
96
|
+
* The predicate receives the narrowed node type for the given key
|
|
97
|
+
* (e.g. `ESTree.CallExpression` for `'CallExpression'`).
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const effectGenDepth = yield* Ref.make(0)
|
|
102
|
+
*
|
|
103
|
+
* Visitor.tracked('CallExpression',
|
|
104
|
+
* (node) => AST.isCallOf(node, 'Effect', 'gen'),
|
|
105
|
+
* effectGenDepth
|
|
106
|
+
* )
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @since 0.1.0
|
|
110
|
+
*/
|
|
111
|
+
declare const tracked: <K extends string>(nodeType: K, predicate: (node: VisitorNodeType<K>) => boolean, ref: Ref.Ref<number>) => EffectVisitor;
|
|
112
|
+
/**
|
|
113
|
+
* Conditionally apply a visitor based on a predicate evaluated once
|
|
114
|
+
* at create time.
|
|
115
|
+
*
|
|
116
|
+
* Useful for restricting a visitor to specific files (e.g. skip test files).
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* Visitor.filter(
|
|
121
|
+
* (filename) => !filename.endsWith('.test.ts'),
|
|
122
|
+
* mainVisitor
|
|
123
|
+
* )
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @since 0.2.0
|
|
127
|
+
*/
|
|
128
|
+
declare const filter: {
|
|
129
|
+
(predicate: (filename: string) => boolean): (visitor: EffectVisitor) => Effect.Effect<EffectVisitor, never, RuleContext>;
|
|
130
|
+
(predicate: (filename: string) => boolean, visitor: EffectVisitor): Effect.Effect<EffectVisitor, never, RuleContext>;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Accumulate values during traversal and analyze them at `Program:exit`.
|
|
134
|
+
*
|
|
135
|
+
* The `extract` function is called for each node of `nodeType`. If it
|
|
136
|
+
* returns `Option.some(value)`, that value is accumulated. At
|
|
137
|
+
* `Program:exit`, the `analyze` generator receives all collected items.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* Visitor.accumulate(
|
|
142
|
+
* 'ExportNamedDeclaration',
|
|
143
|
+
* (node) => AST.narrow(node, 'ExportNamedDeclaration').pipe(
|
|
144
|
+
* Option.map(n => n.declaration)
|
|
145
|
+
* ),
|
|
146
|
+
* function*(accumulated) {
|
|
147
|
+
* // Analyze all collected declarations at end of file
|
|
148
|
+
* }
|
|
149
|
+
* )
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* @since 0.2.0
|
|
153
|
+
*/
|
|
154
|
+
declare const accumulate: <A>(nodeType: string, extract: (node: ESTree.Node) => Option.Option<A>, analyze: (items: ReadonlyArray<A>) => Effect.Effect<void, never, RuleContext>) => Effect.Effect<EffectVisitor, never, RuleContext>;
|
|
155
|
+
/**
|
|
156
|
+
* Convert an `EffectVisitor` to a plain oxlint `Visitor` by wrapping
|
|
157
|
+
* each handler with the provided runner function.
|
|
158
|
+
*
|
|
159
|
+
* This is the runtime boundary where Effects are executed. Called once
|
|
160
|
+
* per file inside `Rule.define`'s `create`.
|
|
161
|
+
*
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
declare const toOxlintVisitor: (effectVisitor: EffectVisitor, runHandler: (effect: Effect.Effect<void, never, RuleContext>) => void) => Visitor;
|
|
165
|
+
//#endregion
|
|
166
|
+
export { EffectHandler, EffectVisitor, TypedEffectVisitor, VisitorNodeType, Visitor_d_exports, accumulate, filter, merge, on, onExit, toOxlintVisitor, tracked };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { RuleContext } from "./RuleContext.js";
|
|
3
|
+
import * as Arr from "effect/Array";
|
|
4
|
+
import { dual, pipe } from "effect/Function";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as R from "effect/Record";
|
|
8
|
+
import * as Ref from "effect/Ref";
|
|
9
|
+
//#region src/vendor/effect-oxlint/Visitor.ts
|
|
10
|
+
var Visitor_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
accumulate: () => accumulate,
|
|
12
|
+
filter: () => filter,
|
|
13
|
+
merge: () => merge,
|
|
14
|
+
on: () => on,
|
|
15
|
+
onExit: () => onExit,
|
|
16
|
+
toOxlintVisitor: () => toOxlintVisitor,
|
|
17
|
+
tracked: () => tracked
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Create a single-entry visitor that handles one node type.
|
|
21
|
+
*
|
|
22
|
+
* The handler is a generator function that can `yield*` Effects.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* Visitor.on('ThrowStatement', function*(node) {
|
|
27
|
+
* const depth = yield* Ref.get(myDepthRef)
|
|
28
|
+
* if (depth > 0) {
|
|
29
|
+
* yield* RuleContext.report({ node, message: '...' })
|
|
30
|
+
* }
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @since 0.1.0
|
|
35
|
+
*/
|
|
36
|
+
const on = (nodeType, handler) => ({ [nodeType]: handler });
|
|
37
|
+
/**
|
|
38
|
+
* Create a single-entry visitor for the exit phase of a node type.
|
|
39
|
+
*
|
|
40
|
+
* @since 0.1.0
|
|
41
|
+
*/
|
|
42
|
+
const onExit = (nodeType, handler) => ({ [`${nodeType}:exit`]: handler });
|
|
43
|
+
/** @internal Empty visitor seed for reduce operations. */
|
|
44
|
+
const emptyVisitor = {};
|
|
45
|
+
/** @internal Combine two handlers for the same node type into one sequential handler. */
|
|
46
|
+
const sequenceHandlers = (left, right) => (node) => Effect.andThen(left(node), right(node));
|
|
47
|
+
/**
|
|
48
|
+
* Merge multiple visitors into one.
|
|
49
|
+
*
|
|
50
|
+
* When two visitors handle the same node type, both handlers run
|
|
51
|
+
* sequentially (left to right).
|
|
52
|
+
*
|
|
53
|
+
* @since 0.1.0
|
|
54
|
+
*/
|
|
55
|
+
const merge = (...visitors) => Arr.reduce(visitors, emptyVisitor, (acc, visitor) => R.union(acc, visitor, (left, right) => sequenceHandlers(left, right)));
|
|
56
|
+
/**
|
|
57
|
+
* Create an enter/exit visitor pair that increments a `Ref<number>` on
|
|
58
|
+
* enter and decrements on exit, but only when the predicate matches.
|
|
59
|
+
*
|
|
60
|
+
* This replaces the common `let depth = 0` mutable counter pattern.
|
|
61
|
+
*
|
|
62
|
+
* The predicate receives the narrowed node type for the given key
|
|
63
|
+
* (e.g. `ESTree.CallExpression` for `'CallExpression'`).
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const effectGenDepth = yield* Ref.make(0)
|
|
68
|
+
*
|
|
69
|
+
* Visitor.tracked('CallExpression',
|
|
70
|
+
* (node) => AST.isCallOf(node, 'Effect', 'gen'),
|
|
71
|
+
* effectGenDepth
|
|
72
|
+
* )
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @since 0.1.0
|
|
76
|
+
*/
|
|
77
|
+
const tracked = (nodeType, predicate, ref) => ({
|
|
78
|
+
[nodeType]: (node) => predicate(node) ? Ref.update(ref, (n) => n + 1) : Effect.void,
|
|
79
|
+
[`${nodeType}:exit`]: (node) => predicate(node) ? Ref.update(ref, (n) => n - 1) : Effect.void
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* Conditionally apply a visitor based on a predicate evaluated once
|
|
83
|
+
* at create time.
|
|
84
|
+
*
|
|
85
|
+
* Useful for restricting a visitor to specific files (e.g. skip test files).
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* Visitor.filter(
|
|
90
|
+
* (filename) => !filename.endsWith('.test.ts'),
|
|
91
|
+
* mainVisitor
|
|
92
|
+
* )
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @since 0.2.0
|
|
96
|
+
*/
|
|
97
|
+
const filter = dual(2, (predicate, visitor) => Effect.service(RuleContext).pipe(Effect.map((ctx) => predicate(ctx.filename) ? visitor : {})));
|
|
98
|
+
/**
|
|
99
|
+
* Accumulate values during traversal and analyze them at `Program:exit`.
|
|
100
|
+
*
|
|
101
|
+
* The `extract` function is called for each node of `nodeType`. If it
|
|
102
|
+
* returns `Option.some(value)`, that value is accumulated. At
|
|
103
|
+
* `Program:exit`, the `analyze` generator receives all collected items.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* Visitor.accumulate(
|
|
108
|
+
* 'ExportNamedDeclaration',
|
|
109
|
+
* (node) => AST.narrow(node, 'ExportNamedDeclaration').pipe(
|
|
110
|
+
* Option.map(n => n.declaration)
|
|
111
|
+
* ),
|
|
112
|
+
* function*(accumulated) {
|
|
113
|
+
* // Analyze all collected declarations at end of file
|
|
114
|
+
* }
|
|
115
|
+
* )
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @since 0.2.0
|
|
119
|
+
*/
|
|
120
|
+
const accumulate = (nodeType, extract, analyze) => Effect.gen(function* () {
|
|
121
|
+
const ref = yield* Ref.make([]);
|
|
122
|
+
return merge(on(nodeType, (node) => pipe(extract(node), Option.match({
|
|
123
|
+
onNone: () => Effect.void,
|
|
124
|
+
onSome: (value) => Ref.update(ref, (items) => [...items, value])
|
|
125
|
+
}))), on("Program:exit", () => Effect.flatMap(Ref.get(ref), (items) => analyze(items))));
|
|
126
|
+
});
|
|
127
|
+
/**
|
|
128
|
+
* Convert an `EffectVisitor` to a plain oxlint `Visitor` by wrapping
|
|
129
|
+
* each handler with the provided runner function.
|
|
130
|
+
*
|
|
131
|
+
* This is the runtime boundary where Effects are executed. Called once
|
|
132
|
+
* per file inside `Rule.define`'s `create`.
|
|
133
|
+
*
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
const toOxlintVisitor = (effectVisitor, runHandler) => R.map(effectVisitor, (handler) => (node) => runHandler(handler(node)));
|
|
137
|
+
//#endregion
|
|
138
|
+
export { Visitor_exports, accumulate, filter, merge, on, onExit, toOxlintVisitor, tracked };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AST_d_exports } from "./AST.js";
|
|
2
|
+
import { Comment_d_exports } from "./Comment.js";
|
|
3
|
+
import { Diagnostic_d_exports } from "./Diagnostic.js";
|
|
4
|
+
import { Plugin_d_exports } from "./Plugin.js";
|
|
5
|
+
import { RuleContext, ast, cwd, filename, id, report, sourceCode, text } from "./RuleContext.js";
|
|
6
|
+
import { Visitor_d_exports } from "./Visitor.js";
|
|
7
|
+
import { Rule_d_exports } from "./Rule.js";
|
|
8
|
+
import { Scope_d_exports } from "./Scope.js";
|
|
9
|
+
import { SourceCode_d_exports } from "./SourceCode.js";
|
|
10
|
+
import { Testing_d_exports } from "./Testing.js";
|
|
11
|
+
import { Token_d_exports } from "./Token.js";
|
|
12
|
+
import { Comment as OxlintComment, Context, CreateOnceRule, CreateRule, Definition, DefinitionType, ESTree, Fix, FixFn, Fixer, LineColumn, Location, Plugin as OxlintPlugin, Range, Ranged, Reference, Rule as OxlintRule, RuleDocs, RuleMeta, Scope as OxlintScope, ScopeManager, ScopeType, Settings, SourceCode as OxlintSourceCode, Span, Suggestion, Token as OxlintToken, Variable, Visitor as OxlintVisitor } from "@oxlint/plugins";
|
|
13
|
+
export { AST_d_exports as AST, Comment_d_exports as Comment, type Context, type CreateOnceRule, type CreateRule, type Definition, type DefinitionType, Diagnostic_d_exports as Diagnostic, type ESTree, type Fix, type FixFn, type Fixer, type LineColumn, type Location, type OxlintComment, type OxlintPlugin, type OxlintRule, type OxlintScope, type OxlintSourceCode, type OxlintToken, type OxlintVisitor, Plugin_d_exports as Plugin, type Range, type Ranged, type Reference, Rule_d_exports as Rule, RuleContext, type RuleDocs, type RuleMeta, Scope_d_exports as Scope, type ScopeManager, type ScopeType, type Settings, SourceCode_d_exports as SourceCode, type Span, type Suggestion, Testing_d_exports as Testing, Token_d_exports as Token, type Variable, Visitor_d_exports as Visitor, ast, cwd, filename, id, report, sourceCode, text };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AST_exports } from "./AST.js";
|
|
2
|
+
import { Comment_exports } from "./Comment.js";
|
|
3
|
+
import { Diagnostic_exports } from "./Diagnostic.js";
|
|
4
|
+
import { Plugin_exports } from "./Plugin.js";
|
|
5
|
+
import { RuleContext, ast, cwd, filename, id, report, sourceCode, text } from "./RuleContext.js";
|
|
6
|
+
import { Visitor_exports } from "./Visitor.js";
|
|
7
|
+
import { Rule_exports } from "./Rule.js";
|
|
8
|
+
import { Scope_exports } from "./Scope.js";
|
|
9
|
+
import { SourceCode_exports } from "./SourceCode.js";
|
|
10
|
+
import { Testing_exports } from "./Testing.js";
|
|
11
|
+
import { Token_exports } from "./Token.js";
|
|
12
|
+
export { AST_exports as AST, Comment_exports as Comment, Diagnostic_exports as Diagnostic, Plugin_exports as Plugin, Rule_exports as Rule, RuleContext, Scope_exports as Scope, SourceCode_exports as SourceCode, Testing_exports as Testing, Token_exports as Token, Visitor_exports as Visitor, ast, cwd, filename, id, report, sourceCode, text };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxlint-plugin-effect",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "oxlint plugin with Effect-specific lint rules",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,14 +8,32 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/cevr/effect-oxlint"
|
|
10
10
|
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
11
14
|
"exports": {
|
|
12
|
-
".":
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
".": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./plugin": {
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/plugin.d.ts",
|
|
24
|
+
"default": "./dist/plugin.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"./presets/*": {
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./dist/presets/*.d.ts",
|
|
30
|
+
"default": "./dist/presets/*.js"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
15
33
|
},
|
|
16
34
|
"scripts": {
|
|
17
35
|
"dev": "bun run src/index.ts",
|
|
18
|
-
"build": "
|
|
36
|
+
"build": "tsdown",
|
|
19
37
|
"typecheck": "tsgo --noEmit",
|
|
20
38
|
"lint": "concurrently -n ox,effect -c yellow,blue \"oxlint\" \"bun run lint:effect\"",
|
|
21
39
|
"lint:ox": "oxlint",
|
|
@@ -44,6 +62,7 @@
|
|
|
44
62
|
"lefthook": "latest",
|
|
45
63
|
"oxfmt": "latest",
|
|
46
64
|
"oxlint": "latest",
|
|
65
|
+
"tsdown": "^0.21.7",
|
|
47
66
|
"typescript": "latest",
|
|
48
67
|
"vitest": "latest"
|
|
49
68
|
}
|
package/.effect-lsp.json
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"diagnostics": true,
|
|
3
|
-
"diagnosticsName": true,
|
|
4
|
-
"diagnosticSeverity": {
|
|
5
|
-
"anyUnknownInErrorContext": "error",
|
|
6
|
-
"deterministicKeys": "error",
|
|
7
|
-
"importFromBarrel": "error",
|
|
8
|
-
"instanceOfSchema": "error",
|
|
9
|
-
"missedPipeableOpportunity": "off",
|
|
10
|
-
"missingEffectServiceDependency": "error",
|
|
11
|
-
"schemaUnionOfLiterals": "error",
|
|
12
|
-
"strictBooleanExpressions": "off",
|
|
13
|
-
"strictEffectProvide": "error",
|
|
14
|
-
"catchAllToMapError": "error",
|
|
15
|
-
"catchUnfailableEffect": "error",
|
|
16
|
-
"effectFnOpportunity": "error",
|
|
17
|
-
"effectMapVoid": "error",
|
|
18
|
-
"effectSucceedWithVoid": "error",
|
|
19
|
-
"leakingRequirements": "error",
|
|
20
|
-
"preferSchemaOverJson": "error",
|
|
21
|
-
"redundantSchemaTagIdentifier": "error",
|
|
22
|
-
"returnEffectInGen": "error",
|
|
23
|
-
"runEffectInsideEffect": "error",
|
|
24
|
-
"schemaStructWithTag": "error",
|
|
25
|
-
"schemaSyncInEffect": "error",
|
|
26
|
-
"tryCatchInEffectGen": "error",
|
|
27
|
-
"unnecessaryEffectGen": "error",
|
|
28
|
-
"unnecessaryFailYieldableError": "error",
|
|
29
|
-
"unnecessaryPipe": "error",
|
|
30
|
-
"unnecessaryPipeChain": "error",
|
|
31
|
-
"extendsNativeError": "error",
|
|
32
|
-
"nodeBuiltinImport": "error",
|
|
33
|
-
"serviceNotAsClass": "error",
|
|
34
|
-
"outdatedApi": "error",
|
|
35
|
-
"globalFetch": "error",
|
|
36
|
-
"globalFetchInEffect": "error",
|
|
37
|
-
"globalDate": "error",
|
|
38
|
-
"globalDateInEffect": "error",
|
|
39
|
-
"globalConsole": "error",
|
|
40
|
-
"globalConsoleInEffect": "error",
|
|
41
|
-
"globalRandom": "error",
|
|
42
|
-
"globalRandomInEffect": "error",
|
|
43
|
-
"globalTimers": "error",
|
|
44
|
-
"globalTimersInEffect": "error",
|
|
45
|
-
"globalErrorInEffectCatch": "error",
|
|
46
|
-
"globalErrorInEffectFailure": "error"
|
|
47
|
-
},
|
|
48
|
-
"keyPatterns": [
|
|
49
|
-
{
|
|
50
|
-
"target": "service",
|
|
51
|
-
"pattern": "default",
|
|
52
|
-
"skipLeadingPath": ["src/"]
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"target": "error",
|
|
56
|
-
"pattern": "default",
|
|
57
|
-
"skipLeadingPath": ["src/"]
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
package/.oxlintrc.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
|
|
3
|
-
"categories": {
|
|
4
|
-
"correctness": "error",
|
|
5
|
-
"suspicious": "error",
|
|
6
|
-
"perf": "error"
|
|
7
|
-
},
|
|
8
|
-
"plugins": ["typescript", "import"],
|
|
9
|
-
"rules": {
|
|
10
|
-
"typescript/no-explicit-any": "error",
|
|
11
|
-
"typescript/no-non-null-assertion": "error",
|
|
12
|
-
"typescript/no-extra-non-null-assertion": "error",
|
|
13
|
-
"typescript/no-non-null-asserted-optional-chain": "error",
|
|
14
|
-
"typescript/consistent-type-imports": [
|
|
15
|
-
"error",
|
|
16
|
-
{ "prefer": "type-imports", "fixStyle": "separate-type-imports" }
|
|
17
|
-
],
|
|
18
|
-
"typescript/no-unsafe-type-assertion": "error",
|
|
19
|
-
"import/no-duplicates": "error",
|
|
20
|
-
"no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
|
|
21
|
-
},
|
|
22
|
-
"ignorePatterns": ["**/dist/**", "**/node_modules/**", "**/*.d.ts"],
|
|
23
|
-
"overrides": [
|
|
24
|
-
{
|
|
25
|
-
"files": ["**/*.test.ts", "**/tests/**"],
|
|
26
|
-
"rules": {
|
|
27
|
-
"typescript/no-non-null-assertion": "off",
|
|
28
|
-
"typescript/no-explicit-any": "off",
|
|
29
|
-
"typescript/no-unsafe-type-assertion": "off"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
}
|