@milkenjoyer/toolchain 0.7.0 → 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.
@@ -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,6 +3487,54 @@ 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 useTempFileScopedRule = Rule.define({
3501
+ name: "use-temp-file-scoped",
3502
+ meta: Rule.meta({
3503
+ type: "suggestion",
3504
+ description: "Prefer scoped temporary files and directories with automatic cleanup",
3505
+ messages: {
3506
+ tmpdir: "Avoid `os.tmpdir()` — use `FileSystem.makeTempFileScoped` from `@effect/platform` for scoped temp files with automatic cleanup.",
3507
+ unscoped: "Avoid `{{api}}` — the unscoped variant requires manual cleanup. Use `{{api}}Scoped` so the resource is finalized when its scope closes."
3508
+ }
3509
+ }),
3510
+ *create() {
3511
+ const context = yield* RuleContext;
3512
+ return {
3513
+ 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({
3514
+ node: specifier,
3515
+ messageId: "tmpdir"
3516
+ })), {
3517
+ concurrency: 1,
3518
+ discard: true
3519
+ }) : Effect.void,
3520
+ MemberExpression: (node) => node.type === "MemberExpression" && Option.contains(memberPropertyName(node), "tmpdir") && node.object.type === "Identifier" && isOsBinding(context.sourceCode, node.object) ? context.report(Diagnostic.fromId({
3521
+ node,
3522
+ messageId: "tmpdir"
3523
+ })) : Effect.void,
3524
+ CallExpression: (node) => {
3525
+ if (node.type !== "CallExpression" || node.callee.type !== "MemberExpression") return Effect.void;
3526
+ return Option.match(Option.filter(memberPropertyName(node.callee), (name) => name === "makeTempFile" || name === "makeTempDirectory"), {
3527
+ onNone: () => Effect.void,
3528
+ onSome: (api) => context.report(Diagnostic.fromId({
3529
+ node,
3530
+ messageId: "unscoped",
3531
+ data: { api }
3532
+ }))
3533
+ });
3534
+ }
3535
+ };
3536
+ }
3537
+ });
3489
3538
  // src/effect-plugin.ts
3490
3539
  const kept = [
3491
3540
  "avoid-mutable-state",
@@ -3495,11 +3544,13 @@ const kept = [
3495
3544
  "no-module-mocking",
3496
3545
  "prefer-redacted-config",
3497
3546
  "require-effect-concurrency",
3498
- "throw-in-effect-gen",
3499
- "use-temp-file-scoped"
3547
+ "throw-in-effect-gen"
3500
3548
  ];
3501
3549
  const plugin = {
3502
3550
  meta: plugin$1.meta,
3503
- rules: R.filter(plugin$1.rules, (_rule, name) => kept.includes(name))
3551
+ rules: {
3552
+ ...R.filter(plugin$1.rules, (_rule, name) => kept.includes(name)),
3553
+ "use-temp-file-scoped": useTempFileScopedRule
3554
+ }
3504
3555
  };
3505
3556
  export { plugin as t };
@@ -1 +1 @@
1
- export { t as default } from "./effect-plugin-ByuWwyB8.mjs";
1
+ export { t as default } from "./effect-plugin-Cee5222q.mjs";
@@ -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">>;
@@ -18,6 +18,7 @@ const beyondRecommended = [
18
18
  "effecttsgo/missing-effect-service-dependency",
19
19
  "effecttsgo/unsafe-effect-type-assertion"
20
20
  ];
21
- const enforcedTsgoRules = Arr.sort(Arr.dedupe([...Struct.keys(presets.recommended.rules ?? {}), ...beyondRecommended]), Order.String);
22
- const effectTsgoRules = R.fromEntries(Arr.map(enforcedTsgoRules, (rule) => [rule, "error"]));
23
- export { effectTsgoPlugin, effectTsgoRules, enforcedTsgoRules, patchCommand };
21
+ const disabledRecommendedTsgoRules = ["effecttsgo/return-effect-in-gen", "effecttsgo/layer-merge-all-with-dependencies"];
22
+ const enforcedTsgoRules = Arr.sort(Arr.dedupe([...Arr.filter(Struct.keys(presets.recommended.rules ?? {}), (rule) => !disabledRecommendedTsgoRules.includes(rule)), ...beyondRecommended]), Order.String);
23
+ const effectTsgoRules = R.fromEntries([...Arr.map(enforcedTsgoRules, (rule) => [rule, "error"]), ...Arr.map(disabledRecommendedTsgoRules, (rule) => [rule, "off"])]);
24
+ export { disabledRecommendedTsgoRules, effectTsgoPlugin, effectTsgoRules, enforcedTsgoRules, patchCommand };
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-ByuWwyB8.mjs";
1
+ import { t as plugin } from "./effect-plugin-Cee5222q.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-C3DDlAbr.mjs";
4
+ import { t as plugin$1 } from "./plugin-DpJJbtFQ.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,28 @@ 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
+ "**/tests/**",
55
+ "**/test/**"
56
+ ];
57
+ const toolchainScopes = [
58
+ {
59
+ files: ["**/*.astro"],
60
+ rules: { "unicorn/prefer-module": "off" }
61
+ },
62
+ ...Arr.map(Arr.filter(foldkitPreset.overrides, (scope) => scope.files.includes("**/*.test.ts") && scope.excludeFiles === void 0), ({ rules }) => ({
63
+ files: ["**/tests/**", "**/test/**"],
64
+ rules
65
+ })),
66
+ {
67
+ files: testFiles,
68
+ rules: { "effecttsgo/any-unknown-in-error-context": "off" }
69
+ }
70
+ ];
49
71
  const atError = (prefix, rules) => R.fromEntries(Arr.map(rules, (rule) => [`${prefix}/${rule}`, "error"]));
