widefleet-darwin-arm64 0.3.2 → 0.3.3

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.
Files changed (82) hide show
  1. package/README.md +14 -8
  2. package/package.json +3 -1
  3. package/release.json +1 -1
  4. package/starter/AGENTS.md +4 -14
  5. package/starter/README.md +12 -15
  6. package/starter/package.json +3 -2
  7. package/starter/pnpm-lock.yaml +33 -75
  8. package/starter/pnpm-workspace.yaml +1 -0
  9. package/starters/tanstack-start/.gitattributes +2 -0
  10. package/starters/tanstack-start/.gitignore +19 -0
  11. package/starters/tanstack-start/.oxfmtrc.json +33 -0
  12. package/starters/tanstack-start/.oxlintrc.json +69 -0
  13. package/starters/tanstack-start/AGENTS.md +24 -0
  14. package/starters/tanstack-start/LICENSE +21 -0
  15. package/starters/tanstack-start/package.json +47 -0
  16. package/starters/tanstack-start/pnpm-lock.yaml +3130 -0
  17. package/starters/tanstack-start/pnpm-workspace.yaml +6 -0
  18. package/starters/tanstack-start/src/client.tsx +20 -0
  19. package/starters/tanstack-start/src/env.d.ts +7 -0
  20. package/starters/tanstack-start/src/lib/capture-error.ts +47 -0
  21. package/starters/tanstack-start/src/lib/errors.ts +42 -0
  22. package/starters/tanstack-start/src/lib/notes.functions.ts +86 -0
  23. package/starters/tanstack-start/src/lib/report-error.ts +7 -0
  24. package/starters/tanstack-start/src/lib/server/browser-errors.ts +88 -0
  25. package/starters/tanstack-start/src/lib/server/capture-error.ts +35 -0
  26. package/starters/tanstack-start/src/lib/server/context.ts +7 -0
  27. package/starters/tanstack-start/src/lib/server/data.ts +48 -0
  28. package/starters/tanstack-start/src/lib/server/identity.ts +30 -0
  29. package/starters/tanstack-start/src/register.d.ts +13 -0
  30. package/starters/tanstack-start/src/router.tsx +12 -0
  31. package/starters/tanstack-start/src/routes/__root.tsx +28 -0
  32. package/starters/tanstack-start/src/routes/index.tsx +127 -0
  33. package/starters/tanstack-start/src/routes/photos.$id.ts +27 -0
  34. package/starters/tanstack-start/src/server.ts +67 -0
  35. package/starters/tanstack-start/src/start.ts +28 -0
  36. package/starters/tanstack-start/src/styles.css +122 -0
  37. package/starters/tanstack-start/tools/build.ts +26 -0
  38. package/starters/tanstack-start/tools/oxlint/anti-slop/LICENSE +21 -0
  39. package/starters/tanstack-start/tools/oxlint/anti-slop/UPSTREAM.md +7 -0
  40. package/starters/tanstack-start/tools/oxlint/anti-slop/effect/index.ts +21 -0
  41. package/starters/tanstack-start/tools/oxlint/anti-slop/effect/rules/no-manual-effect-error-tag.ts +52 -0
  42. package/starters/tanstack-start/tools/oxlint/anti-slop/effect/rules/no-manual-tag-comparison.ts +45 -0
  43. package/starters/tanstack-start/tools/oxlint/anti-slop/effect/rules/no-manual-tagged-construction.ts +37 -0
  44. package/starters/tanstack-start/tools/oxlint/anti-slop/effect/rules/no-service-constructor-imports.ts +52 -0
  45. package/starters/tanstack-start/tools/oxlint/anti-slop/effect/rules/prefer-effect-match.ts +54 -0
  46. package/starters/tanstack-start/tools/oxlint/anti-slop/effect/shared/tagged-values.ts +97 -0
  47. package/starters/tanstack-start/tools/oxlint/anti-slop/index.ts +47 -0
  48. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-array-filter-map.ts +28 -0
  49. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-chained-type-assertions.ts +77 -0
  50. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-conditional-empty-object-spread.ts +49 -0
  51. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-known-value-widening.ts +415 -0
  52. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-module-mocking.ts +80 -0
  53. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-object-parameters.ts +83 -0
  54. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-reduce-accumulator-copy.ts +109 -0
  55. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-reflect-apply.ts +28 -0
  56. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-reflect-get.ts +28 -0
  57. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-runtime-typeof.ts +77 -0
  58. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-shape-in-symbol-names.ts +46 -0
  59. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-unknown-parameters.ts +69 -0
  60. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-unknown-returns.ts +82 -0
  61. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-unknown-type-aliases.ts +54 -0
  62. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-unsafe-dictionary-type.ts +154 -0
  63. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/no-widen-then-assert.ts +366 -0
  64. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/require-readable-spacing.ts +47 -0
  65. package/starters/tanstack-start/tools/oxlint/anti-slop/rules/require-safety-comment-for-type-assertion.ts +131 -0
  66. package/starters/tanstack-start/tools/oxlint/anti-slop/shared/array-method.ts +94 -0
  67. package/starters/tanstack-start/tools/oxlint/anti-slop/shared/dictionary-types.ts +515 -0
  68. package/starters/tanstack-start/tools/oxlint/anti-slop/shared/function-parameters.ts +49 -0
  69. package/starters/tanstack-start/tools/oxlint/anti-slop/shared/lexical-type-parameters.ts +61 -0
  70. package/starters/tanstack-start/tools/oxlint/anti-slop/shared/reflect-method.ts +24 -0
  71. package/starters/tanstack-start/tools/oxlint/anti-slop/shared/scope.ts +15 -0
  72. package/starters/tanstack-start/tools/oxlint/anti-slop/shared/type-alias-resolution.ts +250 -0
  73. package/starters/tanstack-start/tools/oxlint/anti-slop/vendor/eslint-stylistic/LICENSE +22 -0
  74. package/starters/tanstack-start/tools/oxlint/anti-slop/vendor/eslint-stylistic/UPSTREAM.md +28 -0
  75. package/starters/tanstack-start/tools/oxlint/anti-slop/vendor/eslint-stylistic/padding-line-ast.ts +51 -0
  76. package/starters/tanstack-start/tools/oxlint/anti-slop/vendor/eslint-stylistic/padding-line-between-statements.ts +906 -0
  77. package/starters/tanstack-start/tools/oxlint/anti-slop/vendor/eslint-stylistic/padding-line-options.d.ts +87 -0
  78. package/starters/tanstack-start/tools/types.ts +31 -0
  79. package/starters/tanstack-start/tsconfig.json +20 -0
  80. package/starters/tanstack-start/vite.config.ts +49 -0
  81. package/starters/tanstack-start/wrangler.jsonc +17 -0
  82. package/widefleet +0 -0
