@milkenjoyer/toolchain 0.7.0 → 0.7.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/{effect-plugin-ByuWwyB8.mjs → effect-plugin-kYxB-5LJ.mjs} +60 -4
- package/dist/effect-plugin.d.mts +2 -2
- package/dist/effect-plugin.mjs +1 -1
- package/dist/effect-tsgo.d.mts +2 -1
- package/dist/effect-tsgo.mjs +8 -4
- package/dist/foldkit-plugin.d.mts +7 -0
- package/dist/foldkit-plugin.mjs +32 -0
- package/dist/guard.mjs +2 -2
- package/dist/lint.d.mts +2 -1
- package/dist/lint.mjs +52 -8
- package/dist/{plugin-C3DDlAbr.mjs → plugin-BoBRGtGf.mjs} +38 -13
- package/dist/plugin.d.mts +1 -0
- package/dist/plugin.mjs +1 -1
- package/dist/rules.d.mts +11 -2
- package/dist/rules.mjs +8 -3
- package/dist/syntax-CGEOffZK.mjs +17 -0
- package/package.json +5 -1
- package/tsconfig.base.json +13 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as memberPropertyName } from "./syntax-CGEOffZK.mjs";
|
|
1
2
|
import * as Arr from "effect/Array";
|
|
2
3
|
import { pipe } from "effect/Function";
|
|
3
4
|
import * as HashSet from "effect/HashSet";
|
|
@@ -3486,20 +3487,75 @@ const plugin$1 = Plugin.define({
|
|
|
3486
3487
|
specifier: "@mpsuesser/oxlint-plugin-effect",
|
|
3487
3488
|
rules
|
|
3488
3489
|
});
|
|
3490
|
+
// src/rules/use-temp-file-scoped.ts
|
|
3491
|
+
const isOs = (source) => source === "os" || source === "node:os";
|
|
3492
|
+
const isOsBinding = (source, node) => {
|
|
3493
|
+
const lookup = (scope) => {
|
|
3494
|
+
const variable = scope.set.get(node.name);
|
|
3495
|
+
if (variable === void 0) return scope.upper === null ? false : lookup(scope.upper);
|
|
3496
|
+
return Arr.some(variable.defs, (definition) => definition.type === "ImportBinding" && (definition.node.type === "ImportDefaultSpecifier" || definition.node.type === "ImportNamespaceSpecifier") && definition.parent?.type === "ImportDeclaration" && isOs(definition.parent.source.value));
|
|
3497
|
+
};
|
|
3498
|
+
return lookup(source.getScope(node));
|
|
3499
|
+
};
|
|
3500
|
+
const isManagedAcquire = (node) => {
|
|
3501
|
+
const parent = node.parent;
|
|
3502
|
+
if (parent === null) return false;
|
|
3503
|
+
if (parent.type === "CallExpression" && parent.arguments[0] === node && parent.callee.type === "MemberExpression" && parent.callee.object.type === "Identifier" && parent.callee.object.name === "Effect" && Option.exists(memberPropertyName(parent.callee), (name) => name === "acquireRelease" || name === "acquireUseRelease")) return true;
|
|
3504
|
+
return isManagedAcquire(parent);
|
|
3505
|
+
};
|
|
3506
|
+
const useTempFileScopedRule = Rule.define({
|
|
3507
|
+
name: "use-temp-file-scoped",
|
|
3508
|
+
meta: Rule.meta({
|
|
3509
|
+
type: "suggestion",
|
|
3510
|
+
description: "Prefer scoped temporary files and directories with automatic cleanup",
|
|
3511
|
+
messages: {
|
|
3512
|
+
tmpdir: "Avoid `os.tmpdir()` — use `FileSystem.makeTempFileScoped` from `@effect/platform` for scoped temp files with automatic cleanup.",
|
|
3513
|
+
unscoped: "Avoid `{{api}}` — the unscoped variant requires manual cleanup. Use `{{api}}Scoped` so the resource is finalized when its scope closes."
|
|
3514
|
+
}
|
|
3515
|
+
}),
|
|
3516
|
+
*create() {
|
|
3517
|
+
const context = yield* RuleContext;
|
|
3518
|
+
return {
|
|
3519
|
+
ImportDeclaration: (node) => node.type === "ImportDeclaration" && isOs(node.source.value) ? Effect.forEach(Arr.filter(node.specifiers, (specifier) => specifier.type === "ImportSpecifier" && (specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value) === "tmpdir"), (specifier) => context.report(Diagnostic.fromId({
|
|
3520
|
+
node: specifier,
|
|
3521
|
+
messageId: "tmpdir"
|
|
3522
|
+
})), {
|
|
3523
|
+
concurrency: 1,
|
|
3524
|
+
discard: true
|
|
3525
|
+
}) : Effect.void,
|
|
3526
|
+
MemberExpression: (node) => node.type === "MemberExpression" && Option.contains(memberPropertyName(node), "tmpdir") && node.object.type === "Identifier" && isOsBinding(context.sourceCode, node.object) ? context.report(Diagnostic.fromId({
|
|
3527
|
+
node,
|
|
3528
|
+
messageId: "tmpdir"
|
|
3529
|
+
})) : Effect.void,
|
|
3530
|
+
CallExpression: (node) => {
|
|
3531
|
+
if (node.type !== "CallExpression" || node.callee.type !== "MemberExpression" || isManagedAcquire(node)) return Effect.void;
|
|
3532
|
+
return Option.match(Option.filter(memberPropertyName(node.callee), (name) => name === "makeTempFile" || name === "makeTempDirectory"), {
|
|
3533
|
+
onNone: () => Effect.void,
|
|
3534
|
+
onSome: (api) => context.report(Diagnostic.fromId({
|
|
3535
|
+
node,
|
|
3536
|
+
messageId: "unscoped",
|
|
3537
|
+
data: { api }
|
|
3538
|
+
}))
|
|
3539
|
+
});
|
|
3540
|
+
}
|
|
3541
|
+
};
|
|
3542
|
+
}
|
|
3543
|
+
});
|
|
3489
3544
|
// src/effect-plugin.ts
|
|
3490
3545
|
const kept = [
|
|
3491
3546
|
"avoid-mutable-state",
|
|
3492
3547
|
"avoid-option-getorthrow",
|
|
3493
|
-
"effect-run-in-body",
|
|
3494
3548
|
"no-chained-type-assertions",
|
|
3495
3549
|
"no-module-mocking",
|
|
3496
3550
|
"prefer-redacted-config",
|
|
3497
3551
|
"require-effect-concurrency",
|
|
3498
|
-
"throw-in-effect-gen"
|
|
3499
|
-
"use-temp-file-scoped"
|
|
3552
|
+
"throw-in-effect-gen"
|
|
3500
3553
|
];
|
|
3501
3554
|
const plugin = {
|
|
3502
3555
|
meta: plugin$1.meta,
|
|
3503
|
-
rules:
|
|
3556
|
+
rules: {
|
|
3557
|
+
...R.filter(plugin$1.rules, (_rule, name) => kept.includes(name)),
|
|
3558
|
+
"use-temp-file-scoped": useTempFileScopedRule
|
|
3559
|
+
}
|
|
3504
3560
|
};
|
|
3505
3561
|
export { plugin as t };
|
package/dist/effect-plugin.d.mts
CHANGED
|
@@ -3952,7 +3952,7 @@ interface RuleReplacedByExternalSpecifier {
|
|
|
3952
3952
|
*/
|
|
3953
3953
|
url?: string;
|
|
3954
3954
|
}
|
|
3955
|
-
interface CreateRule {
|
|
3955
|
+
interface CreateRule$1 {
|
|
3956
3956
|
meta?: RuleMeta;
|
|
3957
3957
|
create: (context: Context) => VisitorObject;
|
|
3958
3958
|
}
|
|
@@ -3962,6 +3962,6 @@ interface CreateRule {
|
|
|
3962
3962
|
*
|
|
3963
3963
|
* @since 0.2.2
|
|
3964
3964
|
*/
|
|
3965
|
-
declare const plugin$1: Plugin.DefinedPlugin<Record<string, CreateRule>>;
|
|
3965
|
+
declare const plugin$1: Plugin.DefinedPlugin<Record<string, CreateRule$1>>;
|
|
3966
3966
|
declare const plugin: Pick<typeof plugin$1, "meta" | "rules">;
|
|
3967
3967
|
export { plugin as default };
|
package/dist/effect-plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as default } from "./effect-plugin-
|
|
1
|
+
export { t as default } from "./effect-plugin-kYxB-5LJ.mjs";
|
package/dist/effect-tsgo.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const patchCommand = "effect-tsgo patch --oxlint";
|
|
2
2
|
export declare const effectTsgoPlugin = "effecttsgo";
|
|
3
|
+
export declare const disabledRecommendedTsgoRules: ReadonlyArray<string>;
|
|
3
4
|
export declare const enforcedTsgoRules: ReadonlyArray<string>;
|
|
4
|
-
export declare const effectTsgoRules: Readonly<Record<string, "error">>;
|
|
5
|
+
export declare const effectTsgoRules: Readonly<Record<string, "error" | "off">>;
|
package/dist/effect-tsgo.mjs
CHANGED
|
@@ -7,7 +7,6 @@ import * as Struct from "effect/Struct";
|
|
|
7
7
|
const patchCommand = "effect-tsgo patch --oxlint";
|
|
8
8
|
const effectTsgoPlugin = "effecttsgo";
|
|
9
9
|
const beyondRecommended = [
|
|
10
|
-
"effecttsgo/any-unknown-in-error-context",
|
|
11
10
|
"effecttsgo/crypto-random-uuid-in-effect",
|
|
12
11
|
"effecttsgo/effect-try-without-catch",
|
|
13
12
|
"effecttsgo/global-date-in-effect",
|
|
@@ -18,6 +17,11 @@ const beyondRecommended = [
|
|
|
18
17
|
"effecttsgo/missing-effect-service-dependency",
|
|
19
18
|
"effecttsgo/unsafe-effect-type-assertion"
|
|
20
19
|
];
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const disabledRecommendedTsgoRules = [
|
|
21
|
+
"effecttsgo/schema-number",
|
|
22
|
+
"effecttsgo/return-effect-in-gen",
|
|
23
|
+
"effecttsgo/layer-merge-all-with-dependencies"
|
|
24
|
+
];
|
|
25
|
+
const enforcedTsgoRules = Arr.sort(Arr.dedupe([...Arr.filter(Struct.keys(presets.recommended.rules ?? {}), (rule) => !disabledRecommendedTsgoRules.includes(rule)), ...beyondRecommended]), Order.String);
|
|
26
|
+
const effectTsgoRules = R.fromEntries([...Arr.map(enforcedTsgoRules, (rule) => [rule, "error"]), ...Arr.map(disabledRecommendedTsgoRules, (rule) => [rule, "off"])]);
|
|
27
|
+
export { disabledRecommendedTsgoRules, effectTsgoPlugin, effectTsgoRules, enforcedTsgoRules, patchCommand };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as Arr from "effect/Array";
|
|
2
|
+
import * as R from "effect/Record";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
import upstream from "@foldkit/oxlint-plugin";
|
|
8
|
+
// src/foldkit-plugin.ts
|
|
9
|
+
const Dependencies = Schema.Record(Schema.String, Schema.Unknown).pipe(Schema.withDecodingDefaultKey(Effect.succeed({})));
|
|
10
|
+
const Manifest = Schema.fromJsonString(Schema.Struct({
|
|
11
|
+
dependencies: Dependencies,
|
|
12
|
+
devDependencies: Dependencies,
|
|
13
|
+
peerDependencies: Dependencies
|
|
14
|
+
}));
|
|
15
|
+
const packages = /* @__PURE__ */ new Map();
|
|
16
|
+
const usesFoldkit = (directory) => {
|
|
17
|
+
const cached = packages.get(directory);
|
|
18
|
+
if (cached !== void 0) return cached;
|
|
19
|
+
const file = join(directory, "package.json");
|
|
20
|
+
const parent = dirname(directory);
|
|
21
|
+
const enabled = existsSync(file) ? Arr.some(R.values(Schema.decodeSync(Manifest)(readFileSync(file, "utf8"))), (dependencies) => R.has(dependencies, "foldkit")) : parent !== directory && usesFoldkit(parent);
|
|
22
|
+
packages.set(directory, enabled);
|
|
23
|
+
return enabled;
|
|
24
|
+
};
|
|
25
|
+
const plugin = {
|
|
26
|
+
meta: upstream.meta,
|
|
27
|
+
rules: R.map(upstream.rules, (rule) => ({
|
|
28
|
+
...rule,
|
|
29
|
+
create: (context) => usesFoldkit(dirname(context.filename)) ? rule.create(context) : {}
|
|
30
|
+
}))
|
|
31
|
+
};
|
|
32
|
+
export { plugin as default };
|
package/dist/guard.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { latestOf, onLatestLine, otherTags } from "./compatible.mjs";
|
|
2
2
|
import { enforcedTsgoRules } from "./effect-tsgo.mjs";
|
|
3
3
|
import { exceptions } from "./exceptions.mjs";
|
|
4
|
-
import { birbprophetRules, effectRules, foldkitPreset } from "./lint.mjs";
|
|
4
|
+
import { birbprophetRules, effectRules, foldkitPreset, toolchainScopes } from "./lint.mjs";
|
|
5
5
|
import { lead, versionOf } from "./versions.mjs";
|
|
6
6
|
import * as Arr from "effect/Array";
|
|
7
7
|
import { dual } from "effect/Function";
|
|
@@ -92,7 +92,7 @@ const guarded = [
|
|
|
92
92
|
...R.keys(birbprophetRules),
|
|
93
93
|
...enforcedTsgoRules
|
|
94
94
|
];
|
|
95
|
-
const presetScopes = Arr.map(foldkitPreset.overrides, ({ files, rules }) => ({
|
|
95
|
+
const presetScopes = Arr.map([...foldkitPreset.overrides, ...toolchainScopes], ({ files, rules = {} }) => ({
|
|
96
96
|
files,
|
|
97
97
|
rules: R.keys(R.filter(rules, (setting) => setting === "off"))
|
|
98
98
|
}));
|
package/dist/lint.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OxlintConfig } from "vite-plus/lint";
|
|
1
|
+
import { OxlintConfig, OxlintOverride } from "vite-plus/lint";
|
|
2
2
|
export type LintOptions = {
|
|
3
3
|
readonly ignores?: ReadonlyArray<string>;
|
|
4
4
|
};
|
|
@@ -18,6 +18,7 @@ export declare const foldkitPreset: {
|
|
|
18
18
|
};
|
|
19
19
|
}[];
|
|
20
20
|
};
|
|
21
|
+
export declare const toolchainScopes: ReadonlyArray<OxlintOverride>;
|
|
21
22
|
export declare const effectRules: Record<string, "error">;
|
|
22
23
|
export declare const birbprophetRules: Record<string, "error">;
|
|
23
24
|
export declare const lint: ({ ignores }?: LintOptions) => OxlintConfig;
|
package/dist/lint.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as plugin } from "./effect-plugin-
|
|
1
|
+
import { t as plugin } from "./effect-plugin-kYxB-5LJ.mjs";
|
|
2
2
|
import { effectTsgoPlugin, effectTsgoRules } from "./effect-tsgo.mjs";
|
|
3
3
|
import { exceptions } from "./exceptions.mjs";
|
|
4
|
-
import { t as plugin$1 } from "./plugin-
|
|
4
|
+
import { t as plugin$1 } from "./plugin-BoBRGtGf.mjs";
|
|
5
5
|
import { staticRules } from "./rules.mjs";
|
|
6
6
|
import * as Arr from "effect/Array";
|
|
7
7
|
import * as Option from "effect/Option";
|
|
@@ -46,6 +46,46 @@ const FoldkitPreset = Schema.Struct({
|
|
|
46
46
|
}))
|
|
47
47
|
});
|
|
48
48
|
const foldkitPreset = Schema.decodeUnknownSync(FoldkitPreset)(foldkitRecommended);
|
|
49
|
+
const testFiles = [
|
|
50
|
+
"**/*.test.ts",
|
|
51
|
+
"**/*.test.tsx",
|
|
52
|
+
"**/*.spec.ts",
|
|
53
|
+
"**/*.spec.tsx",
|
|
54
|
+
"**/*.fake.ts",
|
|
55
|
+
"**/*.fake.tsx",
|
|
56
|
+
"**/tests/**",
|
|
57
|
+
"**/test/**"
|
|
58
|
+
];
|
|
59
|
+
const toolchainScopes = [
|
|
60
|
+
{
|
|
61
|
+
files: ["**/*.astro"],
|
|
62
|
+
rules: { "unicorn/prefer-module": "off" }
|
|
63
|
+
},
|
|
64
|
+
...Arr.map(Arr.filter(foldkitPreset.overrides, (scope) => scope.files.includes("**/*.test.ts") && scope.excludeFiles === void 0), ({ rules }) => ({
|
|
65
|
+
files: ["**/tests/**", "**/test/**"],
|
|
66
|
+
rules
|
|
67
|
+
})),
|
|
68
|
+
{
|
|
69
|
+
files: testFiles,
|
|
70
|
+
rules: {
|
|
71
|
+
"effecttsgo/lazy-effect": "off",
|
|
72
|
+
"eslint/no-extend-native": "off",
|
|
73
|
+
"typescript/unbound-method": "off",
|
|
74
|
+
"typescript/no-deprecated": "off",
|
|
75
|
+
"effect/use-temp-file-scoped": "off",
|
|
76
|
+
"birbprophet/no-process-env": "off"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
files: [
|
|
81
|
+
"**/*.config.ts",
|
|
82
|
+
"**/*.config.mts",
|
|
83
|
+
"**/*.config.js",
|
|
84
|
+
"**/*.config.mjs"
|
|
85
|
+
],
|
|
86
|
+
rules: { "birbprophet/no-process-env": "off" }
|
|
87
|
+
}
|
|
88
|
+
];
|
|
49
89
|
const atError = (prefix, rules) => R.fromEntries(Arr.map(rules, (rule) => [`${prefix}/${rule}`, "error"]));
|
|
50
90
|
const effectRules = atError(plugin.meta.name, R.keys(plugin.rules));
|
|
51
91
|
const birbprophetRules = atError(plugin$1.meta.name, R.keys(plugin$1.rules));
|
|
@@ -65,10 +105,10 @@ const lint = ({ ignores = [] } = {}) => ({
|
|
|
65
105
|
name: "vite-plus",
|
|
66
106
|
specifier: resolved("vite-plus/oxlint-plugin")
|
|
67
107
|
},
|
|
68
|
-
|
|
69
|
-
name,
|
|
70
|
-
specifier:
|
|
71
|
-
}
|
|
108
|
+
{
|
|
109
|
+
name: "foldkit",
|
|
110
|
+
specifier: sibling("foldkit-plugin")
|
|
111
|
+
},
|
|
72
112
|
{
|
|
73
113
|
name: plugin.meta.name,
|
|
74
114
|
specifier: sibling("effect-plugin")
|
|
@@ -90,7 +130,11 @@ const lint = ({ ignores = [] } = {}) => ({
|
|
|
90
130
|
...birbprophetRules,
|
|
91
131
|
...effectTsgoRules
|
|
92
132
|
},
|
|
93
|
-
overrides: [
|
|
133
|
+
overrides: [
|
|
134
|
+
...foldkitPreset.overrides,
|
|
135
|
+
...toolchainScopes,
|
|
136
|
+
...Arr.map(exceptions, exceptionTier)
|
|
137
|
+
],
|
|
94
138
|
ignorePatterns: [...coreIgnores, ...ignores]
|
|
95
139
|
});
|
|
96
|
-
export { birbprophetRules, effectRules, foldkitPreset, lint };
|
|
140
|
+
export { birbprophetRules, effectRules, foldkitPreset, lint, toolchainScopes };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { i as unwrapExpression, n as memberPropertyName, r as propertyName, t as isStringLiteral } from "./syntax-CGEOffZK.mjs";
|
|
1
2
|
import * as Arr from "effect/Array";
|
|
2
3
|
import { dual } from "effect/Function";
|
|
3
4
|
import * as HashSet from "effect/HashSet";
|
|
4
5
|
import * as Option from "effect/Option";
|
|
5
|
-
import * as Schema from "effect/Schema";
|
|
6
6
|
import * as Str from "effect/String";
|
|
7
7
|
import { Comment, Diagnostic, Plugin, Rule, RuleContext } from "effect-oxlint";
|
|
8
8
|
import * as Effect from "effect/Effect";
|
|
@@ -26,20 +26,34 @@ const noCommentsRule = Rule.define({
|
|
|
26
26
|
}),
|
|
27
27
|
name: "no-comments"
|
|
28
28
|
});
|
|
29
|
-
// src/
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
return node;
|
|
29
|
+
// src/rules/no-process-env.ts
|
|
30
|
+
const passesEnvironment = (node) => {
|
|
31
|
+
const parent = node.parent;
|
|
32
|
+
return parent.type === "SpreadElement" || (parent.type === "CallExpression" || parent.type === "NewExpression") && parent.arguments.includes(node) || parent.type === "VariableDeclarator" && parent.init === node && parent.id.type === "ObjectPattern" && Arr.some(parent.id.properties, (property) => property.type === "RestElement");
|
|
33
33
|
};
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return isStringLiteral(property.key) ? Option.some(property.key.value) : Option.none();
|
|
34
|
+
const isGlobalProcess = (source, node) => {
|
|
35
|
+
const lookup = (scope) => {
|
|
36
|
+
const variable = scope.set.get(node.name);
|
|
37
|
+
if (variable !== void 0 && variable.defs.length > 0) return false;
|
|
38
|
+
return scope.upper === null ? true : lookup(scope.upper);
|
|
39
|
+
};
|
|
40
|
+
return lookup(source.getScope(node));
|
|
42
41
|
};
|
|
42
|
+
const noProcessEnvRule = Rule.define({
|
|
43
|
+
name: "no-process-env",
|
|
44
|
+
meta: Rule.meta({
|
|
45
|
+
type: "suggestion",
|
|
46
|
+
description: "Read configuration through Effect Config",
|
|
47
|
+
messages: { config: "Read configuration through Effect Config. Passing the whole environment through is allowed." }
|
|
48
|
+
}),
|
|
49
|
+
*create() {
|
|
50
|
+
const context = yield* RuleContext;
|
|
51
|
+
return { MemberExpression: (node) => node.type === "MemberExpression" && node.object.type === "Identifier" && node.object.name === "process" && isGlobalProcess(context.sourceCode, node.object) && Option.contains(memberPropertyName(node), "env") && !passesEnvironment(node) ? context.report(Diagnostic.fromId({
|
|
52
|
+
node,
|
|
53
|
+
messageId: "config"
|
|
54
|
+
})) : Effect.void };
|
|
55
|
+
}
|
|
56
|
+
});
|
|
43
57
|
// src/shared/member-path.ts
|
|
44
58
|
const resolveBinding = (sourceCode, node) => {
|
|
45
59
|
const findBinding = (scope) => Option.flatMap(scope, (current) => Option.orElse(Option.fromUndefinedOr(current.set.get(node.name)), () => findBinding(Option.fromNullishOr(current.upper))));
|
|
@@ -127,6 +141,16 @@ const preferAccessibleSceneLocatorsRule = Rule.define({
|
|
|
127
141
|
"all",
|
|
128
142
|
"selector"
|
|
129
143
|
])) return Effect.void;
|
|
144
|
+
const assertion = node.parent;
|
|
145
|
+
if (assertion.type === "CallExpression" && assertion.arguments[0] === node && isFoldkitCall(context.sourceCode, assertion, ["Scene", "expect"])) {
|
|
146
|
+
const member = assertion.parent;
|
|
147
|
+
if (member.type === "MemberExpression" && member.object === assertion) {
|
|
148
|
+
const absent = Option.contains(memberPropertyName(member), "toBeAbsent") && member.parent.type === "CallExpression" && member.parent.callee === member;
|
|
149
|
+
const negated = member.parent;
|
|
150
|
+
const matcher = negated.parent;
|
|
151
|
+
if (absent || Option.contains(memberPropertyName(member), "not") && negated.type === "MemberExpression" && negated.object === member && Option.contains(memberPropertyName(negated), "toExist") && matcher?.type === "CallExpression" && matcher.callee === negated) return Effect.void;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
130
154
|
const [css] = node.arguments;
|
|
131
155
|
if (css === void 0) return Effect.void;
|
|
132
156
|
return Option.match(Option.filter(textWithHoles(css, "x"), (text) => fitsAccessibleLocator(Str.replaceAll(QUOTED, "\"\"")(text))), {
|
|
@@ -259,6 +283,7 @@ const plugin = Plugin.define({
|
|
|
259
283
|
name: "birbprophet",
|
|
260
284
|
rules: {
|
|
261
285
|
"no-comments": noCommentsRule,
|
|
286
|
+
"no-process-env": noProcessEnvRule,
|
|
262
287
|
"prefer-accessible-scene-locators": preferAccessibleSceneLocatorsRule,
|
|
263
288
|
"require-command-answer-names": requireCommandAnswerNamesRule,
|
|
264
289
|
"require-past-tense-messages": requirePastTenseMessagesRule
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Plugin } from "effect-oxlint";
|
|
2
2
|
declare const plugin: Plugin.DefinedPlugin<{
|
|
3
3
|
readonly "no-comments": import("effect-oxlint").CreateRule;
|
|
4
|
+
readonly "no-process-env": import("effect-oxlint").CreateRule;
|
|
4
5
|
readonly "prefer-accessible-scene-locators": import("effect-oxlint").CreateRule;
|
|
5
6
|
readonly "require-command-answer-names": import("effect-oxlint").CreateRule;
|
|
6
7
|
readonly "require-past-tense-messages": import("effect-oxlint").CreateRule;
|
package/dist/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as default } from "./plugin-
|
|
1
|
+
export { t as default } from "./plugin-BoBRGtGf.mjs";
|
package/dist/rules.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const staticRules: {
|
|
2
|
+
"effecttsgo/any-unknown-in-error-context": "off";
|
|
2
3
|
"effecttsgo/strict-effect-provide": "off";
|
|
3
4
|
"eslint/array-callback-return": "error";
|
|
4
5
|
"eslint/constructor-super": "off";
|
|
@@ -53,11 +54,12 @@ export declare const staticRules: {
|
|
|
53
54
|
"import/no-cycle": "error";
|
|
54
55
|
"import/no-mutable-exports": "error";
|
|
55
56
|
"import/no-unassigned-import": "off";
|
|
56
|
-
"node/no-process-env": "
|
|
57
|
+
"node/no-process-env": "off";
|
|
57
58
|
"oxc/bad-bitwise-operator": "error";
|
|
58
59
|
"oxc/no-accumulating-spread": "error";
|
|
59
60
|
"promise/always-return": "off";
|
|
60
61
|
"promise/no-return-in-finally": "error";
|
|
62
|
+
"promise/valid-params": "off";
|
|
61
63
|
"typescript/ban-ts-comment": "error";
|
|
62
64
|
"typescript/method-signature-style": "error";
|
|
63
65
|
"typescript/no-deprecated": "error";
|
|
@@ -92,15 +94,22 @@ export declare const staticRules: {
|
|
|
92
94
|
"unicorn/consistent-function-scoping": "off";
|
|
93
95
|
"unicorn/new-for-builtins": "error";
|
|
94
96
|
"unicorn/no-abusive-eslint-disable": "error";
|
|
95
|
-
"unicorn/no-document-cookie": "
|
|
97
|
+
"unicorn/no-document-cookie": "off";
|
|
96
98
|
"unicorn/no-negation-in-equality-check": "error";
|
|
97
99
|
"unicorn/no-new-buffer": "error";
|
|
98
100
|
"unicorn/no-object-as-default-parameter": "error";
|
|
99
101
|
"unicorn/no-unnecessary-await": "off";
|
|
102
|
+
"unicorn/require-post-message-target-origin": "off";
|
|
100
103
|
"unicorn/prefer-module": "error";
|
|
101
104
|
"unicorn/prefer-number-properties": "error";
|
|
102
105
|
"vitest/expect-expect": "off";
|
|
103
106
|
"vitest/no-identical-title": "error";
|
|
104
107
|
"vitest/no-import-node-test": "error";
|
|
105
108
|
"vitest/no-standalone-expect": "off";
|
|
109
|
+
"vitest/valid-expect": ["error", {
|
|
110
|
+
maxArgs: number;
|
|
111
|
+
}];
|
|
112
|
+
"vitest/valid-title": ["error", {
|
|
113
|
+
allowArguments: boolean;
|
|
114
|
+
}];
|
|
106
115
|
};
|
package/dist/rules.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const staticRules = {
|
|
2
|
+
"effecttsgo/any-unknown-in-error-context": "off",
|
|
2
3
|
"effecttsgo/strict-effect-provide": "off",
|
|
3
4
|
"eslint/array-callback-return": "error",
|
|
4
5
|
"eslint/constructor-super": "off",
|
|
@@ -58,11 +59,12 @@ const staticRules = {
|
|
|
58
59
|
"import/no-cycle": "error",
|
|
59
60
|
"import/no-mutable-exports": "error",
|
|
60
61
|
"import/no-unassigned-import": "off",
|
|
61
|
-
"node/no-process-env": "
|
|
62
|
+
"node/no-process-env": "off",
|
|
62
63
|
"oxc/bad-bitwise-operator": "error",
|
|
63
64
|
"oxc/no-accumulating-spread": "error",
|
|
64
65
|
"promise/always-return": "off",
|
|
65
66
|
"promise/no-return-in-finally": "error",
|
|
67
|
+
"promise/valid-params": "off",
|
|
66
68
|
"typescript/ban-ts-comment": "error",
|
|
67
69
|
"typescript/method-signature-style": "error",
|
|
68
70
|
"typescript/no-deprecated": "error",
|
|
@@ -97,16 +99,19 @@ const staticRules = {
|
|
|
97
99
|
"unicorn/consistent-function-scoping": "off",
|
|
98
100
|
"unicorn/new-for-builtins": "error",
|
|
99
101
|
"unicorn/no-abusive-eslint-disable": "error",
|
|
100
|
-
"unicorn/no-document-cookie": "
|
|
102
|
+
"unicorn/no-document-cookie": "off",
|
|
101
103
|
"unicorn/no-negation-in-equality-check": "error",
|
|
102
104
|
"unicorn/no-new-buffer": "error",
|
|
103
105
|
"unicorn/no-object-as-default-parameter": "error",
|
|
104
106
|
"unicorn/no-unnecessary-await": "off",
|
|
107
|
+
"unicorn/require-post-message-target-origin": "off",
|
|
105
108
|
"unicorn/prefer-module": "error",
|
|
106
109
|
"unicorn/prefer-number-properties": "error",
|
|
107
110
|
"vitest/expect-expect": "off",
|
|
108
111
|
"vitest/no-identical-title": "error",
|
|
109
112
|
"vitest/no-import-node-test": "error",
|
|
110
|
-
"vitest/no-standalone-expect": "off"
|
|
113
|
+
"vitest/no-standalone-expect": "off",
|
|
114
|
+
"vitest/valid-expect": ["error", { maxArgs: 2 }],
|
|
115
|
+
"vitest/valid-title": ["error", { allowArguments: true }]
|
|
111
116
|
};
|
|
112
117
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milkenjoyer/toolchain",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/birbprophet/agent-kit.git",
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"types": "./dist/effect-plugin.d.mts",
|
|
34
34
|
"default": "./dist/effect-plugin.mjs"
|
|
35
35
|
},
|
|
36
|
+
"./foldkit-plugin": {
|
|
37
|
+
"types": "./dist/foldkit-plugin.d.mts",
|
|
38
|
+
"default": "./dist/foldkit-plugin.mjs"
|
|
39
|
+
},
|
|
36
40
|
"./exceptions": {
|
|
37
41
|
"types": "./dist/exceptions.d.mts",
|
|
38
42
|
"default": "./dist/exceptions.mjs"
|
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
|
]
|