@shivaedev/quality 0.46.0 → 0.48.0

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 (124) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +6 -0
  3. package/dist/{biome → adapters/biome}/run.d.ts +1 -2
  4. package/dist/adapters/biome/run.d.ts.map +1 -0
  5. package/dist/{biome → adapters/biome}/run.js +1 -1
  6. package/dist/adapters/biome/run.js.map +1 -0
  7. package/dist/adapters/fixJsxConditionals.d.ts +3 -0
  8. package/dist/adapters/fixJsxConditionals.d.ts.map +1 -0
  9. package/dist/adapters/fixJsxConditionals.js +98 -0
  10. package/dist/adapters/fixJsxConditionals.js.map +1 -0
  11. package/dist/appViteConfig.d.ts +1 -0
  12. package/dist/appViteConfig.d.ts.map +1 -1
  13. package/dist/appViteConfig.js +1 -1
  14. package/dist/appViteConfig.js.map +1 -1
  15. package/dist/baseline/installDriver.d.ts +2 -1
  16. package/dist/baseline/installDriver.d.ts.map +1 -1
  17. package/dist/baseline/installDriver.js.map +1 -1
  18. package/dist/biome/recommendedRules.d.ts +2 -2
  19. package/dist/biome/recommendedRules.d.ts.map +1 -1
  20. package/dist/biome/recommendedRules.js +1 -1
  21. package/dist/biome/recommendedRules.js.map +1 -1
  22. package/dist/biome/report.d.ts +2 -1
  23. package/dist/biome/report.d.ts.map +1 -1
  24. package/dist/biome/report.js +6 -5
  25. package/dist/biome/report.js.map +1 -1
  26. package/dist/cli/args.d.ts +2 -1
  27. package/dist/cli/args.d.ts.map +1 -1
  28. package/dist/cli/args.js +2 -2
  29. package/dist/cli/args.js.map +1 -1
  30. package/dist/cli/fix.d.ts +2 -2
  31. package/dist/cli/fix.d.ts.map +1 -1
  32. package/dist/cli/fixRule.d.ts +5 -0
  33. package/dist/cli/fixRule.d.ts.map +1 -0
  34. package/dist/cli/fixRule.js +40 -0
  35. package/dist/cli/fixRule.js.map +1 -0
  36. package/dist/cli/messages.d.ts +1 -1
  37. package/dist/cli/messages.d.ts.map +1 -1
  38. package/dist/cli/messages.js +2 -1
  39. package/dist/cli/messages.js.map +1 -1
  40. package/dist/cli/program.d.ts.map +1 -1
  41. package/dist/cli/program.js +2 -1
  42. package/dist/cli/program.js.map +1 -1
  43. package/dist/cli/runMain.d.ts +3 -3
  44. package/dist/cli/runMain.d.ts.map +1 -1
  45. package/dist/cli/runMain.js.map +1 -1
  46. package/dist/cli/shrink.d.ts +3 -3
  47. package/dist/cli/shrink.d.ts.map +1 -1
  48. package/dist/cli/shrink.js.map +1 -1
  49. package/dist/engine/session.d.ts.map +1 -1
  50. package/dist/engine/session.js +1 -1
  51. package/dist/engine/session.js.map +1 -1
  52. package/dist/git/base.d.ts +2 -1
  53. package/dist/git/base.d.ts.map +1 -1
  54. package/dist/git/base.js +6 -6
  55. package/dist/git/base.js.map +1 -1
  56. package/dist/git/command.d.ts +2 -3
  57. package/dist/git/command.d.ts.map +1 -1
  58. package/dist/git/command.js +6 -6
  59. package/dist/git/command.js.map +1 -1
  60. package/dist/git/history.d.ts +2 -2
  61. package/dist/git/history.d.ts.map +1 -1
  62. package/dist/git/history.js.map +1 -1
  63. package/dist/hooks/forwarding.js +2 -2
  64. package/dist/hooks/location.js +3 -3
  65. package/dist/hooks/uninstall.js +2 -2
  66. package/dist/hooks/uninstall.js.map +1 -1
  67. package/dist/imports/withoutGenerated.d.ts +4 -2
  68. package/dist/imports/withoutGenerated.d.ts.map +1 -1
  69. package/dist/imports/withoutGenerated.js +22 -35
  70. package/dist/imports/withoutGenerated.js.map +1 -1
  71. package/dist/inventory/collect.d.ts +4 -3
  72. package/dist/inventory/collect.d.ts.map +1 -1
  73. package/dist/inventory/collect.js.map +1 -1
  74. package/dist/inventory/shadcnFolders.d.ts +4 -2
  75. package/dist/inventory/shadcnFolders.d.ts.map +1 -1
  76. package/dist/inventory/shadcnFolders.js.map +1 -1
  77. package/dist/inventory/trackedPaths.d.ts +5 -3
  78. package/dist/inventory/trackedPaths.d.ts.map +1 -1
  79. package/dist/inventory/trackedPaths.js +22 -24
  80. package/dist/inventory/trackedPaths.js.map +1 -1
  81. package/dist/inventory/walk.d.ts +5 -3
  82. package/dist/inventory/walk.d.ts.map +1 -1
  83. package/dist/inventory/walk.js +3 -9
  84. package/dist/inventory/walk.js.map +1 -1
  85. package/dist/manifests/sorted.d.ts +5 -3
  86. package/dist/manifests/sorted.d.ts.map +1 -1
  87. package/dist/manifests/sorted.js.map +1 -1
  88. package/dist/rules/builtIn.d.ts +2 -2
  89. package/dist/rules/imports/resolvable.d.ts +1 -1
  90. package/dist/rules/imports/resolvable.d.ts.map +1 -1
  91. package/dist/rules/imports/resolvable.js +4 -3
  92. package/dist/rules/imports/resolvable.js.map +1 -1
  93. package/dist/rules/suppressions/noIgnoreDeprecations.d.ts +1 -1
  94. package/dist/rules/suppressions/noIgnoreDeprecations.d.ts.map +1 -1
  95. package/package.json +2 -2
  96. package/src/{biome → adapters/biome}/run.ts +1 -1
  97. package/src/adapters/fixJsxConditionals.ts +116 -0
  98. package/src/appViteConfig.ts +3 -1
  99. package/src/baseline/installDriver.ts +6 -2
  100. package/src/biome/recommendedRules.ts +1 -1
  101. package/src/biome/report.ts +7 -6
  102. package/src/cli/args.ts +3 -3
  103. package/src/cli/fix.ts +1 -1
  104. package/src/cli/fixRule.ts +49 -0
  105. package/src/cli/messages.ts +2 -1
  106. package/src/cli/program.ts +2 -1
  107. package/src/cli/runMain.ts +4 -2
  108. package/src/cli/shrink.ts +4 -4
  109. package/src/engine/session.ts +4 -2
  110. package/src/git/base.ts +16 -13
  111. package/src/git/command.ts +10 -9
  112. package/src/git/history.ts +6 -2
  113. package/src/hooks/forwarding.ts +2 -2
  114. package/src/hooks/location.ts +3 -3
  115. package/src/hooks/uninstall.ts +2 -2
  116. package/src/imports/withoutGenerated.ts +25 -38
  117. package/src/inventory/collect.ts +4 -3
  118. package/src/inventory/shadcnFolders.ts +4 -2
  119. package/src/inventory/trackedPaths.ts +22 -24
  120. package/src/inventory/walk.ts +7 -11
  121. package/src/manifests/sorted.ts +4 -2
  122. package/src/rules/imports/resolvable.ts +4 -3
  123. package/dist/biome/run.d.ts.map +0 -1
  124. package/dist/biome/run.js.map +0 -1
