@vwala/tooling-config 1.5.0 → 1.5.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.
@@ -113,7 +113,7 @@ Local checks compare with the merge base of `origin/main`. CI must set `REACT_19
113
113
  When an existing Biome command treats warnings as errors, use the shared wrapper:
114
114
 
115
115
  ```sh
116
- node node_modules/@vwala/tooling-config/src/react-compiler/policy/run-biome.mjs ci . --error-on-warnings --diagnostic-level=warn
116
+ pnpm exec vwala-biome ci . --error-on-warnings --diagnostic-level=warn
117
117
  ```
118
118
 
119
119
  Within the explicit React 19 scope, only `noReactForwardRef` and `[no-react-use-context]` warnings remain advisory. Unrelated warnings, warnings outside the scope, plugin failures, configuration failures, and ordinary errors retain their failing behavior.
@@ -64,10 +64,12 @@ Untouched files warn. Added, modified, and renamed source files must resolve eve
64
64
  Where an existing Biome command fails on warnings, invoke the shared wrapper to retain that gate while allowing the two adopted warning categories:
65
65
 
66
66
  ```sh
67
- node node_modules/@vwala/tooling-config/src/react-compiler/policy/run-biome.mjs ci . --error-on-warnings --diagnostic-level=warn
67
+ pnpm exec vwala-biome ci . --error-on-warnings --diagnostic-level=warn
68
68
  ```
69
69
 
70
- The wrapper also accepts `check`, `--write`, changed-file arguments, and the alias `--warnings-as-errors`. Preserve each command's existing warning and diagnostic-level settings; omit the warning flag where warnings were already advisory. It requests a complete JSON report, preserves compiler and plugin warnings in output, and fails on unrelated gated diagnostics, incomplete reports, or tool/configuration failures.
70
+ The public `vwala-biome` command runs the consumer's installed Biome. It accepts `check`, `--write`, changed-file arguments, and the alias `--warnings-as-errors`. Preserve each command's existing warning and diagnostic-level settings; omit the warning flag where warnings were already advisory. Use `vwala-biome` directly inside package scripts and `pnpm exec vwala-biome` in shell commands or CI.
71
+
72
+ Terminal output uses Biome's native reporter. In GitHub Actions, add `--reporter=github` to restore annotations. A complete JSON report is collected separately for the selective warning gate; formatting and linting still execute once. Compiler and plugin warnings remain visible, while unrelated gated diagnostics, incomplete reports, and tool/configuration failures remain blocking. The old `src/react-compiler/policy/run-biome.mjs` entry point remains available, but consumers should use the public command.
71
73
 
72
74
  ## Manual memoization exceptions
73
75
 
package/README.md CHANGED
@@ -86,6 +86,15 @@ Each plugin file carries a header comment explaining the rule and linking to the
86
86
 
87
87
  React Compiler adoption is opt-in per application or package. `useReactCompiler` supplies advisory compiler diagnostics; `no-manual-react-memoization.grit` supplies editor warnings; the shared convention checker makes unexplained memoization blocking across every touched file in an adopted scope. The base preset does not activate these rules for consumers that have not enabled compilation.
88
88
 
89
+ Use the package's `vwala-biome` command to preserve existing warning gates while leaving scoped adoption warnings advisory:
90
+
91
+ ```sh
92
+ pnpm exec vwala-biome check . --error-on-warnings
93
+ pnpm exec vwala-biome ci . --reporter=github
94
+ ```
95
+
96
+ Package scripts can invoke `vwala-biome` directly. It keeps Biome's native terminal output or GitHub annotations and collects a separate complete report for the warning policy in the same invocation. Formatting runs once; ordinary errors and unrelated gated warnings still fail.
97
+
89
98
  See the [React Compiler integration guide](.vwala/docs/react-compiler.md) for build setup, explicit scopes, exceptions, production verification, and the library build helper. The governing team policy lives in the canonical [`vwala-best-practices`](https://github.com/vwala-be/skills/tree/main/skills/vwala-best-practices) skill.
90
99
 
91
100
  ### React 19 APIs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vwala/tooling-config",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "type": "module",
5
5
  "description": "Shared tooling configuration for Vwala repositories",
6
6
  "license": "MIT",
@@ -19,7 +19,8 @@
19
19
  ],
20
20
  "bin": {
21
21
  "compile-react-library": "./src/react-compiler/build/compile-react-library.mjs",
22
- "ensure-gcp-application-default-credentials": "./src/gcloud/ensure-gcp-application-default-credentials.sh"
22
+ "ensure-gcp-application-default-credentials": "./src/gcloud/ensure-gcp-application-default-credentials.sh",
23
+ "vwala-biome": "./src/react-compiler/policy/run-biome.mjs"
23
24
  },
24
25
  "exports": {
25
26
  "./biome": "./src/biome/biome.config.json",
@@ -1,37 +1,60 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawnSync } from "node:child_process";
3
+ import { mkdtempSync, readFileSync, rmSync } from "node:fs";
3
4
  import { createRequire } from "node:module";
5
+ import { tmpdir } from "node:os";
4
6
  import path from "node:path";
5
7
  import { biomeExitCode } from "./biome-exit-code.mjs";
6
8
  import { readBiomeReport } from "./biome-report.mjs";
7
9
  import { readCompilerScope } from "./compiler-scope.mjs";
8
10
  import { readReact19Scope } from "./react-19-scope.mjs";
9
11
 
12
+ let reportDirectory;
10
13
  try {
11
14
  const root = process.cwd();
12
- const scopes = readCompilerScope({ root });
13
- const react19Scopes = readReact19Scope({ root });
14
15
  const args = process.argv.slice(2);
16
+ const informational = args.some((arg) =>
17
+ ["--help", "-h", "--version", "-V"].includes(arg),
18
+ );
19
+ const scopes = informational ? [] : readCompilerScope({ root });
20
+ const react19Scopes = informational ? [] : readReact19Scope({ root });
15
21
  if (
16
- args.some((arg) => /^--(?:reporter|max-diagnostics)(?:=|\s*$)/.test(arg))
22
+ !informational &&
23
+ args.some((arg) =>
24
+ /^--(?:reporter-file|max-diagnostics)(?:=|\s*$)/.test(arg),
25
+ )
17
26
  ) {
18
27
  throw new Error(
19
- "The wrapper owns --reporter and --max-diagnostics to require complete JSON diagnostics",
28
+ "The wrapper owns --reporter-file and --max-diagnostics to require complete JSON diagnostics",
20
29
  );
21
30
  }
22
31
  const warningFlags = new Set(["--error-on-warnings", "--warnings-as-errors"]);
23
32
  const warningsAsErrors = args.some((arg) => warningFlags.has(arg));
24
33
  const require = createRequire(path.join(root, "package.json"));
34
+ if (!informational) {
35
+ reportDirectory = mkdtempSync(path.join(tmpdir(), "vwala-biome-"));
36
+ }
37
+ const reportFile =
38
+ reportDirectory && path.join(reportDirectory, "diagnostics.json");
25
39
  const result = spawnSync(
26
40
  process.execPath,
27
41
  [
28
42
  require.resolve("@biomejs/biome/bin/biome"),
29
43
  ...args.filter((arg) => !warningFlags.has(arg)),
30
- "--reporter=json",
31
- "--max-diagnostics=none",
44
+ ...(informational
45
+ ? []
46
+ : [
47
+ ...(args.some((arg) => /^--reporter(?:=|$)/.test(arg))
48
+ ? []
49
+ : ["--reporter=default"]),
50
+ "--reporter=json",
51
+ `--reporter-file=${reportFile}`,
52
+ "--max-diagnostics=none",
53
+ ]),
32
54
  ],
33
55
  { cwd: root, encoding: "utf8", maxBuffer: 64 * 1024 * 1024 },
34
56
  );
57
+ process.stdout.write(result.stdout ?? "");
35
58
  process.stderr.write(result.stderr ?? "");
36
59
  if (result.error) {
37
60
  throw result.error;
@@ -39,17 +62,24 @@ try {
39
62
  if (result.signal) {
40
63
  throw new Error(`Biome terminated by ${result.signal}`);
41
64
  }
42
- const report = readBiomeReport(result.stdout);
43
- process.stdout.write(result.stdout);
44
- process.exitCode = biomeExitCode({
45
- report,
46
- status: result.status,
47
- warningsAsErrors,
48
- root,
49
- scopes,
50
- react19Scopes,
51
- });
65
+ if (informational) {
66
+ process.exitCode = result.status ?? 1;
67
+ } else {
68
+ const report = readBiomeReport(readFileSync(reportFile, "utf8"));
69
+ process.exitCode = biomeExitCode({
70
+ report,
71
+ status: result.status,
72
+ warningsAsErrors,
73
+ root,
74
+ scopes,
75
+ react19Scopes,
76
+ });
77
+ }
52
78
  } catch (error) {
53
- console.error(`Biome compiler wrapper: ${error.message}`);
79
+ console.error(`vwala-biome: ${error.message}`);
54
80
  process.exitCode = 1;
81
+ } finally {
82
+ if (reportDirectory) {
83
+ rmSync(reportDirectory, { recursive: true, force: true });
84
+ }
55
85
  }