@milkenjoyer/toolchain 0.6.5 → 0.7.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/README.md +0 -8
- package/dist/{effect-plugin-DARbVmA3.mjs → effect-plugin-Cee5222q.mjs} +64 -1
- package/dist/effect-plugin.mjs +1 -1
- package/dist/effect-tsgo.d.mts +1 -6
- package/dist/effect-tsgo.mjs +16 -8
- package/dist/exceptions.mjs +1 -14
- package/dist/guard.d.mts +0 -6
- package/dist/guard.mjs +19 -9
- package/dist/lint.d.mts +19 -4
- package/dist/lint.mjs +58 -49
- package/dist/plugin-DpJJbtFQ.mjs +264 -0
- package/dist/plugin.d.mts +0 -11
- package/dist/plugin.mjs +1 -1
- package/dist/rules.d.mts +91 -227
- package/dist/rules.mjs +94 -214
- package/dist/syntax-CGEOffZK.mjs +17 -0
- package/dist/versions.mjs +0 -6
- package/package.json +1 -10
- package/renovate.json +0 -1
- package/tsconfig.base.json +13 -1
- package/dist/array-method-C_XYdjLZ.mjs +0 -178
- package/dist/foldkit.d.mts +0 -3
- package/dist/foldkit.mjs +0 -17
- package/dist/plugin-CBUJ7Tgd.mjs +0 -927
- package/dist/rikalabs-hPKWFZ1P.mjs +0 -362
- package/dist/rikalabs.d.mts +0 -80
- package/dist/rikalabs.mjs +0 -1
package/dist/rules.mjs
CHANGED
|
@@ -1,234 +1,114 @@
|
|
|
1
1
|
const staticRules = {
|
|
2
|
-
"
|
|
3
|
-
"
|
|
2
|
+
"effecttsgo/strict-effect-provide": "off",
|
|
3
|
+
"eslint/array-callback-return": "error",
|
|
4
|
+
"eslint/constructor-super": "off",
|
|
4
5
|
"eslint/eqeqeq": ["error", "always"],
|
|
5
|
-
"eslint/
|
|
6
|
-
"eslint/no-sequences": "error",
|
|
7
|
-
"eslint/no-unreachable": "error",
|
|
8
|
-
"eslint/no-constant-condition": "error",
|
|
9
|
-
"eslint/func-names": "off",
|
|
10
|
-
"eslint/no-undefined": "off",
|
|
11
|
-
"eslint/sort-imports": "off",
|
|
12
|
-
"eslint/sort-keys": "off",
|
|
13
|
-
"eslint/no-extend-native": "error",
|
|
14
|
-
"eslint/no-global-assign": "error",
|
|
15
|
-
"eslint/no-implicit-globals": "error",
|
|
16
|
-
"eslint/use-isnan": "error",
|
|
17
|
-
"eslint/no-compare-neg-zero": "error",
|
|
6
|
+
"eslint/getter-return": "off",
|
|
18
7
|
"eslint/no-case-declarations": "error",
|
|
8
|
+
"eslint/no-class-assign": "off",
|
|
9
|
+
"eslint/no-console": "error",
|
|
10
|
+
"eslint/no-const-assign": "off",
|
|
11
|
+
"eslint/no-constructor-return": "error",
|
|
12
|
+
"eslint/no-delete-var": "off",
|
|
13
|
+
"eslint/no-dupe-class-members": "off",
|
|
14
|
+
"eslint/no-dupe-keys": "off",
|
|
15
|
+
"eslint/no-empty": "error",
|
|
19
16
|
"eslint/no-fallthrough": "error",
|
|
20
|
-
"eslint/
|
|
21
|
-
"eslint/no-
|
|
22
|
-
"eslint/no-
|
|
23
|
-
"eslint/no-
|
|
17
|
+
"eslint/no-func-assign": "off",
|
|
18
|
+
"eslint/no-implied-eval": "off",
|
|
19
|
+
"eslint/no-import-assign": "off",
|
|
20
|
+
"eslint/no-new-func": "error",
|
|
21
|
+
"eslint/no-new-native-nonconstructor": "off",
|
|
22
|
+
"eslint/no-new-wrappers": "error",
|
|
23
|
+
"eslint/no-obj-calls": "off",
|
|
24
|
+
"eslint/no-promise-executor-return": "error",
|
|
25
|
+
"eslint/no-proto": "error",
|
|
24
26
|
"eslint/no-prototype-builtins": "error",
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
+
"eslint/no-restricted-globals": [
|
|
28
|
+
"error",
|
|
29
|
+
"__dirname",
|
|
30
|
+
"__filename"
|
|
31
|
+
],
|
|
32
|
+
"eslint/no-restricted-imports": ["error", { paths: [{
|
|
33
|
+
name: "vitest",
|
|
34
|
+
message: "Import test utilities from '@effect/vitest' instead of raw 'vitest'."
|
|
35
|
+
}, {
|
|
36
|
+
name: "vite-plus/test",
|
|
37
|
+
message: "Import test utilities from '@effect/vitest' instead of 'vite-plus/test'."
|
|
38
|
+
}] }],
|
|
39
|
+
"eslint/no-return-assign": "error",
|
|
40
|
+
"eslint/no-script-url": "error",
|
|
41
|
+
"eslint/no-self-compare": "error",
|
|
42
|
+
"eslint/no-sequences": "error",
|
|
43
|
+
"eslint/no-setter-return": "off",
|
|
44
|
+
"eslint/no-shadow": "off",
|
|
45
|
+
"eslint/no-template-curly-in-string": "error",
|
|
46
|
+
"eslint/no-this-before-super": "off",
|
|
47
|
+
"eslint/no-underscore-dangle": "off",
|
|
48
|
+
"eslint/no-unneeded-ternary": "off",
|
|
49
|
+
"eslint/no-unreachable-loop": "error",
|
|
50
|
+
"eslint/no-unsafe-negation": "off",
|
|
51
|
+
"eslint/no-useless-call": "error",
|
|
52
|
+
"eslint/no-useless-concat": "off",
|
|
53
|
+
"eslint/no-var": "error",
|
|
54
|
+
"eslint/no-with": "off",
|
|
55
|
+
"eslint/valid-typeof": "off",
|
|
56
|
+
"import/default": "off",
|
|
57
|
+
"import/namespace": "off",
|
|
27
58
|
"import/no-cycle": "error",
|
|
28
|
-
"import/no-
|
|
29
|
-
"import/no-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"import/exports-last": "off",
|
|
35
|
-
"import/prefer-default-export": "off",
|
|
36
|
-
"import/consistent-type-specifier-style": "off",
|
|
37
|
-
"typescript/prefer-readonly-parameter-types": "off",
|
|
38
|
-
"typescript/no-meaningless-void-operator": "error",
|
|
39
|
-
"typescript/no-duplicate-enum-values": "error",
|
|
40
|
-
"typescript/prefer-optional-chain": "error",
|
|
41
|
-
"typescript/no-misused-new": "error",
|
|
42
|
-
"typescript/no-non-null-asserted-optional-chain": "error",
|
|
43
|
-
"promise/no-callback-in-promise": "error",
|
|
59
|
+
"import/no-mutable-exports": "error",
|
|
60
|
+
"import/no-unassigned-import": "off",
|
|
61
|
+
"node/no-process-env": "error",
|
|
62
|
+
"oxc/bad-bitwise-operator": "error",
|
|
63
|
+
"oxc/no-accumulating-spread": "error",
|
|
64
|
+
"promise/always-return": "off",
|
|
44
65
|
"promise/no-return-in-finally": "error",
|
|
45
|
-
"promise/
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}],
|
|
51
|
-
"unicorn/no-array-for-each": "off",
|
|
52
|
-
"unicorn/no-null": "off",
|
|
53
|
-
"unicorn/error-message": "error",
|
|
54
|
-
"unicorn/catch-error-name": ["error", { name: "error" }],
|
|
55
|
-
"unicorn/throw-new-error": "off",
|
|
56
|
-
"unicorn/prefer-node-protocol": "error",
|
|
57
|
-
"unicorn/prefer-module": "error",
|
|
58
|
-
"unicorn/numeric-separators-style": "error",
|
|
59
|
-
"unicorn/prefer-structured-clone": "error",
|
|
60
|
-
"unicorn/prefer-string-replace-all": "error",
|
|
61
|
-
"unicorn/no-thenable": "error",
|
|
62
|
-
"unicorn/no-useless-switch-case": "error",
|
|
63
|
-
"unicorn/no-useless-undefined": "error",
|
|
64
|
-
"unicorn/no-useless-spread": "error",
|
|
65
|
-
"unicorn/no-document-cookie": "error",
|
|
66
|
-
"unicorn/new-for-builtins": "error",
|
|
67
|
-
"unicorn/no-instanceof-builtins": "error",
|
|
68
|
-
"unicorn/no-invalid-remove-event-listener": "error",
|
|
66
|
+
"promise/valid-params": "off",
|
|
67
|
+
"typescript/ban-ts-comment": "error",
|
|
68
|
+
"typescript/method-signature-style": "error",
|
|
69
|
+
"typescript/no-deprecated": "error",
|
|
70
|
+
"typescript/no-empty-object-type": "error",
|
|
69
71
|
"typescript/no-explicit-any": "error",
|
|
72
|
+
"typescript/no-extraneous-class": "off",
|
|
73
|
+
"typescript/no-import-type-side-effects": "error",
|
|
74
|
+
"typescript/no-invalid-void-type": "error",
|
|
75
|
+
"typescript/no-misused-promises": "error",
|
|
70
76
|
"typescript/no-non-null-assertion": "error",
|
|
77
|
+
"typescript/no-unnecessary-boolean-literal-compare": "off",
|
|
78
|
+
"typescript/no-unnecessary-condition": "error",
|
|
79
|
+
"typescript/no-unnecessary-template-expression": "off",
|
|
80
|
+
"typescript/no-unnecessary-type-arguments": "off",
|
|
81
|
+
"typescript/no-unnecessary-type-constraint": "off",
|
|
82
|
+
"typescript/no-unnecessary-type-conversion": "off",
|
|
83
|
+
"typescript/no-unsafe-argument": "error",
|
|
71
84
|
"typescript/no-unsafe-assignment": "error",
|
|
72
85
|
"typescript/no-unsafe-call": "error",
|
|
86
|
+
"typescript/no-unsafe-function-type": "error",
|
|
73
87
|
"typescript/no-unsafe-member-access": "error",
|
|
74
88
|
"typescript/no-unsafe-return": "error",
|
|
75
|
-
"typescript/
|
|
76
|
-
"typescript/no-unnecessary-type-assertion": "error",
|
|
77
|
-
"typescript/strict-boolean-expressions": "error",
|
|
78
|
-
"typescript/switch-exhaustiveness-check": "error",
|
|
79
|
-
"typescript/explicit-function-return-type": "error",
|
|
80
|
-
"typescript/explicit-module-boundary-types": "error",
|
|
81
|
-
"typescript/no-import-type-side-effects": "error",
|
|
82
|
-
"typescript/unbound-method": "error",
|
|
83
|
-
"typescript/no-misused-spread": "error",
|
|
84
|
-
"typescript/no-unnecessary-condition": "error",
|
|
89
|
+
"typescript/only-throw-error": "error",
|
|
85
90
|
"typescript/prefer-nullish-coalescing": "error",
|
|
91
|
+
"typescript/prefer-promise-reject-errors": "error",
|
|
92
|
+
"typescript/related-getter-setter-pairs": "error",
|
|
86
93
|
"typescript/require-await": "error",
|
|
87
|
-
"typescript/no-unsafe-declaration-merging": "error",
|
|
88
|
-
"typescript/no-unnecessary-qualifier": "error",
|
|
89
|
-
"import/first": "error",
|
|
90
|
-
"import/no-absolute-path": "error",
|
|
91
|
-
"import/no-mutable-exports": "error",
|
|
92
|
-
"import/no-commonjs": "error",
|
|
93
|
-
"import/no-dynamic-require": "error",
|
|
94
|
-
"import/max-dependencies": ["error", { max: 35 }],
|
|
95
|
-
"promise/no-nesting": "error",
|
|
96
|
-
"promise/no-new-statics": "error",
|
|
97
|
-
"promise/param-names": "error",
|
|
98
|
-
"promise/valid-params": "error",
|
|
99
|
-
"promise/catch-or-return": "error",
|
|
100
|
-
"promise/always-return": "off",
|
|
101
|
-
"typescript/no-floating-promises": "error",
|
|
102
|
-
"typescript/promise-function-async": "off",
|
|
103
|
-
"typescript/return-await": "off",
|
|
104
|
-
"promise/prefer-await-to-then": "off",
|
|
105
|
-
"typescript/consistent-type-imports": "error",
|
|
106
|
-
"typescript/no-misused-promises": "error",
|
|
107
|
-
"typescript/use-unknown-in-catch-callback-variable": "error",
|
|
108
|
-
"typescript/no-unsafe-type-assertion": "error",
|
|
109
|
-
"typescript/no-redundant-type-constituents": "error",
|
|
110
|
-
"typescript/no-deprecated": "error",
|
|
111
94
|
"typescript/restrict-plus-operands": "error",
|
|
112
|
-
"typescript/
|
|
113
|
-
"typescript/
|
|
114
|
-
"typescript/
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"eslint/no-useless-return": "error",
|
|
128
|
-
"eslint/no-await-in-loop": "off",
|
|
129
|
-
"eslint/no-continue": "off",
|
|
130
|
-
"eslint/no-negated-condition": "off",
|
|
131
|
-
"eslint/no-param-reassign": "error",
|
|
132
|
-
"eslint/no-empty": "error",
|
|
133
|
-
"eslint/no-useless-catch": "error",
|
|
134
|
-
"eslint/no-empty-function": "error",
|
|
135
|
-
"eslint/no-ternary": "off",
|
|
136
|
-
"eslint/no-console": "error",
|
|
137
|
-
"eslint/no-shadow": ["error", { hoist: "functions" }],
|
|
138
|
-
"eslint/no-return-assign": "error",
|
|
139
|
-
"eslint/no-loop-func": "error",
|
|
140
|
-
"eslint/no-self-compare": "error",
|
|
141
|
-
"eslint/no-constructor-return": "error",
|
|
142
|
-
"eslint/no-alert": "error",
|
|
143
|
-
"eslint/no-new-func": "error",
|
|
144
|
-
"eslint/curly": ["error", "all"],
|
|
145
|
-
"eslint/no-else-return": "error",
|
|
146
|
-
"eslint/no-implicit-coercion": ["error", {
|
|
147
|
-
boolean: true,
|
|
148
|
-
number: true,
|
|
149
|
-
string: true
|
|
150
|
-
}],
|
|
151
|
-
"eslint/no-multi-assign": "error",
|
|
152
|
-
"eslint/no-template-curly-in-string": "error",
|
|
153
|
-
"eslint/no-labels": "error",
|
|
154
|
-
"eslint/no-lone-blocks": "error",
|
|
155
|
-
"eslint/id-length": "off",
|
|
156
|
-
"eslint/max-statements": "off",
|
|
157
|
-
"eslint/new-cap": "off",
|
|
158
|
-
"eslint/prefer-object-has-own": "error",
|
|
159
|
-
"eslint/prefer-object-spread": "off",
|
|
160
|
-
"eslint/prefer-template": "error",
|
|
161
|
-
"eslint/max-params": "off",
|
|
162
|
-
"eslint/max-lines-per-function": ["error", {
|
|
163
|
-
max: 60,
|
|
164
|
-
skipBlankLines: true,
|
|
165
|
-
skipComments: true
|
|
166
|
-
}],
|
|
167
|
-
"eslint/max-classes-per-file": ["error", 1],
|
|
168
|
-
"eslint/max-lines": ["error", {
|
|
169
|
-
max: 1500,
|
|
170
|
-
skipBlankLines: true,
|
|
171
|
-
skipComments: true
|
|
172
|
-
}],
|
|
173
|
-
"eslint/complexity": "off",
|
|
174
|
-
"eslint/no-magic-numbers": "off",
|
|
175
|
-
"eslint/no-nested-ternary": "error",
|
|
176
|
-
"eslint/no-debugger": "error",
|
|
177
|
-
"eslint/no-eval": "error",
|
|
178
|
-
"eslint/no-implied-eval": "error",
|
|
179
|
-
"eslint/prefer-promise-reject-errors": "error",
|
|
180
|
-
"eslint/max-nested-callbacks": ["error", 4],
|
|
181
|
-
"eslint/no-restricted-imports": ["error", { paths: [{
|
|
182
|
-
name: "vitest",
|
|
183
|
-
message: "Import test utilities from '@effect/vitest' instead of raw 'vitest'."
|
|
184
|
-
}, {
|
|
185
|
-
name: "vite-plus/test",
|
|
186
|
-
message: "Import test utilities from '@effect/vitest' instead of 'vite-plus/test'."
|
|
187
|
-
}] }],
|
|
188
|
-
"typescript/consistent-type-definitions": ["error", "type"],
|
|
189
|
-
"typescript/dot-notation": ["error", { allowIndexSignaturePropertyAccess: true }],
|
|
190
|
-
"unicorn/no-static-only-class": "error",
|
|
191
|
-
"unicorn/no-useless-promise-resolve-reject": "error",
|
|
192
|
-
"oxc/no-optional-chaining": "off",
|
|
193
|
-
"oxc/no-rest-spread-properties": "off",
|
|
194
|
-
"oxc/no-map-spread": "off",
|
|
195
|
-
"node/no-process-env": "error",
|
|
196
|
-
"node/no-path-concat": "error",
|
|
197
|
-
"node/handle-callback-err": "error",
|
|
198
|
-
"vitest/no-conditional-tests": "error",
|
|
95
|
+
"typescript/strict-boolean-expressions": "error",
|
|
96
|
+
"typescript/switch-exhaustiveness-check": "error",
|
|
97
|
+
"typescript/use-unknown-in-catch-callback-variable": "error",
|
|
98
|
+
"unicorn/consistent-function-scoping": "off",
|
|
99
|
+
"unicorn/new-for-builtins": "error",
|
|
100
|
+
"unicorn/no-abusive-eslint-disable": "error",
|
|
101
|
+
"unicorn/no-document-cookie": "error",
|
|
102
|
+
"unicorn/no-negation-in-equality-check": "error",
|
|
103
|
+
"unicorn/no-new-buffer": "error",
|
|
104
|
+
"unicorn/no-object-as-default-parameter": "error",
|
|
105
|
+
"unicorn/no-unnecessary-await": "off",
|
|
106
|
+
"unicorn/prefer-module": "error",
|
|
107
|
+
"unicorn/prefer-number-properties": "error",
|
|
108
|
+
"vitest/expect-expect": "off",
|
|
109
|
+
"vitest/no-identical-title": "error",
|
|
199
110
|
"vitest/no-import-node-test": "error",
|
|
200
111
|
"vitest/no-standalone-expect": "off",
|
|
201
|
-
"vitest/
|
|
202
|
-
"vitest/require-hook": "off",
|
|
203
|
-
"vitest/no-importing-vitest-globals": "off",
|
|
204
|
-
"vitest/expect-expect": "off",
|
|
205
|
-
"vitest/prefer-called-once": "error",
|
|
206
|
-
"vitest/consistent-test-filename": "error",
|
|
207
|
-
"vitest/prefer-called-times": "error",
|
|
208
|
-
"vitest/prefer-to-be-falsy": "error",
|
|
209
|
-
"vitest/prefer-to-be-truthy": "error",
|
|
210
|
-
"vitest/prefer-to-be-object": "error",
|
|
211
|
-
"jsdoc/check-tag-names": "error",
|
|
212
|
-
"jsdoc/check-property-names": "error",
|
|
213
|
-
"jsdoc/check-access": "error",
|
|
214
|
-
"jsdoc/empty-tags": "error",
|
|
215
|
-
"jsdoc/implements-on-classes": "error",
|
|
216
|
-
"jsdoc/require-property": "error",
|
|
217
|
-
"jsdoc/require-property-description": "error",
|
|
218
|
-
"jsdoc/require-property-name": "error",
|
|
219
|
-
"jsdoc/require-yields": "error",
|
|
220
|
-
"jsdoc/require-param": "off",
|
|
221
|
-
"jsdoc/require-param-type": "off",
|
|
222
|
-
"jsdoc/require-returns": "off",
|
|
223
|
-
"jsdoc/require-returns-type": "off",
|
|
224
|
-
"eslint/prefer-const": "error",
|
|
225
|
-
"unicorn/no-array-reduce": "error",
|
|
226
|
-
"typescript/only-throw-error": "error",
|
|
227
|
-
"unicorn/no-array-method-this-argument": "off",
|
|
228
|
-
"eslint/no-redeclare": "off",
|
|
229
|
-
"promise/prefer-await-to-callbacks": "off",
|
|
230
|
-
"unicorn/max-nested-calls": "off",
|
|
231
|
-
"eslint/one-var": "off",
|
|
232
|
-
"typescript/consistent-indexed-object-style": "off"
|
|
112
|
+
"vitest/valid-title": ["error", { allowArguments: true }]
|
|
233
113
|
};
|
|
234
114
|
export { staticRules };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as Option from "effect/Option";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
// src/shared/syntax.ts
|
|
4
|
+
const unwrapExpression = (node) => {
|
|
5
|
+
if (node.type === "ParenthesizedExpression" || node.type === "ChainExpression" || node.type === "TSAsExpression" || node.type === "TSTypeAssertion" || node.type === "TSNonNullExpression" || node.type === "TSSatisfiesExpression") return unwrapExpression(node.expression);
|
|
6
|
+
return node;
|
|
7
|
+
};
|
|
8
|
+
const isStringLiteral = (node) => node.type === "Literal" && Schema.is(Schema.String)(node.value);
|
|
9
|
+
const memberPropertyName = (node) => {
|
|
10
|
+
if (!node.computed && node.property.type === "Identifier") return Option.some(node.property.name);
|
|
11
|
+
return node.computed && isStringLiteral(node.property) ? Option.some(node.property.value) : Option.none();
|
|
12
|
+
};
|
|
13
|
+
const propertyName = (property) => {
|
|
14
|
+
if (!property.computed && property.key.type === "Identifier") return Option.some(property.key.name);
|
|
15
|
+
return isStringLiteral(property.key) ? Option.some(property.key.value) : Option.none();
|
|
16
|
+
};
|
|
17
|
+
export { unwrapExpression as i, memberPropertyName as n, propertyName as r, isStringLiteral as t };
|
package/dist/versions.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milkenjoyer/toolchain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/birbprophet/agent-kit.git",
|
|
@@ -41,10 +41,6 @@
|
|
|
41
41
|
"types": "./dist/fmt.d.mts",
|
|
42
42
|
"default": "./dist/fmt.mjs"
|
|
43
43
|
},
|
|
44
|
-
"./foldkit": {
|
|
45
|
-
"types": "./dist/foldkit.d.mts",
|
|
46
|
-
"default": "./dist/foldkit.mjs"
|
|
47
|
-
},
|
|
48
44
|
"./guard": {
|
|
49
45
|
"types": "./dist/guard.d.mts",
|
|
50
46
|
"default": "./dist/guard.mjs"
|
|
@@ -65,10 +61,6 @@
|
|
|
65
61
|
"types": "./dist/plugin.d.mts",
|
|
66
62
|
"default": "./dist/plugin.mjs"
|
|
67
63
|
},
|
|
68
|
-
"./rikalabs": {
|
|
69
|
-
"types": "./dist/rikalabs.d.mts",
|
|
70
|
-
"default": "./dist/rikalabs.mjs"
|
|
71
|
-
},
|
|
72
64
|
"./rules": {
|
|
73
65
|
"types": "./dist/rules.d.mts",
|
|
74
66
|
"default": "./dist/rules.mjs"
|
|
@@ -92,7 +84,6 @@
|
|
|
92
84
|
"dependencies": {
|
|
93
85
|
"@effect/tsgo": "0.67.3",
|
|
94
86
|
"@foldkit/oxlint-plugin": "0.15.4",
|
|
95
|
-
"@rikalabs/oxlint-standards": "0.8.1",
|
|
96
87
|
"effect": "4.1.2",
|
|
97
88
|
"effect-oxlint": "0.4.0",
|
|
98
89
|
"semver": "7.8.6",
|
package/renovate.json
CHANGED
package/tsconfig.base.json
CHANGED
|
@@ -18,15 +18,27 @@
|
|
|
18
18
|
"name": "@effect/language-service",
|
|
19
19
|
"diagnostics": false,
|
|
20
20
|
"allowedUnstableApis": [
|
|
21
|
+
"@effect/platform-browser",
|
|
21
22
|
"@effect/platform-bun",
|
|
22
23
|
"@effect/platform-node",
|
|
24
|
+
"@effect/platform-node-shared",
|
|
25
|
+
"@effect/sql-pg",
|
|
23
26
|
"@effect/vitest",
|
|
27
|
+
"effect/Arbitrary",
|
|
28
|
+
"effect/cli",
|
|
24
29
|
"effect/crypto",
|
|
25
30
|
"effect/FileSystem",
|
|
26
31
|
"effect/http",
|
|
27
32
|
"effect/Path",
|
|
33
|
+
"effect/persistence",
|
|
28
34
|
"effect/PlatformError",
|
|
29
|
-
"effect/process"
|
|
35
|
+
"effect/process",
|
|
36
|
+
"effect/reactivity",
|
|
37
|
+
"effect/rpc",
|
|
38
|
+
"effect/socket",
|
|
39
|
+
"effect/sql",
|
|
40
|
+
"effect/Stdio",
|
|
41
|
+
"effect/workflow"
|
|
30
42
|
]
|
|
31
43
|
}
|
|
32
44
|
]
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import * as Arr from "effect/Array";
|
|
2
|
-
import { dual } from "effect/Function";
|
|
3
|
-
import * as HashSet from "effect/HashSet";
|
|
4
|
-
import * as Option from "effect/Option";
|
|
5
|
-
import * as Schema from "effect/Schema";
|
|
6
|
-
import * as Str from "effect/String";
|
|
7
|
-
// src/shared/scope.ts
|
|
8
|
-
const resolveBinding = dual(2, (sourceCode, node) => {
|
|
9
|
-
if (node.type !== "Identifier") return Option.none();
|
|
10
|
-
const findBinding = (scope) => Option.flatMap(scope, (current) => Option.orElse(Option.fromUndefinedOr(current.set.get(node.name)), () => findBinding(Option.fromNullishOr(current.upper))));
|
|
11
|
-
return findBinding(Option.fromNullishOr(sourceCode.getScope(node)));
|
|
12
|
-
});
|
|
13
|
-
const importBinding = dual(3, (sourceCode, declaration, local) => {
|
|
14
|
-
const declared = sourceCode.getDeclaredVariables(declaration);
|
|
15
|
-
return Option.orElse(Arr.findFirst(declared, (variable) => Arr.some(variable.identifiers, (identifier) => identifier.start === local.start)), () => resolveBinding(sourceCode, local));
|
|
16
|
-
});
|
|
17
|
-
// src/shared/tagged-values.ts
|
|
18
|
-
const MATCH_METHODS = HashSet.fromIterable(["not", "when"]);
|
|
19
|
-
const DATA_TAG_EXPORTS = HashSet.fromIterable([
|
|
20
|
-
"TaggedClass",
|
|
21
|
-
"TaggedError",
|
|
22
|
-
"taggedEnum"
|
|
23
|
-
]);
|
|
24
|
-
const SCHEMA_TAG_EXPORTS = HashSet.fromIterable([
|
|
25
|
-
"TaggedClass",
|
|
26
|
-
"TaggedError",
|
|
27
|
-
"TaggedStruct",
|
|
28
|
-
"TaggedUnion",
|
|
29
|
-
"tag"
|
|
30
|
-
]);
|
|
31
|
-
const moduleForSource = (source) => {
|
|
32
|
-
const normalized = Str.replace(/\/$/u, "")(Str.replace(/\.(?:c|m)?[jt]sx?$/u, "")(source));
|
|
33
|
-
if (normalized === "effect") return Option.some("root");
|
|
34
|
-
if (normalized === "effect/Data") return Option.some("Data");
|
|
35
|
-
if (normalized === "effect/Effect") return Option.some("Effect");
|
|
36
|
-
if (normalized === "effect/Match") return Option.some("Match");
|
|
37
|
-
if (normalized === "effect/Schema") return Option.some("Schema");
|
|
38
|
-
if (Str.startsWith("effect/")(normalized)) return Option.some("other");
|
|
39
|
-
return Option.none();
|
|
40
|
-
};
|
|
41
|
-
const bindingsWhere = (imports, keep) => Arr.flatMap(imports, (entry) => keep(entry) ? [entry.binding] : []);
|
|
42
|
-
const named = (entry, module, names) => entry.module === module && Option.exists(entry.imported, names);
|
|
43
|
-
const namespacesOf = (imports, module) => bindingsWhere(imports, (entry) => entry.module === module && Option.isNone(entry.imported) || named(entry, "root", (name) => name === module));
|
|
44
|
-
const importInfo = (imports) => {
|
|
45
|
-
const dataNamespaces = namespacesOf(imports, "Data");
|
|
46
|
-
const schemaNamespaces = namespacesOf(imports, "Schema");
|
|
47
|
-
const tagConstructors = bindingsWhere(imports, (entry) => named(entry, "Data", (name) => HashSet.has(DATA_TAG_EXPORTS, name)) || named(entry, "Schema", (name) => HashSet.has(SCHEMA_TAG_EXPORTS, name)));
|
|
48
|
-
return {
|
|
49
|
-
rootNamespaces: bindingsWhere(imports, (entry) => entry.module === "root" && Option.isNone(entry.imported)),
|
|
50
|
-
effectNamespaces: namespacesOf(imports, "Effect"),
|
|
51
|
-
effectFunctions: Arr.flatMap(imports, (entry) => entry.module === "Effect" && Option.isSome(entry.imported) ? [[entry.binding, entry.imported.value]] : []),
|
|
52
|
-
matchNamespaces: namespacesOf(imports, "Match"),
|
|
53
|
-
matchFunctions: bindingsWhere(imports, (entry) => named(entry, "Match", (name) => HashSet.has(MATCH_METHODS, name))),
|
|
54
|
-
dataNamespaces,
|
|
55
|
-
schemaNamespaces,
|
|
56
|
-
tagConstructors,
|
|
57
|
-
hasTagApi: Arr.isReadonlyArrayNonEmpty(dataNamespaces) || Arr.isReadonlyArrayNonEmpty(schemaNamespaces) || Arr.isReadonlyArrayNonEmpty(tagConstructors)
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
const collectEffectImports = (sourceCode) => importInfo(Arr.flatMap(sourceCode.ast.body, (statement) => {
|
|
61
|
-
if (statement.type !== "ImportDeclaration" || statement.importKind === "type") return [];
|
|
62
|
-
const module = moduleForSource(statement.source.value);
|
|
63
|
-
if (Option.isNone(module)) return [];
|
|
64
|
-
return Arr.flatMap(statement.specifiers, (specifier) => {
|
|
65
|
-
const binding = importBinding(sourceCode, statement, specifier.local);
|
|
66
|
-
if (Option.isNone(binding) || specifier.type === "ImportDefaultSpecifier" || specifier.type === "ImportSpecifier" && /^\s*type\b/u.test(sourceCode.getText(specifier))) return [];
|
|
67
|
-
return [{
|
|
68
|
-
module: module.value,
|
|
69
|
-
imported: specifier.type === "ImportSpecifier" ? Option.some(specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value) : Option.none(),
|
|
70
|
-
binding: binding.value
|
|
71
|
-
}];
|
|
72
|
-
});
|
|
73
|
-
}));
|
|
74
|
-
const isStringLiteral = (node) => node.type === "Literal" && Schema.is(Schema.String)(node.value);
|
|
75
|
-
const memberPropertyName = (node) => {
|
|
76
|
-
if (!node.computed && node.property.type === "Identifier") return Option.some(node.property.name);
|
|
77
|
-
return node.computed && isStringLiteral(node.property) ? Option.some(node.property.value) : Option.none();
|
|
78
|
-
};
|
|
79
|
-
const memberPath = (node) => {
|
|
80
|
-
const property = memberPropertyName(node);
|
|
81
|
-
if (Option.isNone(property)) return Option.none();
|
|
82
|
-
if (node.object.type === "MemberExpression") {
|
|
83
|
-
const parentPath = memberPath(node.object);
|
|
84
|
-
return Option.map(parentPath, (path) => [...path, property.value]);
|
|
85
|
-
}
|
|
86
|
-
return node.object.type === "Identifier" ? Option.some([node.object.name, property.value]) : Option.none();
|
|
87
|
-
};
|
|
88
|
-
const memberRoot = (node) => {
|
|
89
|
-
if (node.type === "MemberExpression") return memberRoot(node.object);
|
|
90
|
-
return node.type === "Identifier" ? Option.some(node) : Option.none();
|
|
91
|
-
};
|
|
92
|
-
const hasBinding = (bindings, node, sourceCode) => {
|
|
93
|
-
const binding = resolveBinding(sourceCode, node);
|
|
94
|
-
return Option.isSome(binding) && bindings.includes(binding.value);
|
|
95
|
-
};
|
|
96
|
-
const effectReferenceName = dual(3, (node, imports, sourceCode) => {
|
|
97
|
-
if (node.type === "Identifier") return Option.flatMap(resolveBinding(sourceCode, node), (binding) => Arr.some(binding.references, (reference) => reference.identifier.start === node.start) ? Option.map(Arr.findFirst(imports.effectFunctions, ([variable]) => variable === binding), ([, name]) => name) : Option.none());
|
|
98
|
-
if (node.type !== "MemberExpression") return Option.none();
|
|
99
|
-
const path = memberPath(node);
|
|
100
|
-
const root = memberRoot(node);
|
|
101
|
-
if (Option.isNone(path) || Option.isNone(root)) return Option.none();
|
|
102
|
-
if (path.value.length === 2 && hasBinding(imports.effectNamespaces, root.value, sourceCode) || path.value.length === 3 && path.value[1] === "Effect" && hasBinding(imports.rootNamespaces, root.value, sourceCode)) return memberPropertyName(node);
|
|
103
|
-
return Option.none();
|
|
104
|
-
});
|
|
105
|
-
const propertyName = (property) => {
|
|
106
|
-
if (!property.computed && property.key.type === "Identifier") return Option.some(property.key.name);
|
|
107
|
-
return isStringLiteral(property.key) ? Option.some(property.key.value) : Option.none();
|
|
108
|
-
};
|
|
109
|
-
const isMatchPatternObject = dual(3, (node, imports, sourceCode) => {
|
|
110
|
-
const call = node.parent;
|
|
111
|
-
if (call.type !== "CallExpression" || !call.arguments.includes(node)) return false;
|
|
112
|
-
if (call.callee.type === "Identifier") return hasBinding(imports.matchFunctions, call.callee, sourceCode);
|
|
113
|
-
if (call.callee.type !== "MemberExpression") return false;
|
|
114
|
-
const path = memberPath(call.callee);
|
|
115
|
-
const root = memberRoot(call.callee);
|
|
116
|
-
if (Option.isNone(path) || Option.isNone(root)) return false;
|
|
117
|
-
if (path.value.length === 2) return hasBinding(imports.matchNamespaces, root.value, sourceCode);
|
|
118
|
-
return path.value.length === 3 && path.value[1] === "Match" && hasBinding(imports.rootNamespaces, root.value, sourceCode);
|
|
119
|
-
});
|
|
120
|
-
// src/shared/array-method.ts
|
|
121
|
-
const ARRAY_RETURNING_METHODS = HashSet.fromIterable([
|
|
122
|
-
"concat",
|
|
123
|
-
"filter",
|
|
124
|
-
"flatMap",
|
|
125
|
-
"map",
|
|
126
|
-
"slice",
|
|
127
|
-
"toReversed",
|
|
128
|
-
"toSorted",
|
|
129
|
-
"toSpliced"
|
|
130
|
-
]);
|
|
131
|
-
const unwrapExpression = (node) => {
|
|
132
|
-
if (node.type === "ParenthesizedExpression" || node.type === "ChainExpression" || node.type === "TSAsExpression" || node.type === "TSTypeAssertion" || node.type === "TSNonNullExpression" || node.type === "TSSatisfiesExpression") return unwrapExpression(node.expression);
|
|
133
|
-
return node;
|
|
134
|
-
};
|
|
135
|
-
const arrayMethodTarget = (node) => {
|
|
136
|
-
const current = unwrapExpression(node);
|
|
137
|
-
if (current.type !== "MemberExpression") return Option.none();
|
|
138
|
-
const { property } = current;
|
|
139
|
-
if (!current.computed && property.type === "Identifier") return Option.some({
|
|
140
|
-
name: property.name,
|
|
141
|
-
object: current.object
|
|
142
|
-
});
|
|
143
|
-
if (current.computed && property.type === "Literal" && Schema.is(Schema.String)(property.value)) return Option.some({
|
|
144
|
-
name: property.value,
|
|
145
|
-
object: current.object
|
|
146
|
-
});
|
|
147
|
-
return Option.none();
|
|
148
|
-
};
|
|
149
|
-
const isArrayAnnotation = (type) => {
|
|
150
|
-
if (type.type === "TSArrayType" || type.type === "TSTupleType") return true;
|
|
151
|
-
if (type.type === "TSParenthesizedType") return isArrayAnnotation(type.typeAnnotation);
|
|
152
|
-
if (type.type === "TSTypeOperator" && type.operator === "readonly") return isArrayAnnotation(type.typeAnnotation);
|
|
153
|
-
return type.type === "TSTypeReference" && type.typeName.type === "Identifier" && (type.typeName.name === "Array" || type.typeName.name === "ReadonlyArray");
|
|
154
|
-
};
|
|
155
|
-
const isKnownArrayExpression = dual((args) => "getScope" in args[0], (sourceCode, node, visited = []) => {
|
|
156
|
-
const current = unwrapExpression(node);
|
|
157
|
-
if (current.type === "ArrayExpression") return true;
|
|
158
|
-
if (current.type === "CallExpression") {
|
|
159
|
-
const method = arrayMethodTarget(current.callee);
|
|
160
|
-
return Option.isSome(method) && HashSet.has(ARRAY_RETURNING_METHODS, method.value.name) && isKnownArrayExpression(sourceCode, method.value.object, visited);
|
|
161
|
-
}
|
|
162
|
-
if (current.type !== "Identifier") return false;
|
|
163
|
-
const binding = resolveBinding(sourceCode, current);
|
|
164
|
-
if (Option.isNone(binding) || visited.includes(binding.value)) return false;
|
|
165
|
-
const variable = binding.value;
|
|
166
|
-
const nextVisited = [...visited, variable];
|
|
167
|
-
if (Arr.some(variable.references, (reference) => reference.isWrite() && !reference.init)) return false;
|
|
168
|
-
const annotation = Arr.findFirst(variable.identifiers, (identifier) => Option.fromUndefinedOr(identifier.typeAnnotation?.typeAnnotation));
|
|
169
|
-
if (Option.isSome(annotation)) return isArrayAnnotation(annotation.value);
|
|
170
|
-
return Option.getOrElse(Arr.findFirst(variable.defs, (definition) => {
|
|
171
|
-
if (definition.type === "Variable" && definition.node.type === "VariableDeclarator" && definition.node.id.type === "Identifier" && definition.node.init !== null && definition.node.parent.type === "VariableDeclaration" && definition.node.parent.kind === "const") {
|
|
172
|
-
const initial = definition.node.init;
|
|
173
|
-
return Option.some(isKnownArrayExpression(sourceCode, initial, nextVisited));
|
|
174
|
-
}
|
|
175
|
-
return Option.none();
|
|
176
|
-
}), () => false);
|
|
177
|
-
});
|
|
178
|
-
export { effectReferenceName as a, memberPropertyName as c, collectEffectImports as i, propertyName as l, isKnownArrayExpression as n, isMatchPatternObject as o, unwrapExpression as r, isStringLiteral as s, arrayMethodTarget as t, resolveBinding as u };
|
package/dist/foldkit.d.mts
DELETED
package/dist/foldkit.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as Arr from "effect/Array";
|
|
2
|
-
import upstream from "@foldkit/oxlint-plugin";
|
|
3
|
-
// src/foldkit.ts
|
|
4
|
-
const serverGlobals = upstream.rules["no-nonportable-server-globals"];
|
|
5
|
-
const plugin = {
|
|
6
|
-
...upstream,
|
|
7
|
-
rules: {
|
|
8
|
-
...upstream.rules,
|
|
9
|
-
"no-nonportable-server-globals": {
|
|
10
|
-
...serverGlobals,
|
|
11
|
-
create(context) {
|
|
12
|
-
return Arr.some(context.sourceCode.ast.body, (node) => node.type === "ImportDeclaration" && node.importKind !== "type" && (node.source.value === "vite-plus/test/browser" || node.source.value === "vitest/browser") && (Arr.isReadonlyArrayEmpty(node.specifiers) || Arr.some(node.specifiers, (specifier) => specifier.type !== "ImportSpecifier" || specifier.importKind !== "type"))) ? {} : serverGlobals.create(context);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
export { plugin as default };
|