@@ -1,4 +1,6 @@
1
- export declare function trackedPaths(directory: string): Promise<readonly string[]>;
2
- export declare function ignoredTrackedPaths(directory: string): Promise<readonly string[]>;
3
- export declare function ignoredPaths(directory: string): Promise<readonly string[] | undefined>;
1
+ import { Effect } from "effect";
2
+ import { SetupFailure } from "#failure.ts";
3
+ export declare const trackedPaths: (directory: string, path?: any) => Effect.Effect<string[], SetupFailure, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
4
+ export declare const ignoredTrackedPaths: (directory: string) => Effect.Effect<string[], SetupFailure, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
5
+ export declare const ignoredPaths: (directory: string) => Effect.Effect<string[] | undefined, SetupFailure, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
4
6
  //# sourceMappingURL=trackedPaths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trackedPaths.d.ts","sourceRoot":"","sources":["../../src/inventory/trackedPaths.ts"],"names":[],"mappings":"AAqBA,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAEhF;AAED,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAEvF;AAED,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC,CAG5F"}
1
+ {"version":3,"file":"trackedPaths.d.ts","sourceRoot":"","sources":["../../src/inventory/trackedPaths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAiB3C,eAAO,MAAM,YAAY,4IAEvB,CAAC;AAEH,eAAO,MAAM,mBAAmB,gIAE9B,CAAC;AAEH,eAAO,MAAM,YAAY,4IAGvB,CAAC"}
@@ -1,30 +1,28 @@
1
- import { execFile } from "node:child_process";
2
1
  import { join, resolve } from "node:path";
3
- import { promisify } from "node:util";
4
- const run = promisify(execFile);
5
- async function listedPaths(directory, options) {
6
- try {
7
- const { stdout } = await run("git", ["ls-files", "-z", ...options, "--", "."], { cwd: directory, maxBuffer: 2 ** 30 });
8
- return stdout
9
- .split("\0")
10
- .filter(Boolean)
11
- .map((path) => join(directory, path));
12
- }
13
- catch (error) {
14
- if (error instanceof Error && "stderr" in error && String(error.stderr).includes("not a git repository")) {
2
+ import { Effect } from "effect";
3
+ import { SetupFailure } from "#failure.ts";
4
+ import { run } from "#git/command.ts";
5
+ const listedPaths = Effect.fn("Inventory.listedPaths")(function* (directory, options, path = ".") {
6
+ const result = yield* run(directory, ["ls-files", "-z", ...options, "--", path]);
7
+ if (result.code !== 0) {
8
+ if (result.stderr.includes("not a git repository")) {
15
9
  return undefined;
16
10
  }
17
- throw error;
11
+ return yield* new SetupFailure({ message: `git ls-files exited ${result.code}: ${result.stderr.trim()}` });
18
12
  }
19
- }
20
- export async function trackedPaths(directory) {
21
- return (await listedPaths(directory, [])) ?? [];
22
- }
23
- export async function ignoredTrackedPaths(directory) {
24
- return (await listedPaths(directory, ["--cached", "--ignored", "--exclude-standard"])) ?? [];
25
- }
26
- export async function ignoredPaths(directory) {
27
- const paths = await listedPaths(directory, ["--others", "--ignored", "--exclude-standard", "--directory"]);
13
+ return result.stdout
14
+ .split("\0")
15
+ .filter(Boolean)
16
+ .map((file) => join(directory, file));
17
+ });
18
+ export const trackedPaths = Effect.fn("Inventory.trackedPaths")(function* (directory, path = ".") {
19
+ return (yield* listedPaths(directory, [], path)) ?? [];
20
+ });
21
+ export const ignoredTrackedPaths = Effect.fn("Inventory.ignoredTrackedPaths")(function* (directory) {
22
+ return (yield* listedPaths(directory, ["--cached", "--ignored", "--exclude-standard"])) ?? [];
23
+ });
24
+ export const ignoredPaths = Effect.fn("Inventory.ignoredPaths")(function* (directory) {
25
+ const paths = yield* listedPaths(directory, ["--others", "--ignored", "--exclude-standard", "--directory"]);
28
26
  return paths?.map((path) => resolve(path));
29
- }
27
+ });
30
28
  //# sourceMappingURL=trackedPaths.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"trackedPaths.js","sourceRoot":"","sources":["../../src/inventory/trackedPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEhC,KAAK,UAAU,WAAW,CAAC,SAAiB,EAAE,OAA0B;IACvE,IAAI,CAAC;QACJ,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACvH,OAAO,MAAM;aACX,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,OAAO,CAAC;aACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,KAAK,YAAY,KAAK,IAAI,QAAQ,IAAI,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;YAC1G,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,MAAM,KAAK,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SAAS,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,oBAAoB,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5G,OAAO,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { Effect, FileSystem } from "effect";
2
- import { FilesystemFailure } from "./filesystem.ts";
2
+ import type { SetupFailure } from "#failure.ts";
3
+ import type { RuleServices } from "#rule.ts";
4
+ import { type FilesystemFailure } from "./filesystem.ts";
3
5
  import { type IgnoreScope } from "./ignoreScope.ts";
4
6
  export declare function ignoreScopeAt(dir: string, inherited?: IgnoreScope): Effect.Effect<IgnoreScope, FilesystemFailure, FileSystem.FileSystem>;
5
- export declare const scopeAbove: (root: string, dir: string) => Effect.Effect<IgnoreScope, FilesystemFailure, FileSystem.FileSystem>;
6
- export declare const walk: (dir: string, inherited?: IgnoreScope | undefined) => Effect.Effect<readonly string[], FilesystemFailure, FileSystem.FileSystem>;
7
+ export declare const scopeAbove: (root: string, dir: string) => Effect.Effect<IgnoreScope, FilesystemFailure | SetupFailure, RuleServices>;
8
+ export declare const walk: (dir: string, inherited?: IgnoreScope | undefined) => Effect.Effect<readonly string[], FilesystemFailure | SetupFailure, RuleServices>;
7
9
  //# sourceMappingURL=walk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../src/inventory/walk.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAkC,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAc,KAAK,WAAW,EAA0C,MAAM,kBAAkB,CAAC;AAKxG,wBAAgB,aAAa,CAC5B,GAAG,EAAE,MAAM,EACX,SAAS,GAAE,WAAwB,GACjC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,iBAAiB,EAAE,UAAU,CAAC,UAAU,CAAC,CAOtE;AAED,eAAO,MAAM,UAAU,qGAoBrB,CAAC;AAEH,eAAO,MAAM,IAAI,kIAmBf,CAAC"}
1
+ {"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../src/inventory/walk.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,iBAAiB,EAAkC,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAc,KAAK,WAAW,EAA0C,MAAM,kBAAkB,CAAC;AAKxG,wBAAgB,aAAa,CAC5B,GAAG,EAAE,MAAM,EACX,SAAS,GAAE,WAAwB,GACjC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,iBAAiB,EAAE,UAAU,CAAC,UAAU,CAAC,CAOtE;AAED,eAAO,MAAM,UAAU,2GAiBrB,CAAC;AAEH,eAAO,MAAM,IAAI,wIAgBf,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { dirname, join, relative, sep } from "node:path";
2
2
  import { Effect, FileSystem } from "effect";
3
- import { FilesystemFailure, orWhenAbsent, readOptionalText } from "./filesystem.js";
3
+ import { orWhenAbsent, readOptionalText } from "./filesystem.js";
4
4
  import { emptyScope, insideKept, verdictFor, withIgnoreFile } from "./ignoreScope.js";
5
5
  import { ignoredPaths, trackedPaths } from "./trackedPaths.js";
6
6
  const SKIPPED = new Set([".git", ".worktrees", "node_modules"]);
@@ -11,10 +11,7 @@ export function ignoreScopeAt(dir, inherited = emptyScope) {
11
11
  return Effect.map(readOptionalText(join(dir, ".gitignore")), (contents) => contents === undefined || contents === "" ? inherited : withIgnoreFile(inherited, dir, contents));
12
12
  }
13
13
  export const scopeAbove = Effect.fnUntraced(function* (root, dir) {
14
- const ignored = yield* Effect.tryPromise({
15
- catch: (cause) => new FilesystemFailure({ message: `cannot list ignored files in ${dir}: ${String(cause)}`, path: dir }),
16
- try: () => ignoredPaths(dir),
17
- });
14
+ const ignored = yield* ignoredPaths(dir);
18
15
  if (ignored !== undefined) {
19
16
  return { ...emptyScope, ignored: new Set(ignored) };
20
17
  }
@@ -29,10 +26,7 @@ export const walk = Effect.fnUntraced(function* (dir, inherited) {
29
26
  if ((yield* orWhenAbsent(dir, fs.stat(dir), undefined)) === undefined) {
30
27
  return [];
31
28
  }
32
- const paths = yield* Effect.tryPromise({
33
- catch: (cause) => new FilesystemFailure({ message: `cannot list tracked files in ${dir}: ${String(cause)}`, path: dir }),
34
- try: () => trackedPaths(dir),
35
- });
29
+ const paths = yield* trackedPaths(dir);
36
30
  const tracked = new Set(paths);
37
31
  for (const path of paths) {
38
32
  for (let folder = dirname(path); folder !== dir && folder !== dirname(folder); folder = dirname(folder)) {
@@ -1 +1 @@
1
- {"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/inventory/walk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,UAAU,EAAoB,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;AAEhE,MAAM,UAAU,aAAa,CAC5B,GAAW,EACX,SAAS,GAAgB,UAAU;IAEnC,IAAI,SAAS,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C,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EACtD,EAAE,WAAW,EAAE,CAAC,EAAE,CAClB,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAC5C,IAAY,EACZ,KAAkB,EAClB,OAA4B;IAE5B,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;IACxC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,YAAY,CAAmC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;IACnG,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC;IAC5C,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IACnD,IAAI,OAAO,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACjD,OAAO,EAAE,CAAC;IACX,CAAC;IACD,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAClG,CAAC,CAAC,CAAC"}
@@ -1,13 +1,15 @@
1
- import { Effect, FileSystem } from "effect";
1
+ import { Effect } from "effect";
2
2
  import { ManifestFailure } from "#adapters/manifestInventory.ts";
3
+ import type { SetupFailure } from "#failure.ts";
3
4
  import { FilesystemFailure } from "#inventory/filesystem.ts";
5
+ import type { RuleServices } from "#rule.ts";
4
6
  export type Sorting = {
5
7
  readonly _tag: "Sorted";
6
8
  } | {
7
9
  readonly _tag: "Unsorted";
8
10
  readonly sorted: string;
9
11
  };
10
- export declare function manifestsIn(root: string): Effect.Effect<readonly string[], FilesystemFailure, FileSystem.FileSystem>;
12
+ export declare function manifestsIn(root: string): Effect.Effect<readonly string[], FilesystemFailure | SetupFailure, RuleServices>;
11
13
  export declare function sortingOf(text: string): Sorting;
12
- export declare const sortManifests: (root: string) => Effect.Effect<number, FilesystemFailure | ManifestFailure, FileSystem.FileSystem>;
14
+ export declare const sortManifests: (root: string) => Effect.Effect<number, FilesystemFailure | ManifestFailure | SetupFailure, RuleServices>;
13
15
  //# sourceMappingURL=sorted.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sorted.d.ts","sourceRoot":"","sources":["../../src/manifests/sorted.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAiB,MAAM,gCAAgC,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAI7D,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3G,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,iBAAiB,EAAE,UAAU,CAAC,UAAU,CAAC,CAOpH;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG/C;AAED,eAAO,MAAM,aAAa,qGAgCxB,CAAC"}
1
+ {"version":3,"file":"sorted.d.ts","sourceRoot":"","sources":["../../src/manifests/sorted.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAc,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAiB,MAAM,gCAAgC,CAAC;AAEhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3G,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,iBAAiB,GAAG,YAAY,EAAE,YAAY,CAAC,CAO1H;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG/C;AAED,eAAO,MAAM,aAAa,2GAgCxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sorted.js","sourceRoot":"","sources":["../../src/manifests/sorted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,O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QACpD,OAAO,IAAI,CAAC;IACb,CAAC,CAAC,CAAC,IAAI,CACN,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACzB,KAAK,YAAY,eAAe;QAC/B,CAAC,CAAC,IAAI,eAAe,CAAC,EAAE,OAAO,EAAE,eAAe,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC;QACjF,CAAC,CAAC,IAAI,iBAAiB,CAAC,EAAE,OAAO,EAAE,eAAe,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CACpF,CACD,CACD,CAAC;IACF,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;AACvC,CAAC,CAAC,CAAC"}
@@ -6,7 +6,7 @@ export declare const builtInRules: readonly [import("../rule.ts").Rule<"code/unu
6
6
  }, never>, import("../rule.ts").Rule<"comments/no-line-reference", undefined, import("../rule.ts").RuleServices>, import("../rule.ts").Rule<"comments/no-pr-reference", undefined, import("../rule.ts").RuleServices>, import("../rule.ts").Rule<"comments/no-banner", undefined, import("../rule.ts").RuleServices>, import("../rule.ts").Rule<"comments/no-todo", undefined, import("../rule.ts").RuleServices>, import("../rule.ts").Rule<"comments/no-environment-pragma", undefined, import("../rule.ts").RuleServices>, import("../rule.ts").Rule<"comments/max-per-file", {
7
7
  readonly allow?: readonly string[];
8
8
  readonly max?: number;
9
- }, never>, import("../rule.ts").Rule<"docs/references", undefined, never>, import("../rule.ts").Rule<"docs/unversioned-installs", undefined, never>, import("../rule.ts").Rule<"suppressions/no-inline", undefined, never>, import("../rule.ts").Rule<"suppressions/no-double-cast", undefined, never>, import("../rule.ts").Rule<"suppressions/no-ignore-deprecations", undefined, import("effect/FileSystem").FileSystem>, import("../rule.ts").Rule<"suppressions/biome-overrides", {
9
+ }, never>, import("../rule.ts").Rule<"docs/references", undefined, never>, import("../rule.ts").Rule<"docs/unversioned-installs", undefined, never>, import("../rule.ts").Rule<"suppressions/no-inline", undefined, never>, import("../rule.ts").Rule<"suppressions/no-double-cast", undefined, never>, import("../rule.ts").Rule<"suppressions/no-ignore-deprecations", undefined, import("../rule.ts").RuleServices>, import("../rule.ts").Rule<"suppressions/biome-overrides", {
10
10
  readonly declared?: readonly {
11
11
  readonly includes: readonly [string, ...string[]];
12
12
  readonly reason: string;
@@ -16,7 +16,7 @@ export declare const builtInRules: readonly [import("../rule.ts").Rule<"code/unu
16
16
  readonly fences?: readonly import("../imports/fences/model.ts").Fence[];
17
17
  }, never>, import("../rule.ts").Rule<"imports/runtime", undefined, never>, import("../rule.ts").Rule<"imports/resolvable", {
18
18
  readonly generated?: readonly string[];
19
- }, never>, import("../rule.ts").Rule<"imports/manifest", undefined, never>, import("../rule.ts").Rule<"imports/aliased", undefined, never>, import("../rule.ts").Rule<"imports/no-test-code", undefined, never>, import("../rule.ts").Rule<"manifests/valid", undefined, never>, import("../rule.ts").Rule<"manifests/sorted", undefined, never>, import("../rule.ts").Rule<"manifests/source-first", undefined, never>, import("../rule.ts").Rule<"manifests/exports-shape", undefined, never>, import("../rule.ts").Rule<"manifests/application", undefined, never>, import("../rule.ts").Rule<"files/named-after-export", {
19
+ }, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>, import("../rule.ts").Rule<"imports/manifest", undefined, never>, import("../rule.ts").Rule<"imports/aliased", undefined, never>, import("../rule.ts").Rule<"imports/no-test-code", undefined, never>, import("../rule.ts").Rule<"manifests/valid", undefined, never>, import("../rule.ts").Rule<"manifests/sorted", undefined, never>, import("../rule.ts").Rule<"manifests/source-first", undefined, never>, import("../rule.ts").Rule<"manifests/exports-shape", undefined, never>, import("../rule.ts").Rule<"manifests/application", undefined, never>, import("../rule.ts").Rule<"files/named-after-export", {
20
20
  readonly toolOwned?: readonly string[];
21
21
  }, never>, import("../rule.ts").Rule<"files/folder-names", {
22
22
  readonly content?: readonly string[];
@@ -1,4 +1,4 @@
1
1
  export declare const importsResolvable: import("#rule.ts").Rule<"imports/resolvable", {
2
2
  readonly generated?: readonly string[];
3
- }, never>;
3
+ }, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
4
4
  //# sourceMappingURL=resolvable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolvable.d.ts","sourceRoot":"","sources":["../../../src/rules/imports/resolvable.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB;;SAa5B,CAAC"}
1
+ {"version":3,"file":"resolvable.d.ts","sourceRoot":"","sources":["../../../src/rules/imports/resolvable.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB;;oEAc5B,CAAC"}
@@ -6,15 +6,16 @@ const ResolvableOptions = Schema.Struct({
6
6
  generated: Schema.Array(Schema.String).pipe(Schema.withDecodingDefaultKey(Effect.succeed([]))),
7
7
  });
8
8
  export const importsResolvable = defineRule({
9
- check: async ({ options, ...inputs }) => {
10
- const unresolved = await withoutGenerated(inputs, await importGraph(inputs), options.generated);
9
+ check: Effect.fn("Imports.check")(function* ({ options, ...inputs }) {
10
+ const graph = yield* Effect.promise(() => importGraph(inputs));
11
+ const unresolved = yield* withoutGenerated(inputs, graph, options.generated);
11
12
  return unresolved.map((request) => ({
12
13
  file: request.from,
13
14
  line: request.line,
14
15
  message: `Cannot resolve "${request.specifier}". Fix the path, install or declare the package, or declare the module in a .d.ts file among the sources.`,
15
16
  subject: request.specifier,
16
17
  }));
17
- },
18
+ }),
18
19
  description: "Every import resolves to a file, a package or a declared module, so no edge of the import graph goes unchecked.",
19
20
  id: "imports/resolvable",
20
21
  options: Schema.toStandardSchemaV1(ResolvableOptions, { parseOptions: { errors: "all", onExcessProperty: "error" } }),
@@ -1 +1 @@
1
- {"version":3,"file":"resolvable.js","sourceRoot":"","sources":["../../../src/rules/imports/resolvable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC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,CAAC;CACrH,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const noIgnoreDeprecations: import("#rule.ts").Rule<"suppressions/no-ignore-deprecations", undefined, import("effect/FileSystem").FileSystem>;
1
+ export declare const noIgnoreDeprecations: import("#rule.ts").Rule<"suppressions/no-ignore-deprecations", undefined, import("#rule.ts").RuleServices>;
2
2
  //# sourceMappingURL=noIgnoreDeprecations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"noIgnoreDeprecations.d.ts","sourceRoot":"","sources":["../../../src/rules/suppressions/noIgnoreDeprecations.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,oBAAoB,mHAc/B,CAAC"}
1
+ {"version":3,"file":"noIgnoreDeprecations.d.ts","sourceRoot":"","sources":["../../../src/rules/suppressions/noIgnoreDeprecations.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,oBAAoB,4GAc/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/quality",
3
- "version": "0.46.0",
3
+ "version": "0.48.0",
4
4
  "description": "Repository quality gate with typed rules, a baseline of existing debt and a registry of reasoned exceptions",
5
5
  "homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/quality#readme",
6
6
  "bugs": {
@@ -62,7 +62,7 @@
62
62
  "@effect/platform-node": "4.0.6",
63
63
  "@effect/platform-node-shared": "4.0.6",
64
64
  "@effect/vitest": "4.0.6",
65
- "@shivaedev/test-story": "0.25.0",
65
+ "@shivaedev/test-story": "0.26.2",
66
66
  "@types/node": "24.19.2",
67
67
  "@typescript/native": "npm:typescript@7.0.2",
68
68
  "effect": "4.0.6",
@@ -2,9 +2,9 @@ import { createRequire } from "node:module";
2
2
  import process from "node:process";
3
3
  import { Effect, Stream } from "effect";
4
4
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
5
+ import { withExceptionConfig } from "#biome/exceptionConfig.ts";
5
6
  import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
6
7
  import { shadcnFolders } from "#inventory/shadcnFolders.ts";
7
- import { withExceptionConfig } from "./exceptionConfig.ts";
8
8
 
9
9
  export interface BiomeRun {
10
10
  readonly code: number;
@@ -0,0 +1,116 @@
1
+ import ts from "typescript";
2
+ import type { SourceFile } from "#rule.ts";
3
+ import { parse } from "#rules/parse.ts";
4
+
5
+ interface Edit {
6
+ readonly end: number;
7
+ readonly start: number;
8
+ readonly text: string;
9
+ }
10
+
11
+ function unwrap(node: ts.Expression): ts.Expression {
12
+ return ts.isParenthesizedExpression(node) ? unwrap(node.expression) : node;
13
+ }
14
+
15
+ function conditionalChild(node: ts.Expression): ts.Expression | undefined {
16
+ const value = unwrap(node);
17
+ if (!(ts.isJsxElement(value) || ts.isJsxFragment(value))) {
18
+ return undefined;
19
+ }
20
+ if (ts.isJsxElement(value)) {
21
+ const { tagName, attributes } = value.openingElement;
22
+ if (!(ts.isIdentifier(tagName) && /^[a-z]/u.test(tagName.text)) || attributes.properties.length > 0) {
23
+ return undefined;
24
+ }
25
+ }
26
+ const children = value.children.filter((item) => !ts.isJsxText(item) || item.text.trim() !== "");
27
+ if (children.length !== 1) {
28
+ return undefined;
29
+ }
30
+ const child = children[0];
31
+ if (child !== undefined && (ts.isJsxElement(child) || ts.isJsxFragment(child))) {
32
+ return conditionalChild(child);
33
+ }
34
+ if (child === undefined || !ts.isJsxExpression(child) || child.expression === undefined) {
35
+ return undefined;
36
+ }
37
+ const expression = unwrap(child.expression);
38
+ return isConditional(expression) ? child.expression : undefined;
39
+ }
40
+
41
+ function isConditional(expression: ts.Expression): boolean {
42
+ return (
43
+ ts.isConditionalExpression(expression)
44
+ || (ts.isBinaryExpression(expression) && expression.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken)
45
+ );
46
+ }
47
+
48
+ function returnedExpression(node: ts.Node): ts.Expression | undefined {
49
+ if (ts.isReturnStatement(node)) {
50
+ return node.expression;
51
+ }
52
+ return ts.isArrowFunction(node) && !ts.isBlock(node.body) ? node.body : undefined;
53
+ }
54
+
55
+ function mapped(node: ts.Node): boolean {
56
+ return ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === "map";
57
+ }
58
+
59
+ function manualDecision(node: ts.Node): boolean {
60
+ return (
61
+ (ts.isIdentifier(node) && node.text === "eval") || mapped(node) || ts.forEachChild(node, (child) => manualDecision(child) || undefined) === true
62
+ );
63
+ }
64
+
65
+ function returnText(source: ts.SourceFile, node: ts.Node, expression: ts.Expression, rendered: string): string {
66
+ if (ts.isReturnStatement(node)) {
67
+ return source.text.slice(node.getStart(source), expression.getStart(source)) + rendered + source.text.slice(expression.end, node.end);
68
+ }
69
+ return `return ${rendered};`;
70
+ }
71
+
72
+ export function fixJsxConditionals(file: SourceFile): string {
73
+ const parsed = parse(file);
74
+ if (parsed === undefined) {
75
+ return file.text;
76
+ }
77
+ const source = parsed;
78
+ const names = new Set<string>();
79
+ function namesIn(node: ts.Node): void {
80
+ if (ts.isIdentifier(node)) {
81
+ names.add(node.text);
82
+ }
83
+ ts.forEachChild(node, namesIn);
84
+ }
85
+ namesIn(source);
86
+ let name = "qualityContent";
87
+ for (let suffix = 1; names.has(name); suffix += 1) {
88
+ name = `qualityContent${suffix}`;
89
+ }
90
+ const edits: Edit[] = [];
91
+ function visit(node: ts.Node): void {
92
+ if (mapped(node)) {
93
+ return;
94
+ }
95
+ const expression = returnedExpression(node);
96
+ const child = expression === undefined ? undefined : conditionalChild(expression);
97
+ if (expression !== undefined && child !== undefined && !manualDecision(expression)) {
98
+ const rendered = file.text.slice(expression.getStart(source), child.getStart(source)) + name + file.text.slice(child.end, expression.end);
99
+ const start = ts.isReturnStatement(node) ? node.getStart(source) : expression.getStart(source);
100
+ const returned = returnText(source, node, expression, rendered);
101
+ edits.push({
102
+ end: ts.isReturnStatement(node) ? node.end : expression.end,
103
+ start,
104
+ text: `{ const ${name} = ${child.getText(source)}; ${returned} }`,
105
+ });
106
+ return;
107
+ }
108
+ ts.forEachChild(node, visit);
109
+ }
110
+ visit(source);
111
+ let text = file.text;
112
+ for (const edit of edits.toSorted((left, right) => right.start - left.start)) {
113
+ text = text.slice(0, edit.start) + edit.text + text.slice(edit.end);
114
+ }
115
+ return text;
116
+ }
@@ -5,7 +5,9 @@ export function appViteConfig<TPlugin>(plugins: TPlugin[], conditions: string[]
5
5
  server: {
6
6
  host: "127.0.0.1",
7
7
  port: 5173,
8
- proxy: Object.fromEntries(["/api/auth", "/rpc", ...proxyPaths].map((path) => [path, { changeOrigin: false, target: "http://127.0.0.1:3000" }])),
8
+ proxy: Object.fromEntries(
9
+ ["/api/auth", "/rpc", ...proxyPaths].map((path) => [path, { changeOrigin: false, target: "http://127.0.0.1:3000", ws: path === "/rpc" }]),
10
+ ),
9
11
  strictPort: true,
10
12
  },
11
13
  };
@@ -1,9 +1,13 @@
1
1
  import { Console, Effect } from "effect";
2
+ import type { ChildProcessSpawner } from "effect/process";
2
3
  import type { SetupFailure } from "#failure.ts";
3
- import { type Git, gitOrFail } from "#git/command.ts";
4
+ import { gitOrFail } from "#git/command.ts";
4
5
  import { hookCommand, type Launch, shellWords } from "#hooks/command.ts";
5
6
 
6
- export const installDriver = Effect.fn("Baseline.installDriver")(function* (cwd: string, launch: Launch): Effect.fn.Return<void, SetupFailure, Git> {
7
+ export const installDriver = Effect.fn("Baseline.installDriver")(function* (
8
+ cwd: string,
9
+ launch: Launch,
10
+ ): Effect.fn.Return<void, SetupFailure, ChildProcessSpawner.ChildProcessSpawner> {
7
11
  const root = (yield* gitOrFail(cwd, ["rev-parse", "--show-toplevel"])).trim();
8
12
  const command = hookCommand(root, launch, undefined);
9
13
  const driver = `${shellWords([...command.runner, command.launcher, "baseline", "merge"])} "%O" "%A" "%B"`;
@@ -1,6 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import { Effect, FileSystem } from "effect";
3
- import { runBiome } from "./run.ts";
3
+ import { runBiome } from "#adapters/biome/run.ts";
4
4
 
5
5
  const RECOMMENDED_ONLY = '{ "linter": { "rules": { "preset": "recommended" } } }\n';
6
6
 
@@ -1,9 +1,10 @@
1
1
  import { relative, sep } from "node:path";
2
2
  import { Effect, Schema } from "effect";
3
+ import { type BiomeRun, runBiome } from "#adapters/biome/run.ts";
3
4
  import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
5
+ import { SetupFailure } from "#failure.ts";
4
6
  import { ignoredTrackedPaths } from "#inventory/trackedPaths.ts";
5
7
  import { recognizeDiagnostics } from "./recognizeDiagnostics.ts";
6
- import { type BiomeRun, runBiome } from "./run.ts";
7
8
 
8
9
  const Position = Schema.Struct({ column: Schema.optionalKey(Schema.Int), line: Schema.Int });
9
10
 
@@ -27,8 +28,8 @@ const decodeReport = Schema.decodeUnknownOption(Schema.fromJsonString(Report));
27
28
 
28
29
  export const FAILING: ReadonlySet<string> = new Set(["error", "fatal"]);
29
30
 
30
- function failure(args: readonly string[], run: BiomeRun, missing: string, output: string): Error {
31
- return new Error(`biome ${args.join(" ")} exited ${run.code} without ${missing}:\n${output.trim()}`);
31
+ function failure(args: readonly string[], run: BiomeRun, missing: string, output: string): SetupFailure {
32
+ return new SetupFailure({ message: `biome ${args.join(" ")} exited ${run.code} without ${missing}:\n${output.trim()}` });
32
33
  }
33
34
 
34
35
  // Biome exits with an error but prints an empty report when no file was processed, so only a failing diagnostic explains a failed run.
@@ -46,10 +47,10 @@ const reportFor = Effect.fn("Biome.reportFor")(function* (
46
47
  const run = yield* runBiome(root, command, exceptions);
47
48
  const report = decodeReport(run.stdout.trim());
48
49
  if (report._tag === "None") {
49
- return yield* Effect.die(failure(command, run, "a report", [run.stdout, run.stderr].join("\n")));
50
+ return yield* Effect.fail(failure(command, run, "a report", [run.stdout, run.stderr].join("\n")));
50
51
  }
51
52
  if (unexplained(run, report.value)) {
52
- return yield* Effect.die(failure(command, run, "a failing diagnostic", run.stderr));
53
+ return yield* Effect.fail(failure(command, run, "a failing diagnostic", run.stderr));
53
54
  }
54
55
  return report.value;
55
56
  });
@@ -59,7 +60,7 @@ export const biomeReport = Effect.fn("Biome.biomeReport")(function* (
59
60
  args: readonly string[],
60
61
  exceptions: readonly ExceptionDeclaration[] = [],
61
62
  ) {
62
- const [report, tracked] = yield* Effect.all([reportFor(root, args, ["."], exceptions), Effect.promise(() => ignoredTrackedPaths(root))], {
63
+ const [report, tracked] = yield* Effect.all([reportFor(root, args, ["."], exceptions), ignoredTrackedPaths(root)], {
63
64
  concurrency: "unbounded",
64
65
  });
65
66
  const paths = tracked
package/src/cli/args.ts CHANGED
@@ -7,7 +7,7 @@ export type Command =
7
7
  | { readonly _tag: "Setup"; readonly config: string | undefined }
8
8
  | { readonly _tag: "Lint"; readonly config: string | undefined }
9
9
  | { readonly _tag: "ExceptionsMigrate"; readonly config: string | undefined; readonly from: string | undefined }
10
- | { readonly _tag: "Fix"; readonly config: string | undefined }
10
+ | { readonly _tag: "Fix"; readonly config: string | undefined; readonly rules: readonly string[] }
11
11
  | { readonly _tag: "BaselineMerge"; readonly base: string; readonly ours: string; readonly theirs: string }
12
12
  | { readonly _tag: "BaselineInstallDriver" }
13
13
  | { readonly _tag: "BaselineWrite"; readonly config: string | undefined; readonly rules: readonly string[] }
@@ -57,7 +57,7 @@ const ACCEPTS: Readonly<Record<string, readonly Option[]>> = {
57
57
  "baseline write": ["rule"],
58
58
  ci: ["coverage"],
59
59
  "exceptions migrate": ["from"],
60
- fix: [],
60
+ fix: ["rule"],
61
61
  "hooks install": ["force"],
62
62
  "hooks pre-commit": [],
63
63
  "hooks status": [],
@@ -88,7 +88,7 @@ function commandFor(name: string, values: Values): Parsed {
88
88
  case "exceptions migrate":
89
89
  return parsed({ _tag: "ExceptionsMigrate", config, from: values.from });
90
90
  case "fix":
91
- return parsed({ _tag: "Fix", config });
91
+ return parsed({ _tag: "Fix", config, rules: values.rule ?? [] });
92
92
  case "baseline install-driver":
93
93
  return parsed({ _tag: "BaselineInstallDriver" });
94
94
  case "baseline write":
package/src/cli/fix.ts CHANGED
@@ -16,7 +16,7 @@ function isBinary(bytes: Uint8Array): boolean {
16
16
  return bytes.includes(0);
17
17
  }
18
18
 
19
- export function snapshotOf(root: string): Effect.Effect<ReadonlyMap<string, string>, SetupFailure, FileSystem.FileSystem> {
19
+ export function snapshotOf(root: string): Effect.Effect<ReadonlyMap<string, string>, SetupFailure, RuleServices> {
20
20
  return Effect.gen(function* () {
21
21
  const fs = yield* FileSystem.FileSystem;
22
22
  const decoder = new TextDecoder();
@@ -0,0 +1,49 @@
1
+ import { join } from "node:path";
2
+ import { Console, Effect, FileSystem } from "effect";
3
+ import { fixJsxConditionals } from "#adapters/fixJsxConditionals.ts";
4
+ import { loadConfig } from "#config/load.ts";
5
+ import { scan } from "#engine/session.ts";
6
+ import { GateFailed, SetupFailure } from "#failure.ts";
7
+ import { collectInventory } from "#inventory/collect.ts";
8
+ import { plural } from "#report/plural.ts";
9
+ import type { RuleServices } from "#rule.ts";
10
+
11
+ const GROUPED =
12
+ "Consecutive assertions stop on the first failure; outcomes evaluates row expressions up front and reads every outcome before asserting. Rewrite these stories by hand to review that change in evaluation and failure order.";
13
+
14
+ export const fixRule = Effect.fn("Cli.fixRule")(function* (
15
+ cwd: string,
16
+ configPath: string | undefined,
17
+ rules: readonly string[],
18
+ ): Effect.fn.Return<void, SetupFailure | GateFailed, RuleServices> {
19
+ const config = yield* loadConfig(cwd, configPath);
20
+ for (const rule of rules) {
21
+ if (rule !== "react/jsx-conditionals") {
22
+ return yield* new SetupFailure({
23
+ message: `No safe mechanical fix for ${rule}.${rule === "tests/grouped-outcomes" ? ` ${GROUPED}` : " Repair its findings by hand."}`,
24
+ });
25
+ }
26
+ }
27
+ const fs = yield* FileSystem.FileSystem;
28
+ const inventory = yield* collectInventory(config.root, config).pipe(
29
+ Effect.mapError((cause) => new SetupFailure({ cause, message: cause.message })),
30
+ );
31
+ let changed = 0;
32
+ for (const file of inventory.sources) {
33
+ const text = fixJsxConditionals(file);
34
+ if (text !== file.text) {
35
+ yield* fs
36
+ .writeFileString(join(config.root, file.path), text)
37
+ .pipe(Effect.mapError((cause) => new SetupFailure({ cause, message: cause.message })));
38
+ changed += 1;
39
+ }
40
+ }
41
+ yield* Console.log(`quality: react/jsx-conditionals rewrote ${plural(changed, "file")}.`);
42
+ const remaining = (yield* scan({ ...config, active: config.active.filter((rule) => rules.includes(rule.id)) })).violations;
43
+ for (const finding of remaining) {
44
+ yield* Console.log(`${finding.file}:${finding.line ?? 1} ${finding.rule}: ${finding.message}`);
45
+ }
46
+ if (remaining.length > 0) {
47
+ return yield* new GateFailed();
48
+ }
49
+ });