@@ -0,0 +1,67 @@
1
+ import { env } from "cloudflare:workers";
2
+ import { createServerEntry } from "@tanstack/react-start/server-entry";
3
+ import { createStartHandler, defaultStreamHandler } from "@tanstack/react-start/server";
4
+ import { userFromHeaders } from "./lib/server/identity.ts";
5
+ import { captureError } from "./lib/server/capture-error.ts";
6
+ import { receiveBrowserError } from "./lib/server/browser-errors.ts";
7
+ import type { PlatformContext } from "./lib/server/context.ts";
8
+
9
+ const handle = createStartHandler((render) => {
10
+ for (const match of render.router.state.matches) {
11
+ if (match.error) captureError(match.error);
12
+ }
13
+
14
+ return defaultStreamHandler(render);
15
+ });
16
+
17
+ export default createServerEntry({
18
+ async fetch(request) {
19
+ const identity = userFromHeaders(request.headers);
20
+
21
+ if (!import.meta.env.DEV && identity.isErr())
22
+ return new Response("Bitte über die Plattform anmelden.", { status: 401 });
23
+
24
+ const context: PlatformContext = {
25
+ user: import.meta.env.DEV
26
+ ? { id: "local-development", name: "Lokale Entwicklung", email: null, groups: [] }
27
+ : identity.unwrap(),
28
+ requestId: crypto.randomUUID(),
29
+ reportedErrors: new Set(),
30
+ };
31
+
32
+ const url = new URL(request.url);
33
+
34
+ if (url.pathname === "/_widefleet/errors") return receiveBrowserError(request, context);
35
+
36
+ let response: Response;
37
+
38
+ try {
39
+ response = await handle(request, { context });
40
+ } catch (cause) {
41
+ captureError(cause, context, request);
42
+ response = new Response("Die Anfrage konnte nicht verarbeitet werden.", { status: 500 });
43
+ }
44
+
45
+ const entry = JSON.stringify({
46
+ widefleet: 1,
47
+ kind: "request",
48
+ source: "server",
49
+ buildId: __WIDEFLEET_BUILD_ID__,
50
+ deploymentId: env.WIDEFLEET_DEPLOYMENT_ID ?? null,
51
+ requestId: context.requestId,
52
+ route: url.pathname,
53
+ method: request.method,
54
+ status: response.status,
55
+ message: `${request.method} ${url.pathname}: ${response.status}`,
56
+ });
57
+
58
+ if (response.status >= 500 && context.reportedErrors.size === 0) console.error(entry);
59
+ else console.info(entry);
60
+
61
+ const result = new Response(response.body, response);
62
+
63
+ result.headers.set("cache-control", "private, no-store");
64
+
65
+ return result;
66
+ },
67
+ });
@@ -0,0 +1,28 @@
1
+ import { createCsrfMiddleware, createMiddleware, createStart } from "@tanstack/react-start";
2
+ import { captureError } from "./lib/server/capture-error.ts";
3
+
4
+ const requestErrors = createMiddleware().server(async ({ next, request, context }) => {
5
+ try {
6
+ return await next();
7
+ } catch (cause) {
8
+ captureError(cause, context, request);
9
+ throw cause;
10
+ }
11
+ });
12
+
13
+ const errors = createMiddleware({ type: "function" }).server(async ({ next }) => {
14
+ try {
15
+ return await next();
16
+ } catch (cause) {
17
+ captureError(cause);
18
+ throw cause;
19
+ }
20
+ });
21
+
22
+ export const startInstance = createStart(() => ({
23
+ requestMiddleware: [
24
+ requestErrors,
25
+ createCsrfMiddleware({ filter: (ctx) => ctx.handlerType === "serverFn" }),
26
+ ],
27
+ functionMiddleware: [errors],
28
+ }));
@@ -0,0 +1,122 @@
1
+ body {
2
+ margin: 0;
3
+ background: #f4f2ed;
4
+ color: #23362e;
5
+ font-family: ui-sans-serif, system-ui, sans-serif;
6
+ }
7
+ main {
8
+ max-width: 920px;
9
+ margin: 64px auto;
10
+ padding: 0 24px;
11
+ }
12
+ header {
13
+ max-width: 650px;
14
+ margin-bottom: 40px;
15
+ }
16
+ .eyebrow {
17
+ color: #587165;
18
+ font-size: 0.75rem;
19
+ letter-spacing: 0.15em;
20
+ font-weight: 700;
21
+ }
22
+ h1 {
23
+ font-size: clamp(2.4rem, 7vw, 4rem);
24
+ letter-spacing: -0.055em;
25
+ margin: 16px 0;
26
+ line-height: 1.05;
27
+ }
28
+ h2 {
29
+ font-size: 1.25rem;
30
+ margin-top: 0;
31
+ }
32
+ p {
33
+ line-height: 1.65;
34
+ }
35
+ .identity,
36
+ .hint,
37
+ footer {
38
+ font-size: 0.85rem;
39
+ color: #587165;
40
+ }
41
+ section {
42
+ margin: 32px 0;
43
+ }
44
+ section:first-of-type {
45
+ background: #fff;
46
+ border: 1px solid #d7dfd7;
47
+ border-radius: 12px;
48
+ padding: 28px;
49
+ }
50
+ label {
51
+ display: block;
52
+ margin-top: 20px;
53
+ font-weight: 600;
54
+ }
55
+ textarea,
56
+ input,
57
+ button {
58
+ font: inherit;
59
+ }
60
+ textarea {
61
+ display: block;
62
+ width: 100%;
63
+ box-sizing: border-box;
64
+ margin: 8px 0 20px;
65
+ border: 1px solid #9eafa3;
66
+ border-radius: 6px;
67
+ padding: 12px;
68
+ resize: vertical;
69
+ }
70
+ input {
71
+ margin-top: 10px;
72
+ max-width: 100%;
73
+ }
74
+ button {
75
+ border: none;
76
+ border-radius: 6px;
77
+ background: #245e43;
78
+ color: #fff;
79
+ padding: 13px 22px;
80
+ cursor: pointer;
81
+ margin-top: 12px;
82
+ }
83
+ button:focus-visible,
84
+ textarea:focus-visible,
85
+ input:focus-visible {
86
+ outline: 3px solid #a97b2a;
87
+ outline-offset: 3px;
88
+ }
89
+ .notes {
90
+ display: grid;
91
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
92
+ gap: 24px;
93
+ }
94
+ article {
95
+ border: 1px solid #d7dfd7;
96
+ border-radius: 12px;
97
+ overflow: hidden;
98
+ background: white;
99
+ }
100
+ img {
101
+ width: 100%;
102
+ height: 240px;
103
+ object-fit: cover;
104
+ }
105
+ .content {
106
+ padding: 20px;
107
+ }
108
+ .content p {
109
+ white-space: pre-wrap;
110
+ overflow-wrap: anywhere;
111
+ margin-top: 0;
112
+ }
113
+ footer {
114
+ margin-top: 24px;
115
+ line-height: 1.6;
116
+ }
117
+ [role="alert"] {
118
+ color: #962e27;
119
+ }
120
+ [role="status"] {
121
+ color: #245e43;
122
+ }
@@ -0,0 +1,26 @@
1
+ import { spawn } from "node:child_process";
2
+ import { randomUUID } from "node:crypto";
3
+ import { once } from "node:events";
4
+ import { rm } from "node:fs/promises";
5
+ import { fileURLToPath } from "node:url";
6
+ import { z } from "zod";
7
+
8
+ // Vite can evaluate the configuration separately for its browser and Worker builds.
9
+ // Both bundles and the deployment manifest must retain the same version.
10
+ const child = spawn(
11
+ process.execPath,
12
+ [fileURLToPath(new URL("./bin/vite.js", import.meta.resolve("vite/package.json"))), "build"],
13
+ {
14
+ stdio: "inherit",
15
+ env: { ...process.env, NODE_ENV: "production", WIDEFLEET_BUILD_ID: randomUUID() },
16
+ },
17
+ );
18
+
19
+ const [code] = z
20
+ .tuple([z.number().nullable(), z.string().nullable()])
21
+ .parse(await once(child, "exit"));
22
+
23
+ if (code !== 0) throw new Error("App build failed");
24
+
25
+ // This upload exclusion file is specific to Wrangler; celld does not interpret it.
26
+ await rm(new URL("../build/public/.assetsignore", import.meta.url), { force: true });
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dillon Mulroy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,7 @@
1
+ # Upstream provenance
2
+
3
+ Source: https://github.com/dmmulroy/anti-slop
4
+
5
+ Commit: `c44ef22ca116d0ba62a3ff663a0bd13a3f3fa40b`
6
+
7
+ Copied from `skills/install-anti-slop/assets/anti-slop/` using the bundled installation script. All generic rules are enabled. Effect rules are present but inactive because the project does not use Effect. No source modifications. Upstream and nested third-party licenses are retained.
@@ -0,0 +1,21 @@
1
+ import { eslintCompatPlugin } from "@oxlint/plugins";
2
+
3
+ import { noManualEffectErrorTagRule } from "./rules/no-manual-effect-error-tag.ts";
4
+ import { noManualTagComparisonRule } from "./rules/no-manual-tag-comparison.ts";
5
+ import { noManualTaggedConstructionRule } from "./rules/no-manual-tagged-construction.ts";
6
+ import { noServiceConstructorImportsRule } from "./rules/no-service-constructor-imports.ts";
7
+ import { preferEffectMatchRule } from "./rules/prefer-effect-match.ts";
8
+
9
+ /** Opt-in Oxlint rules for Effect service and Layer architecture. */
10
+ const antiSlopEffectPlugin = eslintCompatPlugin({
11
+ meta: { name: "anti-slop-effect" },
12
+ rules: {
13
+ "no-manual-effect-error-tag": noManualEffectErrorTagRule,
14
+ "no-manual-tag-comparison": noManualTagComparisonRule,
15
+ "no-manual-tagged-construction": noManualTaggedConstructionRule,
16
+ "no-service-constructor-imports": noServiceConstructorImportsRule,
17
+ "prefer-effect-match": preferEffectMatchRule,
18
+ },
19
+ });
20
+
21
+ export default antiSlopEffectPlugin;
@@ -0,0 +1,52 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+
3
+ import {
4
+ isInsideBroadEffectHandler,
5
+ isReasonTagMember,
6
+ isTagMember,
7
+ tagMemberFromComparison,
8
+ } from "../shared/tagged-values.ts";
9
+
10
+ export const noManualEffectErrorTagRule = defineRule({
11
+ meta: {
12
+ type: "problem",
13
+ docs: {
14
+ description:
15
+ "Use Effect tagged error handlers instead of manually branching on `_tag` in a catch handler.",
16
+ },
17
+ messages: {
18
+ tag: "Use Effect.catchTag or Effect.catchTags instead of manually discriminating a tagged error in a broad Effect catch handler.",
19
+ reason:
20
+ "Use Effect.catchReason or Effect.catchReasons instead of manually discriminating a tagged `reason` in a broad Effect catch handler.",
21
+ },
22
+ },
23
+ createOnce(context) {
24
+ return {
25
+ BinaryExpression(node) {
26
+ const tagMember = tagMemberFromComparison(node);
27
+ if (
28
+ tagMember === undefined ||
29
+ !isInsideBroadEffectHandler(node)
30
+ ) {
31
+ return;
32
+ }
33
+ context.report({
34
+ node,
35
+ messageId: isReasonTagMember(tagMember) ? "reason" : "tag",
36
+ });
37
+ },
38
+ SwitchStatement(node) {
39
+ if (
40
+ !isTagMember(node.discriminant) ||
41
+ !isInsideBroadEffectHandler(node)
42
+ ) {
43
+ return;
44
+ }
45
+ context.report({
46
+ node,
47
+ messageId: isReasonTagMember(node.discriminant) ? "reason" : "tag",
48
+ });
49
+ },
50
+ };
51
+ },
52
+ });
@@ -0,0 +1,45 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+
3
+ import {
4
+ isInsideBroadEffectHandler,
5
+ isTagMember,
6
+ tagMemberFromComparison,
7
+ } from "../shared/tagged-values.ts";
8
+
9
+ export const noManualTagComparisonRule = defineRule({
10
+ meta: {
11
+ type: "problem",
12
+ docs: {
13
+ description:
14
+ "Use Effect Match or Predicate helpers instead of manually branching on `_tag`.",
15
+ },
16
+ messages: {
17
+ manualComparison:
18
+ "Use Match.tag/Match.tags for tagged-value branching, or Predicate.isTagged for a simple reusable predicate.",
19
+ manualSwitch:
20
+ "Use Match.value(value).pipe(Match.tag/Match.tags/Match.tagsExhaustive) or the tagged enum `$match` helper instead of switching on `_tag`.",
21
+ },
22
+ },
23
+ createOnce(context) {
24
+ return {
25
+ BinaryExpression(node) {
26
+ if (
27
+ tagMemberFromComparison(node) === undefined ||
28
+ isInsideBroadEffectHandler(node)
29
+ ) {
30
+ return;
31
+ }
32
+ context.report({ node, messageId: "manualComparison" });
33
+ },
34
+ SwitchStatement(node) {
35
+ if (
36
+ !isTagMember(node.discriminant) ||
37
+ isInsideBroadEffectHandler(node)
38
+ ) {
39
+ return;
40
+ }
41
+ context.report({ node, messageId: "manualSwitch" });
42
+ },
43
+ };
44
+ },
45
+ });
@@ -0,0 +1,37 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+
3
+ import {
4
+ isMatchPatternObject,
5
+ isStringLiteral,
6
+ propertyName,
7
+ } from "../shared/tagged-values.ts";
8
+
9
+ export const noManualTaggedConstructionRule = defineRule({
10
+ meta: {
11
+ type: "problem",
12
+ docs: {
13
+ description:
14
+ "Construct tagged values with their existing Effect constructor instead of writing `_tag` manually.",
15
+ },
16
+ messages: {
17
+ manualConstruction:
18
+ "Use the existing Schema tagged `.make`, tagged class/error constructor, or Data.taggedEnum variant constructor instead of writing a literal `_tag` object.",
19
+ },
20
+ },
21
+ createOnce(context) {
22
+ return {
23
+ ObjectExpression(node) {
24
+ if (isMatchPatternObject(node)) return;
25
+ const tag = node.properties.find(
26
+ (property) =>
27
+ property.type === "Property" &&
28
+ propertyName(property) === "_tag" &&
29
+ isStringLiteral(property.value),
30
+ );
31
+ if (tag !== undefined) {
32
+ context.report({ node: tag, messageId: "manualConstruction" });
33
+ }
34
+ },
35
+ };
36
+ },
37
+ });
@@ -0,0 +1,52 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+
3
+ import type { ESTree } from "@oxlint/plugins";
4
+
5
+ const SERVICE_CONSTRUCTOR_NAME = /^make[A-Z]/u;
6
+ const TEST_FILE = /\.(?:test|spec)\.[cm]?[jt]sx?$/u;
7
+
8
+ function isProjectLocalImport(source: string): boolean {
9
+ return source.startsWith("./") || source.startsWith("../");
10
+ }
11
+
12
+ function getImportedName(specifier: ESTree.ImportSpecifier): string {
13
+ if (specifier.imported.type === "Identifier") return specifier.imported.name;
14
+ return specifier.imported.value;
15
+ }
16
+
17
+ /** Keep dependency-bearing Effect service constructors local to their owning capability modules. */
18
+ export const noServiceConstructorImportsRule = defineRule({
19
+ meta: {
20
+ type: "problem",
21
+ docs: {
22
+ description:
23
+ "Disallow project-local make<CapabilityName> imports outside test and spec files.",
24
+ },
25
+ messages: {
26
+ serviceConstructorImport:
27
+ 'Do not import Effect service constructor "{{name}}" into runtime code. Import the owning Layer, yield the contextual service, and allow its requirements to propagate to the composition root.',
28
+ },
29
+ },
30
+ create(context) {
31
+ const isTestFile = TEST_FILE.test(context.filename.replaceAll("\\", "/"));
32
+
33
+ return {
34
+ ImportDeclaration(node) {
35
+ if (isTestFile || !isProjectLocalImport(node.source.value)) return;
36
+
37
+ for (const specifier of node.specifiers) {
38
+ if (specifier.type !== "ImportSpecifier") continue;
39
+
40
+ const importedName = getImportedName(specifier);
41
+ if (!SERVICE_CONSTRUCTOR_NAME.test(importedName)) continue;
42
+
43
+ context.report({
44
+ node: specifier,
45
+ messageId: "serviceConstructorImport",
46
+ data: { name: importedName },
47
+ });
48
+ }
49
+ },
50
+ };
51
+ },
52
+ });
@@ -0,0 +1,54 @@
1
+ import { defineRule, type ESTree } from "@oxlint/plugins";
2
+
3
+ const equalityOperators = new Set(["==", "===", "!=", "!=="]);
4
+
5
+ export const preferEffectMatchRule = defineRule({
6
+ meta: {
7
+ type: "problem",
8
+ docs: {
9
+ description:
10
+ "Use Match from Effect for chained literal ternaries over the same value.",
11
+ },
12
+ messages: {
13
+ preferMatch:
14
+ "Use Match from Effect instead of a chained literal ternary.",
15
+ },
16
+ },
17
+ createOnce(context) {
18
+ const isLiteral = (node: ESTree.Node): boolean =>
19
+ node.type === "Literal" ||
20
+ (node.type === "TemplateLiteral" && node.expressions.length === 0);
21
+
22
+ const comparedValue = (node: ESTree.Expression): string | undefined => {
23
+ if (
24
+ node.type !== "BinaryExpression" ||
25
+ !equalityOperators.has(node.operator)
26
+ ) {
27
+ return undefined;
28
+ }
29
+ if (isLiteral(node.left)) return context.sourceCode.getText(node.right);
30
+ if (isLiteral(node.right)) return context.sourceCode.getText(node.left);
31
+ return undefined;
32
+ };
33
+
34
+ return {
35
+ ConditionalExpression(node) {
36
+ if (node.parent?.type === "ConditionalExpression") return;
37
+ const value = comparedValue(node.test);
38
+ if (value === undefined) return;
39
+
40
+ let alternate = node.alternate;
41
+ let literalChecks = 1;
42
+ while (alternate.type === "ConditionalExpression") {
43
+ if (comparedValue(alternate.test) !== value) return;
44
+ literalChecks += 1;
45
+ alternate = alternate.alternate;
46
+ }
47
+
48
+ if (literalChecks > 1) {
49
+ context.report({ node, messageId: "preferMatch" });
50
+ }
51
+ },
52
+ };
53
+ },
54
+ });
@@ -0,0 +1,97 @@
1
+ import type { ESTree } from "@oxlint/plugins";
2
+
3
+ const equalityOperators = new Set(["==", "===", "!=", "!=="]);
4
+ const broadEffectCatchMethods = new Set(["catch", "catchAll", "catchIf"]);
5
+
6
+ export const isStringLiteral = (
7
+ node: ESTree.Node | null | undefined,
8
+ ): node is ESTree.StringLiteral =>
9
+ node?.type === "Literal" && typeof node.value === "string";
10
+
11
+ export const isTagMember = (
12
+ node: ESTree.Node | null | undefined,
13
+ ): node is ESTree.MemberExpression =>
14
+ node?.type === "MemberExpression" &&
15
+ ((!node.computed &&
16
+ node.property.type === "Identifier" &&
17
+ node.property.name === "_tag") ||
18
+ (node.computed &&
19
+ isStringLiteral(node.property) &&
20
+ node.property.value === "_tag"));
21
+
22
+ export const tagMemberFromComparison = (
23
+ node: ESTree.BinaryExpression,
24
+ ): ESTree.MemberExpression | undefined => {
25
+ if (!equalityOperators.has(node.operator)) return undefined;
26
+ if (isTagMember(node.left) && isStringLiteral(node.right)) return node.left;
27
+ if (isTagMember(node.right) && isStringLiteral(node.left)) return node.right;
28
+ return undefined;
29
+ };
30
+
31
+ const isBroadEffectCatchCall = (
32
+ node: ESTree.Node | null | undefined,
33
+ ): node is ESTree.CallExpression =>
34
+ node?.type === "CallExpression" &&
35
+ node.callee.type === "MemberExpression" &&
36
+ node.callee.object.type === "Identifier" &&
37
+ node.callee.object.name === "Effect" &&
38
+ !node.callee.computed &&
39
+ node.callee.property.type === "Identifier" &&
40
+ broadEffectCatchMethods.has(node.callee.property.name);
41
+
42
+ export const isInsideBroadEffectHandler = (node: ESTree.Node): boolean => {
43
+ let current: ESTree.Node | null | undefined = node.parent;
44
+ while (current !== null && current !== undefined) {
45
+ if (
46
+ current.type === "ArrowFunctionExpression" ||
47
+ current.type === "FunctionExpression"
48
+ ) {
49
+ return (
50
+ isBroadEffectCatchCall(current.parent) &&
51
+ current.parent.arguments.includes(current)
52
+ );
53
+ }
54
+ current = current.parent;
55
+ }
56
+ return false;
57
+ };
58
+
59
+ export const isReasonTagMember = (node: ESTree.MemberExpression): boolean =>
60
+ node.object.type === "MemberExpression" &&
61
+ ((!node.object.computed &&
62
+ node.object.property.type === "Identifier" &&
63
+ node.object.property.name === "reason") ||
64
+ (node.object.computed &&
65
+ isStringLiteral(node.object.property) &&
66
+ node.object.property.value === "reason"));
67
+
68
+ export const propertyName = (
69
+ property: ESTree.ObjectProperty,
70
+ ): string | undefined => {
71
+ if (!property.computed && property.key.type === "Identifier") {
72
+ return property.key.name;
73
+ }
74
+ if (
75
+ property.key.type === "Literal" &&
76
+ typeof property.key.value === "string"
77
+ ) {
78
+ return property.key.value;
79
+ }
80
+ return undefined;
81
+ };
82
+
83
+ export const isMatchPatternObject = (node: ESTree.ObjectExpression): boolean => {
84
+ const call = node.parent;
85
+ if (call?.type !== "CallExpression" || !call.arguments.includes(node)) {
86
+ return false;
87
+ }
88
+ const callee = call.callee;
89
+ return (
90
+ callee.type === "MemberExpression" &&
91
+ callee.object.type === "Identifier" &&
92
+ callee.object.name === "Match" &&
93
+ !callee.computed &&
94
+ callee.property.type === "Identifier" &&
95
+ (callee.property.name === "when" || callee.property.name === "not")
96
+ );
97
+ };
@@ -0,0 +1,47 @@
1
+ import { eslintCompatPlugin } from "@oxlint/plugins";
2
+
3
+ import { noArrayFilterMapRule } from "./rules/no-array-filter-map.ts";
4
+ import { noReduceAccumulatorCopyRule } from "./rules/no-reduce-accumulator-copy.ts";
5
+ import { noChainedTypeAssertionsRule } from "./rules/no-chained-type-assertions.ts";
6
+ import { noConditionalEmptyObjectSpreadRule } from "./rules/no-conditional-empty-object-spread.ts";
7
+ import { noKnownValueWideningRule } from "./rules/no-known-value-widening.ts";
8
+ import { noModuleMockingRule } from "./rules/no-module-mocking.ts";
9
+ import { noObjectParametersRule } from "./rules/no-object-parameters.ts";
10
+ import { noReflectApplyRule } from "./rules/no-reflect-apply.ts";
11
+ import { noReflectGetRule } from "./rules/no-reflect-get.ts";
12
+ import { noRuntimeTypeofRule } from "./rules/no-runtime-typeof.ts";
13
+ import { noForbiddenTermInSymbolNamesRule } from "./rules/no-shape-in-symbol-names.ts";
14
+ import { noUnknownParametersRule } from "./rules/no-unknown-parameters.ts";
15
+ import { noUnknownReturnsRule } from "./rules/no-unknown-returns.ts";
16
+ import { noUnknownTypeAliasesRule } from "./rules/no-unknown-type-aliases.ts";
17
+ import { noUnsafeDictionaryTypeRule } from "./rules/no-unsafe-dictionary-type.ts";
18
+ import { noWidenThenAssertRule } from "./rules/no-widen-then-assert.ts";
19
+ import { requireReadableSpacingRule } from "./rules/require-readable-spacing.ts";
20
+ import { requireSafetyCommentForTypeAssertionRule } from "./rules/require-safety-comment-for-type-assertion.ts";
21
+
22
+ /** Generic Oxlint rules that reject low-evidence and low-signal implementation patterns. */
23
+ const antiSlopPlugin = eslintCompatPlugin({
24
+ meta: { name: "anti-slop" },
25
+ rules: {
26
+ "no-array-filter-map": noArrayFilterMapRule,
27
+ "no-reduce-accumulator-copy": noReduceAccumulatorCopyRule,
28
+ "no-chained-type-assertions": noChainedTypeAssertionsRule,
29
+ "no-conditional-empty-object-spread": noConditionalEmptyObjectSpreadRule,
30
+ "no-known-value-widening": noKnownValueWideningRule,
31
+ "no-module-mocking": noModuleMockingRule,
32
+ "no-object-parameters": noObjectParametersRule,
33
+ "no-reflect-apply": noReflectApplyRule,
34
+ "no-reflect-get": noReflectGetRule,
35
+ "no-runtime-typeof": noRuntimeTypeofRule,
36
+ "no-unsafe-dictionary-type": noUnsafeDictionaryTypeRule,
37
+ "no-shape-in-symbol-names": noForbiddenTermInSymbolNamesRule,
38
+ "no-unknown-parameters": noUnknownParametersRule,
39
+ "no-unknown-returns": noUnknownReturnsRule,
40
+ "no-unknown-type-aliases": noUnknownTypeAliasesRule,
41
+ "no-widen-then-assert": noWidenThenAssertRule,
42
+ "require-readable-spacing": requireReadableSpacingRule,
43
+ "require-safety-comment-for-type-assertion": requireSafetyCommentForTypeAssertionRule,
44
+ },
45
+ });
46
+
47
+ export default antiSlopPlugin;