@vwala/tooling-config 1.5.0 → 1.6.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.
@@ -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
@@ -100,7 +109,7 @@ Two of Biome's own rules carry the naming convention, both at `warn`:
100
109
 
101
110
  | Rule | Enforces |
102
111
  | --- | --- |
103
- | `useFilenamingConvention` | Filenames are kebab-case. Every dot-separated part counts, so `payment.service.ts`, `complete-invoice.command-handler.ts`, `invoice.types.ts` and `invoice.test.ts` all pass while `paymentService.ts` does not. |
112
+ | `useFilenamingConvention` | Filenames are kebab-case. Every dot-separated part counts, so `payment.service.ts`, `complete-invoice.command-handler.ts`, `invoice.types.ts` and `invoice.test.ts` all pass while `paymentService.ts` does not. Filenames starting with `_` or containing `+` or `[` are exempt. |
104
113
  | `useNamingConvention` | `camelCase` variables and functions, `PascalCase` types, classes, interfaces and components, `CONSTANT_CASE` for module-level constants. |
105
114
 
106
115
  They are warnings because the convention applies to new code and asks that existing files be renamed only when meaningfully touched — a repository does not have to rename its way in. `useNamingConvention` deliberately does not check object literal or type properties: those keys are usually dictated by an external payload rather than chosen. `strictCase` is off, so `HTTPServer` is accepted alongside `HttpServer`.
@@ -109,6 +118,8 @@ They are warnings because the convention applies to new code and asks that exist
109
118
 
110
119
  `__tests__`, `__mocks__`, `_scripts`, hidden folders, and the `[slug]` / `(group)` / `@slot` segments Next.js and Expo give meaning to are exempt from the folder check.
111
120
 
121
+ Filenames that carry a routing marker — a leading `_` (`_layout.tsx`), or a `+` or `[` anywhere (`+not-found.tsx`, `hello+api.ts`, `[id].tsx`, `[...slug].tsx`) — are exempt from both `useFilenamingConvention` and `check-naming`, because Expo Router and Next.js own those names. Only the filename counts: `payment_service.ts` still fails, and so does `fooBar.ts` inside `_scripts/`.
122
+
112
123
  Paths under `prisma/migrations/` at any depth are ignored entirely because Prisma owns each migration directory name and persists that exact identity in the database, so it cannot be renamed to kebab-case.
113
124
 
114
125
  ### Exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vwala/tooling-config",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
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",
@@ -16,6 +16,8 @@
16
16
  * warning never fails a build; a file added in this branch has to be an error
17
17
  * somewhere, and this is that somewhere. Expect a new badly-named file to be
18
18
  * reported twice — once by `biome ci` as a warning, once here as an error.
19
+ * Filenames carrying a routing marker (a leading `_`, or a `+` or `[` anywhere)
20
+ * are skipped by both, because Expo Router and Next.js own those names.
19
21
  *
20
22
  * Wire this into a repository's own check script and run it from the repository
21
23
  * root. Set NAMING_BASE_REF when the default branch is not `origin/main`; when
@@ -35,6 +37,10 @@ const KEBAB_CASE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
35
37
  // runnable helpers, anything hidden, and the bracket/paren/@ segments that
36
38
  // Next.js and Expo routing give meaning to.
37
39
  const RESERVED_FOLDER = /^(__[a-z]+__|_[a-z-]+|\..+|\[.+\]|\(.+\)|@.+|\+.+)$/;
40
+ // Filenames that carry a router's marker — Expo's `_layout` and `+not-found`,
41
+ // its `+api` suffix, a `[param]` / `[...slug]` segment — follow whatever that
42
+ // framework enforces, which is not ours to second-guess.
43
+ const FRAMEWORK_FILE = /^_|[+[]/;
38
44
  // Paths whose names another tool owns. Prisma generates a migration directory as
39
45
  // `<timestamp>_<name>` and records that exact string in the `_prisma_migrations`
40
46
  // table, so the name is an identity rather than a choice: no migration can ever
@@ -82,7 +88,7 @@ for (const [folder, { segment, isNew }] of folders) {
82
88
  }
83
89
 
84
90
  for (const file of files) {
85
- if (!SOURCE_FILE.test(file)) {
91
+ if (!SOURCE_FILE.test(file) || FRAMEWORK_FILE.test(basename(file))) {
86
92
  continue;
87
93
  }
88
94
  // `payment.service.ts` is a name plus two extensions; the convention allows a
@@ -59,6 +59,16 @@
59
59
  }
60
60
  }
61
61
  }
62
+ },
63
+ {
64
+ "includes": ["**/_*", "**/*+*", "**/*\\[*"],
65
+ "linter": {
66
+ "rules": {
67
+ "style": {
68
+ "useFilenamingConvention": "off"
69
+ }
70
+ }
71
+ }
62
72
  }
63
73
  ],
64
74
  "plugins": [
@@ -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
  }