50
72
  const effectRules = atError(plugin.meta.name, R.keys(plugin.rules));
51
73
  const birbprophetRules = atError(plugin$1.meta.name, R.keys(plugin$1.rules));
@@ -90,7 +112,11 @@ const lint = ({ ignores = [] } = {}) => ({
90
112
  ...birbprophetRules,
91
113
  ...effectTsgoRules
92
114
  },
93
- overrides: [...foldkitPreset.overrides, ...Arr.map(exceptions, exceptionTier)],
115
+ overrides: [
116
+ ...foldkitPreset.overrides,
117
+ ...toolchainScopes,
118
+ ...Arr.map(exceptions, exceptionTier)
119
+ ],
94
120
  ignorePatterns: [...coreIgnores, ...ignores]
95
121
  });
96
- export { birbprophetRules, effectRules, foldkitPreset, lint };
122
+ 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,6 @@ const noCommentsRule = Rule.define({
26
26
  }),
27
27
  name: "no-comments"
28
28
  });
29
- // src/shared/syntax.ts
30
- const unwrapExpression = (node) => {
31
- if (node.type === "ParenthesizedExpression" || node.type === "ChainExpression" || node.type === "TSAsExpression" || node.type === "TSTypeAssertion" || node.type === "TSNonNullExpression" || node.type === "TSSatisfiesExpression") return unwrapExpression(node.expression);
32
- return node;
33
- };
34
- const isStringLiteral = (node) => node.type === "Literal" && Schema.is(Schema.String)(node.value);
35
- const memberPropertyName = (node) => {
36
- if (!node.computed && node.property.type === "Identifier") return Option.some(node.property.name);
37
- return node.computed && isStringLiteral(node.property) ? Option.some(node.property.value) : Option.none();
38
- };
39
- const propertyName = (property) => {
40
- if (!property.computed && property.key.type === "Identifier") return Option.some(property.key.name);
41
- return isStringLiteral(property.key) ? Option.some(property.key.value) : Option.none();
42
- };
43
29
  // src/shared/member-path.ts
44
30
  const resolveBinding = (sourceCode, node) => {
45
31
  const findBinding = (scope) => Option.flatMap(scope, (current) => Option.orElse(Option.fromUndefinedOr(current.set.get(node.name)), () => findBinding(Option.fromNullishOr(current.upper))));
@@ -127,6 +113,16 @@ const preferAccessibleSceneLocatorsRule = Rule.define({
127
113
  "all",
128
114
  "selector"
129
115
  ])) return Effect.void;
116
+ const assertion = node.parent;
117
+ if (assertion.type === "CallExpression" && assertion.arguments[0] === node && isFoldkitCall(context.sourceCode, assertion, ["Scene", "expect"])) {
118
+ const member = assertion.parent;
119
+ if (member.type === "MemberExpression" && member.object === assertion) {
120
+ const absent = Option.contains(memberPropertyName(member), "toBeAbsent") && member.parent.type === "CallExpression" && member.parent.callee === member;
121
+ const negated = member.parent;
122
+ const matcher = negated.parent;
123
+ 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;
124
+ }
125
+ }
130
126
  const [css] = node.arguments;
131
127
  if (css === void 0) return Effect.void;
132
128
  return Option.match(Option.filter(textWithHoles(css, "x"), (text) => fitsAccessibleLocator(Str.replaceAll(QUOTED, "\"\"")(text))), {
package/dist/plugin.mjs CHANGED
@@ -1 +1 @@
1
- export { t as default } from "./plugin-C3DDlAbr.mjs";
1
+ export { t as default } from "./plugin-DpJJbtFQ.mjs";
package/dist/rules.d.mts CHANGED
@@ -58,6 +58,7 @@ export declare const staticRules: {
58
58
  "oxc/no-accumulating-spread": "error";
59
59
  "promise/always-return": "off";
60
60
  "promise/no-return-in-finally": "error";
61
+ "promise/valid-params": "off";
61
62
  "typescript/ban-ts-comment": "error";
62
63
  "typescript/method-signature-style": "error";
63
64
  "typescript/no-deprecated": "error";
@@ -103,4 +104,7 @@ export declare const staticRules: {
103
104
  "vitest/no-identical-title": "error";
104
105
  "vitest/no-import-node-test": "error";
105
106
  "vitest/no-standalone-expect": "off";
107
+ "vitest/valid-title": ["error", {
108
+ allowArguments: boolean;
109
+ }];
106
110
  };
package/dist/rules.mjs CHANGED
@@ -63,6 +63,7 @@ const staticRules = {
63
63
  "oxc/no-accumulating-spread": "error",
64
64
  "promise/always-return": "off",
65
65
  "promise/no-return-in-finally": "error",
66
+ "promise/valid-params": "off",
66
67
  "typescript/ban-ts-comment": "error",
67
68
  "typescript/method-signature-style": "error",
68
69
  "typescript/no-deprecated": "error",
@@ -107,6 +108,7 @@ const staticRules = {
107
108
  "vitest/expect-expect": "off",
108
109
  "vitest/no-identical-title": "error",
109
110
  "vitest/no-import-node-test": "error",
110
- "vitest/no-standalone-expect": "off"
111
+ "vitest/no-standalone-expect": "off",
112
+ "vitest/valid-title": ["error", { allowArguments: true }]
111
113
  };
112
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milkenjoyer/toolchain",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/birbprophet/agent-kit.git",
@@ -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
  ]