Skip to content

Commit a81083a

Browse files
cliffhallclaude
andauthored
feat: root Prettier and ESLint, per-workspace validate, split test from coverage
Root Prettier 3 (pinned exactly) and a type-aware root ESLint flat config with no-floating-promises at error and build output ignored. Every TS workspace gets format/format:check/lint/typecheck/validate, its test becomes the fast run and coverage the instrumented one. everything's per-package Prettier 2 setup folds into the root. typescript is aligned to one range. Refs #4864 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 150d404 commit a81083a

13 files changed

Lines changed: 1329 additions & 51 deletions

‎.prettierignore‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Build output and installs are never a format target (#4864). Every
2+
# `prettier` script in the repo passes this file with `--ignore-path`, so the
3+
# workspaces (which run from their own directories) read the same list as the
4+
# root. When a build starts writing somewhere new, add it here.
5+
**/dist/
6+
**/coverage/
7+
**/node_modules/

‎eslint.config.js‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import tseslint from "typescript-eslint";
4+
import { defineConfig, globalIgnores } from "eslint/config";
5+
6+
// The one ESLint config for the whole repo (#4864). Every TypeScript workspace
7+
// under `src/*` lints against it (each workspace's `lint` is `eslint .`, and
8+
// ESLint finds this file by walking up), and the root's `lint:root` lints the
9+
// root tooling with it. There is deliberately no per-workspace config: a second
10+
// config is a second place for a rule to be weakened.
11+
//
12+
// Every `lint` script runs with `--max-warnings 0`, so a warning fails the gate
13+
// exactly as an error does — severity here is for the editor, not the gate. A
14+
// rule meant to be enforced is set to `error` so the squiggle reads right too.
15+
//
16+
// Findings are fixed, never silenced through this file: no rule is turned off
17+
// and no first-party path is ignored to make `lint` pass. An inline disable is
18+
// the only waiver, and it carries a one-line justification.
19+
20+
// A leading `_` is the explicit "intentionally unused" marker — an
21+
// interface-conformance parameter, a destructuring-rest omission. Honor it
22+
// rather than deleting the signal.
23+
const unusedVars = {
24+
"@typescript-eslint/no-unused-vars": [
25+
"error",
26+
{
27+
argsIgnorePattern: "^_",
28+
varsIgnorePattern: "^_",
29+
caughtErrorsIgnorePattern: "^_",
30+
},
31+
],
32+
};
33+
34+
export default defineConfig([
35+
// Build output and installs are never a gate target: a bundle or a `.d.ts`
36+
// tsc wrote is not first-party source, and a finding inside one names a
37+
// defect nobody here can fix. When a build starts writing somewhere new, add
38+
// that location here in the same change.
39+
globalIgnores(["**/dist/**", "**/coverage/**", "**/node_modules/**"]),
40+
{
41+
// The TypeScript servers. Type-aware, because the rule that matters most
42+
// here — `no-floating-promises` — needs type information.
43+
//
44+
// The parser project is each workspace's `tsconfig.test.json`, not its
45+
// `tsconfig.json`: the build config excludes the tests (so `tsc` does not
46+
// emit them into `dist/`), and a parser project must literally contain
47+
// every file it is asked to lint. `tsconfig.test.json` covers the whole
48+
// workspace, and it is also the program `typecheck` runs, so the file set
49+
// that is linted and the one that is typechecked cannot drift apart. The
50+
// glob picks up a new workspace with no edit here.
51+
files: ["src/*/**/*.{ts,mts,cts}"],
52+
extends: [js.configs.recommended, tseslint.configs.recommended],
53+
languageOptions: {
54+
ecmaVersion: 2022,
55+
sourceType: "module",
56+
globals: { ...globals.node },
57+
parserOptions: {
58+
project: ["./src/*/tsconfig.test.json"],
59+
tsconfigRootDir: import.meta.dirname,
60+
},
61+
},
62+
rules: {
63+
...unusedVars,
64+
// The class this catches is invisible at review time: a floated call
65+
// reads like an awaited one minus four characters, and the rejection it
66+
// drops surfaces somewhere else entirely, or not at all. Every promise is
67+
// awaited, returned, ended with `.catch(…)`, or discarded with `void`
68+
// plus a comment saying why the caller cannot hold it.
69+
"@typescript-eslint/no-floating-promises": "error",
70+
},
71+
},
72+
{
73+
// Root tooling: the guard scripts and this config. Plain JavaScript that
74+
// no tsconfig contains, so it gets the non-type-aware rules — asking the
75+
// parser for a project would fail these files outright rather than lint
76+
// them.
77+
files: ["scripts/**/*.{js,mjs,cjs}", "*.{js,mjs,cjs}"],
78+
extends: [js.configs.recommended],
79+
languageOptions: {
80+
ecmaVersion: "latest",
81+
sourceType: "module",
82+
globals: { ...globals.node },
83+
},
84+
rules: {
85+
"no-unused-vars": [
86+
"error",
87+
{
88+
argsIgnorePattern: "^_",
89+
varsIgnorePattern: "^_",
90+
caughtErrorsIgnorePattern: "^_",
91+
},
92+
],
93+
},
94+
},
95+
]);

0 commit comments

Comments
 (0)