@rexezuge/tooling 1.12.0 → 1.14.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.
- package/README.md +149 -18
- package/dist/eslint-manifest.d.ts +25 -0
- package/dist/eslint-manifest.d.ts.map +1 -0
- package/dist/eslint-manifest.js +1 -0
- package/dist/eslint-manifest.js.map +7 -0
- package/dist/eslint-options.d.ts +54 -0
- package/dist/eslint-options.d.ts.map +1 -0
- package/dist/eslint-options.js +0 -0
- package/dist/eslint-options.js.map +7 -0
- package/dist/eslint-strict.d.ts +45 -0
- package/dist/eslint-strict.d.ts.map +1 -0
- package/dist/eslint-strict.js +1 -0
- package/dist/eslint-strict.js.map +7 -0
- package/dist/eslint.d.ts +2 -36
- package/dist/eslint.d.ts.map +1 -1
- package/dist/eslint.js +1 -1
- package/dist/eslint.js.map +3 -3
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/manifest-validate.d.ts +14 -0
- package/dist/manifest-validate.d.ts.map +1 -0
- package/dist/manifest-validate.js +1 -0
- package/dist/manifest-validate.js.map +7 -0
- package/dist/manifest.d.ts +159 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +3 -0
- package/dist/manifest.js.map +7 -0
- package/dist/pages-proxy.d.ts +2 -0
- package/dist/pages-proxy.d.ts.map +1 -0
- package/dist/pages-proxy.js +1 -0
- package/dist/pages-proxy.js.map +7 -0
- package/dist/plugin-option.d.ts +15 -0
- package/dist/plugin-option.d.ts.map +1 -0
- package/dist/plugin-option.js +1 -0
- package/dist/plugin-option.js.map +7 -0
- package/dist/scripts/check-god-files.d.ts.map +1 -1
- package/dist/scripts/check-god-files.js +2 -2
- package/dist/scripts/check-god-files.js.map +3 -3
- package/dist/scripts/ensure-spa-shell-stub.d.ts +4 -2
- package/dist/scripts/ensure-spa-shell-stub.d.ts.map +1 -1
- package/dist/scripts/ensure-spa-shell-stub.js +1 -2
- package/dist/scripts/ensure-spa-shell-stub.js.map +3 -3
- package/dist/scripts/init-secrets.d.ts +1 -2
- package/dist/scripts/init-secrets.d.ts.map +1 -1
- package/dist/scripts/init-secrets.js +2 -3
- package/dist/scripts/init-secrets.js.map +3 -3
- package/dist/scripts/migrations-lock.d.ts +6 -2
- package/dist/scripts/migrations-lock.d.ts.map +1 -1
- package/dist/scripts/migrations-lock.js +1 -2
- package/dist/scripts/migrations-lock.js.map +3 -3
- package/dist/scripts/prepare-wrangler-config.d.ts +6 -2
- package/dist/scripts/prepare-wrangler-config.d.ts.map +1 -1
- package/dist/scripts/prepare-wrangler-config.js +1 -2
- package/dist/scripts/prepare-wrangler-config.js.map +3 -3
- package/dist/scripts/validate-locales.d.ts +20 -2
- package/dist/scripts/validate-locales.d.ts.map +1 -1
- package/dist/scripts/validate-locales.js +5 -5
- package/dist/scripts/validate-locales.js.map +3 -3
- package/dist/scripts/verify-spa-shell.d.ts +7 -2
- package/dist/scripts/verify-spa-shell.d.ts.map +1 -1
- package/dist/scripts/verify-spa-shell.js +1 -2
- package/dist/scripts/verify-spa-shell.js.map +3 -3
- package/dist/test/mocks/cloudflare-workers.d.ts +6 -103
- package/dist/test/mocks/cloudflare-workers.d.ts.map +1 -1
- package/dist/test/mocks/cloudflare-workers.js +1 -1
- package/dist/test/mocks/cloudflare-workers.js.map +3 -3
- package/dist/vite.d.ts +2 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +3 -3
- package/dist/vite.js.map +3 -3
- package/dist/vitest-aliases.d.ts +3 -0
- package/dist/vitest-aliases.d.ts.map +1 -1
- package/dist/vitest-aliases.js +1 -1
- package/dist/vitest-aliases.js.map +3 -3
- package/dist/vitest-integration.d.ts +3 -2
- package/dist/vitest-integration.d.ts.map +1 -1
- package/dist/vitest-integration.js +1 -1
- package/dist/vitest-integration.js.map +3 -3
- package/dist/vitest-repo.d.ts +5 -3
- package/dist/vitest-repo.d.ts.map +1 -1
- package/dist/vitest-repo.js +1 -1
- package/dist/vitest-repo.js.map +3 -3
- package/dist/vitest-web.d.ts +3 -2
- package/dist/vitest-web.d.ts.map +1 -1
- package/dist/vitest-web.js +1 -1
- package/dist/vitest-web.js.map +3 -3
- package/dist/vitest.d.ts +5 -3
- package/dist/vitest.d.ts.map +1 -1
- package/dist/vitest.js +1 -1
- package/dist/vitest.js.map +3 -3
- package/package.json +14 -3
- package/presets/prettier.d.mts +4 -0
- package/presets/prettier.mjs +16 -0
- package/presets/tsconfig/base.json +19 -0
- package/presets/tsconfig/web.json +10 -0
- package/presets/tsconfig/worker.json +9 -0
- package/schema/manifest.schema.json +105 -0
- package/src/eslint-manifest.ts +71 -0
- package/src/eslint-options.ts +54 -0
- package/src/eslint-strict.test.ts +106 -0
- package/src/eslint-strict.ts +191 -0
- package/src/eslint.ts +18 -41
- package/src/index.ts +15 -2
- package/src/manifest-validate.ts +202 -0
- package/src/manifest.test.ts +228 -0
- package/src/manifest.ts +194 -0
- package/src/pages-proxy.test.ts +8 -0
- package/src/pages-proxy.ts +13 -0
- package/src/plugin-option.test.ts +13 -0
- package/src/plugin-option.ts +18 -0
- package/src/presets.test.ts +63 -0
- package/src/scripts/check-god-files.ts +3 -0
- package/src/scripts/ensure-spa-shell-stub.ts +18 -10
- package/src/scripts/entrypoints.test.ts +55 -0
- package/src/scripts/init-secrets.ts +8 -6
- package/src/scripts/migrations-lock.ts +22 -17
- package/src/scripts/prepare-wrangler-config.ts +26 -14
- package/src/scripts/validate-locales.ts +39 -17
- package/src/scripts/verify-spa-shell.ts +21 -20
- package/src/test/mocks/cloudflare-workers.ts +6 -113
- package/src/vite.ts +6 -3
- package/src/vitest-aliases.test.ts +23 -0
- package/src/vitest-aliases.ts +22 -1
- package/src/vitest-factories.test.ts +30 -1
- package/src/vitest-integration.ts +5 -3
- package/src/vitest-repo.ts +10 -5
- package/src/vitest-web.ts +5 -3
- package/src/vitest.ts +10 -5
package/README.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Config factories, repo scripts, test helpers, and CI templates for the
|
|
4
4
|
Rexezuge-CloudflareWorkers family.
|
|
5
5
|
|
|
6
|
-
**
|
|
7
|
-
helpers import nothing from another `@rexezuge/*` package. The
|
|
8
|
-
`
|
|
6
|
+
**Almost no internal dependencies.** The config factories, the Pages proxy and the test
|
|
7
|
+
helpers import nothing from another `@rexezuge/*` package. The two exceptions are
|
|
8
|
+
`@rexezuge/testing` (the deprecated `cloudflare:workers` re-export and the mock
|
|
9
|
+
the Vitest factories fall back to) and `scripts/backup/encrypt-backup.ts`, which uses `@rexezuge/d1`'s AES-GCM so a backup
|
|
9
10
|
and the workers share one definition of "what an encryption key looks like"; that
|
|
10
11
|
dependency is declared on this package and is only ever resolved in a consumer
|
|
11
12
|
repo, where the kit is installed alongside `@rexezuge/d1`.
|
|
@@ -74,6 +75,122 @@ export default [
|
|
|
74
75
|
];
|
|
75
76
|
```
|
|
76
77
|
|
|
78
|
+
### The family manifest — `.rexezuge.jsonc`
|
|
79
|
+
|
|
80
|
+
One file at the repo root says what the repo _is_. The factories read it instead
|
|
81
|
+
of encoding consumer directory names, so the kit carries no repo layout and a
|
|
82
|
+
repo's layout stays out of its lint config.
|
|
83
|
+
|
|
84
|
+
```jsonc
|
|
85
|
+
// .rexezuge.jsonc
|
|
86
|
+
{
|
|
87
|
+
"$schema": "./node_modules/@rexezuge/tooling/schema/manifest.schema.json",
|
|
88
|
+
"name": "mail-meow",
|
|
89
|
+
"scope": "@mail-meow",
|
|
90
|
+
"features": {
|
|
91
|
+
"d1": { "binding": "DB", "database": "mail-meow", "migrationsDir": "migrations" },
|
|
92
|
+
"web": { "pages": true, "spaShell": true },
|
|
93
|
+
"background": true,
|
|
94
|
+
"backupD1": true,
|
|
95
|
+
"durableObjects": ["CronTasksDO"],
|
|
96
|
+
"workflows": ["SyncWorkflow"],
|
|
97
|
+
"email": true,
|
|
98
|
+
},
|
|
99
|
+
"layers": [
|
|
100
|
+
{ "name": "shared", "dir": "packages/shared", "mayImport": [] },
|
|
101
|
+
{ "name": "data", "dir": "packages/backend-data", "mayImport": ["shared"] },
|
|
102
|
+
{ "name": "services", "dir": "packages/backend-services", "mayImport": ["shared", "data"] },
|
|
103
|
+
{ "name": "api", "dir": "apps/api", "mayImport": ["services", "shared"], "typeOnly": ["data"], "http": true },
|
|
104
|
+
{ "name": "web", "dir": "apps/web", "mayImport": [], "browser": true },
|
|
105
|
+
],
|
|
106
|
+
"quality": {
|
|
107
|
+
"coverage": { "lines": 80, "branches": 70, "functions": 80, "statements": 80 },
|
|
108
|
+
"godFiles": { "soft": 300, "hard": 400 },
|
|
109
|
+
},
|
|
110
|
+
"extensions": { "mail-meow": { "anything": "the kit never reads this" } },
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
| Field | Meaning |
|
|
115
|
+
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| `name`, `scope` | Required. `scope` is the npm scope with its `@`; `defineRepoLintConfig` takes it from here when `scope` is not passed. |
|
|
117
|
+
| `features` | `d1 {binding, database, migrationsDir?}`, `web {pages, spaShell}`, `background`, `backupD1`, `durableObjects[]`, `queues[]`, `workflows[]`, `email`, `android`. Declarative today; scripts and templates key off it. |
|
|
118
|
+
| `layers[]` | `name`, `dir` (no globs), `mayImport[]` (layer names; `[]` isolates the layer from the whole scope), optional `typeOnly[]`, `package`, `forbid[]` + `forbidMessage`, `http`, `browser`. Replaces the canonical layer table. |
|
|
119
|
+
| `quality.coverage` | `{lines, branches, functions, statements}`. The default `thresholds` of `defineUnitVitestConfig` / `defineRepoVitestConfig` (an explicit `thresholds` option wins). |
|
|
120
|
+
| `quality.godFiles` | `{soft, hard}`, read by `check-god-files`. **May only be lowered**: the validator refuses a value above the family 300 / 400. |
|
|
121
|
+
| `extensions` | The open side. One object per owner namespace, free-form, never read by the kit. |
|
|
122
|
+
|
|
123
|
+
The schema is closed: an unknown key is an error with its path (`features.d1.binding: "db" is invalid (an UPPER_SNAKE binding name)`), because a
|
|
124
|
+
typo that is silently ignored is a gate that never ran. Every problem is reported at once.
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import { loadManifest, parseManifest, validateManifest } from '@rexezuge/tooling/manifest';
|
|
128
|
+
|
|
129
|
+
loadManifest(process.cwd()); // FamilyManifest | null (null: no file); throws ManifestError when present but invalid
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**What reads it.** `defineRepoLintConfig` loads `<tsconfigRootDir or cwd>/.rexezuge.jsonc` automatically (`manifest: false` ignores it,
|
|
133
|
+
`manifest: {...}` passes one in). `layers` replace the canonical table: each layer bans every other layer's `<scope>/<basename of dir>` it does not
|
|
134
|
+
list, `typeOnly` layers become an `allowTypeImports` ban, and `http` / `browser` name the directories the strict rules and the browser globals apply to.
|
|
135
|
+
A manifest **without** `layers`, or no manifest at all, keeps the legacy canonical table (`projectDirs`, now `@deprecated`), so nothing breaks on upgrade.
|
|
136
|
+
The Vitest factories read `quality.coverage`; `check-god-files` reads `quality.godFiles`.
|
|
137
|
+
|
|
138
|
+
**Per-consumer entries.** The legacy table hard-coded these directories, so a repo adopting `layers` restates the ones it relied on:
|
|
139
|
+
|
|
140
|
+
| Repo(s) | Layers to declare |
|
|
141
|
+
| ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
142
|
+
| Mail-Meow, Mail-Otter, Mail-Bee, AWS-AccessBridge, Agent-Router, Image-Host, Pigeongram, CalDAV-Bridge | `shared`, `backend-runtime`, `backend-data`, `provider-clients`, `backend-services`, `apps/api` (`typeOnly: ["data"]`, `http: true`), `apps/background`, `apps/web` (`browser: true`, `mayImport: []`); `backend-errors` where present |
|
|
143
|
+
| Durable-DAV, Durable-DAV-Router, Edge-Sonic | the above plus `webdav` and (Durable-DAV) `dav-store`; `apps/api` bans `dav-store` |
|
|
144
|
+
| Edge-Git | the above plus `git-protocol` and `git-service`; `apps/api` bans `git-service` |
|
|
145
|
+
| Discord-Telegram-Bridge, Records-Provider | their `bridge-core` / `record-core` boundary as `extraLayers` today; move it to `layers` when they adopt a manifest |
|
|
146
|
+
| TOTP-Generator, ChordDHT-Tracker | `apps/api` (`http: true`) and `apps/web` (`browser: true`); ChordDHT-Tracker also imports `hono` from a package, so mark that package `http: true` |
|
|
147
|
+
|
|
148
|
+
### Strict lint rules
|
|
149
|
+
|
|
150
|
+
`defineRepoLintConfig` carries a **strict side** that is on by default and has no wholesale off switch. The only way to waive a rule is a per-file
|
|
151
|
+
`// eslint-disable-next-line <rule> -- <reason>` (or a later config block in your own `eslint.config.mjs`), so a waiver is visible in review. Every message
|
|
152
|
+
names the kit API to use. The rules use kit-local rules (`rexezuge/restricted-import`, `rexezuge/no-hand-built-envelope`) and `no-restricted-globals`,
|
|
153
|
+
not `no-restricted-imports` / `no-restricted-syntax`, because flat config _replaces_ a rule's options per file: a strict entry in those two would erase
|
|
154
|
+
(or be erased by) the layer boundaries wherever their globs overlap.
|
|
155
|
+
|
|
156
|
+
| Rule | Bans | Use instead | Exempt |
|
|
157
|
+
| ----------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------- |
|
|
158
|
+
| `no-restricted-globals` (`console`) | `console.*` | `createLogger` from `@rexezuge/runtime` (redacts, levels, correlates) | browser dirs (`apps/web`), `scripts/`, tests |
|
|
159
|
+
| `rexezuge/restricted-import` | `hono`, `chanfana` (static, re-export, dynamic `import()`, `require`; types too) | `createApiApp` from `@rexezuge/http/hono`; keep framework types in the http layer | `apps/api`, `http: true` layers, `httpDirs` |
|
|
160
|
+
| `rexezuge/restricted-import` | `jose` | `accessAuth` / `authenticateAccess` from `@rexezuge/http` (`forgeAccessJwt` in tests) | `http: true` layers, `httpDirs`, tests |
|
|
161
|
+
| `rexezuge/restricted-import` | `uuid`, `nanoid` | `UUIDUtil` / `CryptoIdGenerator` from `@rexezuge/shared` (inject an `IdGenerator`) | `http: true` layers, `httpDirs`, tests |
|
|
162
|
+
| `rexezuge/no-hand-built-envelope` | an object literal `{ Exception: { Type, … } }` | throw a typed error from `@rexezuge/errors`; the `@rexezuge/http` error mapper builds the envelope | `http: true` layers, `httpDirs`, tests |
|
|
163
|
+
|
|
164
|
+
`description`-required disable comments (`eslint-comments/require-description`) are not enforced: no comments plugin is part of the kit's peer set.
|
|
165
|
+
Pass `httpDirs: ['packages/http']` for an http package in a repo without a manifest.
|
|
166
|
+
|
|
167
|
+
### Presets — tsconfig and Prettier
|
|
168
|
+
|
|
169
|
+
The family carried thirteen identical root `tsconfig.json` copies, near-identical per-app ones, and identical `.prettierrc`s. They are presets now:
|
|
170
|
+
|
|
171
|
+
```jsonc
|
|
172
|
+
// tsconfig.json (root: tests and tooling)
|
|
173
|
+
{ "extends": "@rexezuge/tooling/tsconfig/base.json" }
|
|
174
|
+
|
|
175
|
+
// apps/api/tsconfig.json (likewise apps/background)
|
|
176
|
+
{
|
|
177
|
+
"extends": "@rexezuge/tooling/tsconfig/worker.json",
|
|
178
|
+
"compilerOptions": { "paths": { "@/*": ["./src/*"] } },
|
|
179
|
+
"include": ["../../worker-configuration.d.ts", "src/**/*.ts"],
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// apps/web/tsconfig.json
|
|
183
|
+
{ "extends": "@rexezuge/tooling/tsconfig/web.json", "include": ["src/**/*.ts", "src/**/*.tsx"] }
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
- `base.json`: ES2022, `module: ES2022`, `moduleResolution: Bundler`, `strict`, `isolatedModules`, `noEmit`, `resolveJsonModule`, `skipLibCheck`.
|
|
187
|
+
- `worker.json`: base, `lib: [ES2022, DOM]`. The Workers types come from the repo's generated `worker-configuration.d.ts`, which the repo adds to `include` (the preset cannot know its path).
|
|
188
|
+
- `web.json`: base with ES2020, `lib: [ES2020, DOM, DOM.Iterable]` and `jsx: react-jsx`.
|
|
189
|
+
- Prettier: `"prettier": "@rexezuge/tooling/prettier"` in `package.json` (140 columns, single quotes, semicolons, spaces), then delete `.prettierrc`.
|
|
190
|
+
A package that needs a tweak imports the config and spreads it from a `prettier.config.mjs`.
|
|
191
|
+
|
|
192
|
+
The SDK's own `tsconfig.base.json` extends `base.json` and `package.json` uses the Prettier preset.
|
|
193
|
+
|
|
77
194
|
### Vitest — the worker and packages half
|
|
78
195
|
|
|
79
196
|
```ts
|
|
@@ -214,23 +331,23 @@ import, so the module typechecks without a generated `worker-configuration.d.ts`
|
|
|
214
331
|
`createPagesProxy({ forwardClientIp: false })` is the Edge-Sonic variant, for a
|
|
215
332
|
worker that refuses `X-Forwarded-For` outright.
|
|
216
333
|
|
|
334
|
+
With the default options the whole file is a re-export (this is what `rexezuge sync` writes):
|
|
335
|
+
|
|
336
|
+
```ts
|
|
337
|
+
// functions/[[path]].ts
|
|
338
|
+
export { onRequest } from '@rexezuge/tooling/pages-proxy';
|
|
339
|
+
```
|
|
340
|
+
|
|
217
341
|
---
|
|
218
342
|
|
|
219
343
|
## 3. Test helpers
|
|
220
344
|
|
|
221
345
|
### `test/mocks/cloudflare-workers` — the `cloudflare:workers` stand-in
|
|
222
346
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
Converged from the eight copies: `DurableObject`, `RpcTarget` (present because
|
|
230
|
-
`dofs`' `Fs` extends it, and its absence is a module-load failure rather than a
|
|
231
|
-
test failure), and `WorkflowEntrypoint`. The ambient `DurableObjectState` /
|
|
232
|
-
`ExecutionContext` shapes are declared locally, so it typechecks inside the kit and
|
|
233
|
-
still typechecks against a consumer's generated types.
|
|
347
|
+
**Moved to [`@rexezuge/testing`](../testing/README.md).** `@rexezuge/tooling/test/mocks/cloudflare-workers` stays as a `@deprecated` re-export, so existing shims
|
|
348
|
+
keep resolving. `defineUnitVitestConfig` / `defineRepoVitestConfig` alias `cloudflare:workers` to `<repo>/test/mocks/cloudflare-workers.ts` when it exists and
|
|
349
|
+
to `@rexezuge/testing/cloudflare-workers` when it does not, so a repo deletes its copy and changes nothing else. `@rexezuge/testing` is therefore the second
|
|
350
|
+
declared dependency of this package (beside `@rexezuge/d1`).
|
|
234
351
|
|
|
235
352
|
### `test/integration-migrations` — applying the migration directory
|
|
236
353
|
|
|
@@ -259,14 +376,28 @@ file and the statement.
|
|
|
259
376
|
|
|
260
377
|
## 4. Scripts
|
|
261
378
|
|
|
262
|
-
|
|
263
|
-
repo (that is the intended use — they resolve paths relative to the repository they
|
|
264
|
-
run in), or run it straight out of the installed package:
|
|
379
|
+
Run them through the [`rexezuge` CLI](../cli/README.md), which imports them as functions and runs compiled JavaScript on Node 24 (no `tsx`):
|
|
265
380
|
|
|
266
381
|
```bash
|
|
267
|
-
pnpm
|
|
382
|
+
pnpm add -D @rexezuge/cli
|
|
383
|
+
pnpm exec rexezuge god-files # check-god-files
|
|
384
|
+
pnpm exec rexezuge spa-shell ensure # ensure-spa-shell-stub
|
|
385
|
+
pnpm exec rexezuge spa-shell verify # verify-spa-shell
|
|
386
|
+
pnpm exec rexezuge locales validate # validate-locales
|
|
387
|
+
pnpm exec rexezuge migrations verify # verify-migrations
|
|
388
|
+
pnpm exec rexezuge migrations lock # migrations-lock
|
|
389
|
+
pnpm exec rexezuge prepare-wrangler # prepare-wrangler-config
|
|
390
|
+
pnpm exec rexezuge init-secrets # init-secrets
|
|
268
391
|
```
|
|
269
392
|
|
|
393
|
+
**Deprecated, still working:** running a script's `.ts` file directly (`pnpm exec tsx node_modules/@rexezuge/tooling/src/scripts/<name>.ts [args]`) or copying
|
|
394
|
+
the `scripts/` tree into a repo. Both keep their command-line behaviour and exit codes, but a vendored copy is exactly what `rexezuge doctor` flags
|
|
395
|
+
(`vendored.*`); switch the `package.json` script and the workflow step to the CLI and delete the copy.
|
|
396
|
+
|
|
397
|
+
Every entrypoint also exports its work as a function, so the CLI (and your own tooling) can call it without a subprocess: `main(args)` in
|
|
398
|
+
`ensure-spa-shell-stub`, `verify-spa-shell`, `migrations-lock`, `prepare-wrangler-config` (reads `process.env` and `process.cwd()` when first imported) and `init-secrets` (async),
|
|
399
|
+
plus the pure rule functions (`checkGodFiles`, `verifyMigrations`, `verifySpaShell`, `collectLocaleProblems`). Each module runs its CLI only when it is the entrypoint.
|
|
400
|
+
|
|
270
401
|
| Script | What it does | Usage |
|
|
271
402
|
| ---------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
272
403
|
| `check-god-files.ts` | 300-line warn / 400-line critical guard, warn-only by default, with an allowlist | `--root <dir>` `--allowlist <file>` `--soft 300` `--hard 400` `--fail-on-hard` |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FamilyManifest } from './manifest.ts';
|
|
2
|
+
import type { LayerBan } from './eslint-boundaries.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Turn a manifest's `layers` into the {@link LayerBan} rows the boundary rules
|
|
5
|
+
* consume, so the manifest replaces the kit's canonical (consumer-shaped) table
|
|
6
|
+
* rather than adding a second mechanism.
|
|
7
|
+
*
|
|
8
|
+
* A layer's package is `<scope>/<basename of dir>` unless `package` says
|
|
9
|
+
* otherwise. Every layer it does not list in `mayImport` or `typeOnly` is banned;
|
|
10
|
+
* `mayImport: []` bans the whole scope, so an isolated layer (the SPA) also
|
|
11
|
+
* refuses packages the manifest never declared. `typeOnly` layers become a second
|
|
12
|
+
* row with `allowTypeImports`, because the two carry different messages.
|
|
13
|
+
*/
|
|
14
|
+
export declare function manifestLayerBans(manifest: FamilyManifest): LayerBan[];
|
|
15
|
+
/**
|
|
16
|
+
Directories declared `http: true`, plus `apps/api` which is the http layer by definition.
|
|
17
|
+
*/
|
|
18
|
+
export declare function manifestHttpDirs(manifest: FamilyManifest | null): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Browser directories: layers declared `browser: true`, or `apps/web` when the
|
|
21
|
+
* manifest declares the web feature. Without a manifest, `apps/web` (the
|
|
22
|
+
* long-standing default).
|
|
23
|
+
*/
|
|
24
|
+
export declare function manifestBrowserDirs(manifest: FamilyManifest | null): string[];
|
|
25
|
+
//# sourceMappingURL=eslint-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-manifest.d.ts","sourceRoot":"","sources":["../src/eslint-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,EAAE,CAsCtE;AAED;;EAEE;AACF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,GAAG,MAAM,EAAE,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,GAAG,MAAM,EAAE,CAI7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=Object.defineProperty;var s=(n,t)=>c(n,"name",{value:t,configurable:!0});function f(n){const t=n.layers??[],r=n.scope,p=s(e=>`${r}/${e.package??e.dir.split("/").at(-1)??e.dir}`,"pkg"),m=new Map(t.map(e=>[e.name,e])),a=[];for(const e of t){const y=new Set([e.name,...e.mayImport,...e.typeOnly??[]]);if(e.mayImport.length===0&&(e.typeOnly??[]).length===0)a.push({dir:e.dir,ban:[`${r}/*`],message:`${e.name} may not import any ${r} package (.rexezuge.jsonc layers: mayImport is empty)`});else{const o=t.filter(l=>!y.has(l.name)).map(p);o.length>0&&a.push({dir:e.dir,ban:o,message:`${e.name} may only import ${e.mayImport.join(", ")||"nothing"} (.rexezuge.jsonc layers)`})}const i=(e.typeOnly??[]).flatMap(o=>m.get(o)??[]).map(p);i.length>0&&a.push({dir:e.dir,ban:i,allowTypeImports:!0,message:`${e.name} may import ${(e.typeOnly??[]).join(", ")} as types only (.rexezuge.jsonc layers)`}),e.forbid&&e.forbid.length>0&&a.push({dir:e.dir,ban:e.forbid,message:e.forbidMessage??`${e.name} may not import this package`})}return a}s(f,"manifestLayerBans");function g(n){return(n?.layers??[]).filter(t=>t.http===!0).map(t=>t.dir)}s(g,"manifestHttpDirs");function u(n){if(n===null)return["apps/web"];const t=(n.layers??[]).filter(r=>r.browser===!0).map(r=>r.dir);return n.features?.web?[...new Set(["apps/web",...t])]:t}s(u,"manifestBrowserDirs");export{u as manifestBrowserDirs,g as manifestHttpDirs,f as manifestLayerBans};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/eslint-manifest.ts"],
|
|
4
|
+
"sourcesContent": ["import type { FamilyManifest, ManifestLayer } from './manifest.ts';\nimport type { LayerBan } from './eslint-boundaries.ts';\n\n/**\n * Turn a manifest's `layers` into the {@link LayerBan} rows the boundary rules\n * consume, so the manifest replaces the kit's canonical (consumer-shaped) table\n * rather than adding a second mechanism.\n *\n * A layer's package is `<scope>/<basename of dir>` unless `package` says\n * otherwise. Every layer it does not list in `mayImport` or `typeOnly` is banned;\n * `mayImport: []` bans the whole scope, so an isolated layer (the SPA) also\n * refuses packages the manifest never declared. `typeOnly` layers become a second\n * row with `allowTypeImports`, because the two carry different messages.\n */\nexport function manifestLayerBans(manifest: FamilyManifest): LayerBan[] {\n const layers = manifest.layers ?? [];\n const scope = manifest.scope;\n const pkg = (layer: ManifestLayer): string => `${scope}/${layer.package ?? layer.dir.split('/').at(-1) ?? layer.dir}`;\n const byName = new Map(layers.map((layer) => [layer.name, layer]));\n const bans: LayerBan[] = [];\n for (const layer of layers) {\n const allowed = new Set([layer.name, ...layer.mayImport, ...(layer.typeOnly ?? [])]);\n if (layer.mayImport.length === 0 && (layer.typeOnly ?? []).length === 0) {\n bans.push({\n dir: layer.dir,\n ban: [`${scope}/*`],\n message: `${layer.name} may not import any ${scope} package (.rexezuge.jsonc layers: mayImport is empty)`,\n });\n } else {\n const banned = layers.filter((other) => !allowed.has(other.name)).map(pkg);\n if (banned.length > 0) {\n bans.push({\n dir: layer.dir,\n ban: banned,\n message: `${layer.name} may only import ${layer.mayImport.join(', ') || 'nothing'} (.rexezuge.jsonc layers)`,\n });\n }\n }\n const typeOnly = (layer.typeOnly ?? []).flatMap((name) => byName.get(name) ?? []).map(pkg);\n if (typeOnly.length > 0) {\n bans.push({\n dir: layer.dir,\n ban: typeOnly,\n allowTypeImports: true,\n message: `${layer.name} may import ${(layer.typeOnly ?? []).join(', ')} as types only (.rexezuge.jsonc layers)`,\n });\n }\n if (layer.forbid && layer.forbid.length > 0) {\n bans.push({ dir: layer.dir, ban: layer.forbid, message: layer.forbidMessage ?? `${layer.name} may not import this package` });\n }\n }\n return bans;\n}\n\n/**\nDirectories declared `http: true`, plus `apps/api` which is the http layer by definition.\n*/\nexport function manifestHttpDirs(manifest: FamilyManifest | null): string[] {\n return (manifest?.layers ?? []).filter((layer) => layer.http === true).map((layer) => layer.dir);\n}\n\n/**\n * Browser directories: layers declared `browser: true`, or `apps/web` when the\n * manifest declares the web feature. Without a manifest, `apps/web` (the\n * long-standing default).\n */\nexport function manifestBrowserDirs(manifest: FamilyManifest | null): string[] {\n if (manifest === null) return ['apps/web'];\n const declared = (manifest.layers ?? []).filter((layer) => layer.browser === true).map((layer) => layer.dir);\n return manifest.features?.web ? [...new Set(['apps/web', ...declared])] : declared;\n}\n"],
|
|
5
|
+
"mappings": "+EAcM,SAAUA,EAAkBC,EAAwB,CACxD,MAAMC,EAASD,EAAS,QAAU,CAAA,EAC5BE,EAAQF,EAAS,MACjBG,EAAMC,EAACC,GAAiC,GAAGH,CAAK,IAAIG,EAAM,SAAWA,EAAM,IAAI,MAAM,GAAG,EAAE,GAAG,EAAE,GAAKA,EAAM,GAAG,GAAvG,OACNC,EAAS,IAAI,IAAIL,EAAO,IAAKI,GAAU,CAACA,EAAM,KAAMA,CAAK,CAAC,CAAC,EAC3DE,EAAmB,CAAA,EACzB,UAAWF,KAASJ,EAAQ,CAC1B,MAAMO,EAAU,IAAI,IAAI,CAACH,EAAM,KAAM,GAAGA,EAAM,UAAW,GAAIA,EAAM,UAAY,CAAA,CAAG,CAAC,EACnF,GAAIA,EAAM,UAAU,SAAW,IAAMA,EAAM,UAAY,CAAA,GAAI,SAAW,EACpEE,EAAK,KAAK,CACR,IAAKF,EAAM,IACX,IAAK,CAAC,GAAGH,CAAK,IAAI,EAClB,QAAS,GAAGG,EAAM,IAAI,uBAAuBH,CAAK,wDACnD,MACI,CACL,MAAMO,EAASR,EAAO,OAAQS,GAAU,CAACF,EAAQ,IAAIE,EAAM,IAAI,CAAC,EAAE,IAAIP,CAAG,EACrEM,EAAO,OAAS,GAClBF,EAAK,KAAK,CACR,IAAKF,EAAM,IACX,IAAKI,EACL,QAAS,GAAGJ,EAAM,IAAI,oBAAoBA,EAAM,UAAU,KAAK,IAAI,GAAK,SAAS,4BAClF,CAEL,CACA,MAAMM,GAAYN,EAAM,UAAY,CAAA,GAAI,QAASO,GAASN,EAAO,IAAIM,CAAI,GAAK,CAAA,CAAE,EAAE,IAAIT,CAAG,EACrFQ,EAAS,OAAS,GACpBJ,EAAK,KAAK,CACR,IAAKF,EAAM,IACX,IAAKM,EACL,iBAAkB,GAClB,QAAS,GAAGN,EAAM,IAAI,gBAAgBA,EAAM,UAAY,CAAA,GAAI,KAAK,IAAI,CAAC,0CACvE,EAECA,EAAM,QAAUA,EAAM,OAAO,OAAS,GACxCE,EAAK,KAAK,CAAE,IAAKF,EAAM,IAAK,IAAKA,EAAM,OAAQ,QAASA,EAAM,eAAiB,GAAGA,EAAM,IAAI,8BAA8B,CAAE,CAEhI,CACA,OAAOE,CACT,CAtCgBH,EAAAL,EAAA,qBA2CV,SAAUc,EAAiBb,EAA+B,CAC9D,OAAQA,GAAU,QAAU,CAAA,GAAI,OAAQK,GAAUA,EAAM,OAAS,EAAI,EAAE,IAAKA,GAAUA,EAAM,GAAG,CACjG,CAFgBD,EAAAS,EAAA,oBASV,SAAUC,EAAoBd,EAA+B,CACjE,GAAIA,IAAa,KAAM,MAAO,CAAC,UAAU,EACzC,MAAMe,GAAYf,EAAS,QAAU,CAAA,GAAI,OAAQK,GAAUA,EAAM,UAAY,EAAI,EAAE,IAAKA,GAAUA,EAAM,GAAG,EAC3G,OAAOL,EAAS,UAAU,IAAM,CAAC,GAAG,IAAI,IAAI,CAAC,WAAY,GAAGe,CAAQ,CAAC,CAAC,EAAIA,CAC5E,CAJgBX,EAAAU,EAAA",
|
|
6
|
+
"names": ["manifestLayerBans", "manifest", "layers", "scope", "pkg", "__name", "layer", "byName", "bans", "allowed", "banned", "other", "typeOnly", "name", "manifestHttpDirs", "manifestBrowserDirs", "declared"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { LayerBan } from './eslint-boundaries.ts';
|
|
2
|
+
import type { FamilyManifest } from './manifest.ts';
|
|
3
|
+
/**
|
|
4
|
+
* What `defineRepoLintConfig` accepts.
|
|
5
|
+
*/
|
|
6
|
+
export interface RepoLintConfigOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The consuming repo's npm scope, e.g. `'@myapp'`. Every `no-restricted-imports`
|
|
9
|
+
* pattern in the boundary rules is derived from it, so the same factory serves
|
|
10
|
+
* all nine repos.
|
|
11
|
+
*/
|
|
12
|
+
readonly scope?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The family manifest. Omitted: `<tsconfigRootDir or cwd>/.rexezuge.jsonc` is
|
|
15
|
+
* loaded when it exists. Pass `false` to ignore the file. A manifest supplies
|
|
16
|
+
* `scope` (unless given here), replaces the canonical layer table with its own
|
|
17
|
+
* `layers` (when it declares any), and names the http and browser directories
|
|
18
|
+
* the strict rules exempt.
|
|
19
|
+
*/
|
|
20
|
+
readonly manifest?: FamilyManifest | false;
|
|
21
|
+
/**
|
|
22
|
+
* Extra http-layer directories (may import `hono`/`chanfana`, hand-build the
|
|
23
|
+
* error envelope), beside `apps/api` and the manifest's `http: true` layers.
|
|
24
|
+
*/
|
|
25
|
+
readonly httpDirs?: readonly string[];
|
|
26
|
+
/**
|
|
27
|
+
* The workspace directories the legacy canonical layer table is scoped to, as
|
|
28
|
+
* repo-relative globs. Only used when no manifest declares `layers`.
|
|
29
|
+
*
|
|
30
|
+
* @deprecated Declare `layers` in `.rexezuge.jsonc` instead: the canonical
|
|
31
|
+
* table encodes consumer package names.
|
|
32
|
+
*/
|
|
33
|
+
readonly projectDirs?: readonly string[];
|
|
34
|
+
/**
|
|
35
|
+
* Extra ignore globs, merged with the canonical set.
|
|
36
|
+
*/
|
|
37
|
+
readonly extraIgnores?: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* Where `projectService` resolves the tsconfig from. Defaults to the directory
|
|
40
|
+
* ESLint is invoked in, which is the repo root in every CI job.
|
|
41
|
+
*/
|
|
42
|
+
readonly tsconfigRootDir?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Extra boundary layers, appended to the canonical table.
|
|
45
|
+
*
|
|
46
|
+
* The escape valve for a repo whose layout has a boundary the canonical table
|
|
47
|
+
* does not name — AWS-AccessBridge's `apps/api/src/endpoints/**` rule ("route
|
|
48
|
+
* classes must not import DAOs directly") and its `aws4fetch` ban are the shape.
|
|
49
|
+
* Same {@link LayerBan} form, so `extraLayers` flows through the
|
|
50
|
+
* `no-restricted-imports` and the `no-restricted-syntax` guard alike.
|
|
51
|
+
*/
|
|
52
|
+
readonly extraLayers?: readonly LayerBan[];
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=eslint-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-options.d.ts","sourceRoot":"","sources":["../src/eslint-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,KAAK,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC5C"}
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import type tseslint from 'typescript-eslint';
|
|
3
|
+
/**
|
|
4
|
+
* The family's **strict side** of the lint config: rules a repo cannot switch
|
|
5
|
+
* off wholesale, only waive per file with an `eslint-disable` comment.
|
|
6
|
+
*
|
|
7
|
+
* Every rule here exists because a family repo once re-implemented something the
|
|
8
|
+
* kit now owns; each message names the kit API to use instead. They use two
|
|
9
|
+
* kit-local rules (`rexezuge/restricted-import`, `rexezuge/no-hand-built-envelope`)
|
|
10
|
+
* and `no-restricted-globals` rather than `no-restricted-imports` /
|
|
11
|
+
* `no-restricted-syntax`: flat config replaces a rule's options per file instead
|
|
12
|
+
* of merging them, so a strict entry in those two would silently erase the layer
|
|
13
|
+
* boundaries (or be erased by them) wherever the globs overlap.
|
|
14
|
+
*/
|
|
15
|
+
type ConfigInput = Parameters<typeof tseslint.config>[number];
|
|
16
|
+
interface ImportBan {
|
|
17
|
+
readonly names: readonly string[];
|
|
18
|
+
readonly message: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const REXEZUGE_PLUGIN: {
|
|
21
|
+
rules: {
|
|
22
|
+
'restricted-import': Rule.RuleModule;
|
|
23
|
+
'no-hand-built-envelope': Rule.RuleModule;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const STRICT_IMPORT_BANS: readonly ImportBan[];
|
|
27
|
+
export declare const FRAMEWORK_BAN: ImportBan;
|
|
28
|
+
export interface StrictOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Directories that are the http layer: they may import hono/chanfana, jose and build envelopes
|
|
31
|
+
* themselves. `apps/api` may import the framework too, but never the rest: it uses the kit.
|
|
32
|
+
*/
|
|
33
|
+
readonly httpDirs: readonly string[];
|
|
34
|
+
/**
|
|
35
|
+
Directories where `console` is allowed.
|
|
36
|
+
*/
|
|
37
|
+
readonly browserDirs: readonly string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The strict rule blocks. Appended after the layer rules; a consumer's own later
|
|
41
|
+
* blocks (and per-file `eslint-disable` comments) are the only way to waive them.
|
|
42
|
+
*/
|
|
43
|
+
export declare function strictConfigs(options: StrictOptions): ConfigInput[];
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=eslint-strict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-strict.d.ts","sourceRoot":"","sources":["../src/eslint-strict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAE9C;;;;;;;;;;;GAWG;AAEH,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,UAAU,SAAS;IACjB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AA6ED,eAAO,MAAM,eAAe;;;;;CAAsG,CAAC;AAWnI,eAAO,MAAM,kBAAkB,EAAE,SAAS,SAAS,EASlD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAI3B,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;MAEE;IACF,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,WAAW,EAAE,CAgDnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var y=Object.defineProperty;var s=(t,r)=>y(t,"name",{value:r,configurable:!0});const i=s(t=>typeof t=="object"&&t!==null?t:null,"asRecord");function g(t){const r=i(t.key);return r===null?null:r.type==="Identifier"&&typeof r.name=="string"?r.name:r.type==="Literal"&&typeof r.value=="string"?r.value:null}s(g,"keyName");const x={meta:{type:"problem",schema:[{type:"object",properties:{bans:{type:"array"}},additionalProperties:!1}],messages:{banned:"`{{specifier}}` is not allowed here. {{message}}"}},create(t){const r=t.options[0]?.bans??[],a=s((e,o)=>{if(typeof o!="string")return;const u=r.find(h=>h.names.some(m=>o===m||o.startsWith(`${m}/`)));u&&t.report({node:e,messageId:"banned",data:{specifier:o,message:u.message}})},"check"),n=s(e=>i(e)?.value,"literal");return{ImportDeclaration:s(e=>a(e,n(e.source)),"ImportDeclaration"),ExportAllDeclaration:s(e=>a(e,n(e.source)),"ExportAllDeclaration"),ExportNamedDeclaration:s(e=>a(e,n(e.source)),"ExportNamedDeclaration"),ImportExpression:s(e=>a(e,n(e.source)),"ImportExpression"),CallExpression:s(e=>{const o=i(e.callee);o?.type==="Identifier"&&o.name==="require"&&a(e,n(e.arguments[0]))},"CallExpression")}}},b={meta:{type:"problem",schema:[],messages:{handBuilt:"Do not hand-build the `{ Exception: { Type, Message } }` envelope. Throw a typed error from @rexezuge/errors and let the @rexezuge/http error mapper (createErrorHandler / ErrorMapper) produce it."}},create(t){return{Property(r){const a=r,n=i(a.value);if(g(a)!=="Exception"||n?.type!=="ObjectExpression")return;(Array.isArray(n.properties)?n.properties:[]).some(o=>o.type==="Property"&&g(o)==="Type")&&t.report({node:r,messageId:"handBuilt"})}}}},E={rules:{"restricted-import":x,"no-hand-built-envelope":b}},l=["**/*.{ts,mts,cts,tsx}"],I=["**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}"],c=["test/**","**/test/**","**/*.test.*","**/*.spec.*"],p=s(t=>t.map(r=>`${r}/**`),"under"),d=[{names:["jose"],message:"Verify Cloudflare Access tokens with accessAuth from @rexezuge/http (and forgeAccessJwt from @rexezuge/testing in tests)."},{names:["uuid","nanoid"],message:"Use UUIDUtil / CryptoIdGenerator from @rexezuge/shared (inject an IdGenerator so tests can fix it)."}],f={names:["hono","chanfana"],message:"The server framework lives in @rexezuge/http/hono and apps/api. Build the app with createApiApp; keep framework types out of other layers."};function v(t){const r=["apps/api",...t.httpDirs];return[{files:I,ignores:[...p(t.browserDirs),...c,"**/scripts/**"],rules:{"no-restricted-globals":["error",{name:"console",message:"Log through createLogger from @rexezuge/runtime: it redacts, levels and correlates. console.* is for apps/web and scripts only."}]}},{files:l,plugins:{rexezuge:E},rules:{}},{files:l,ignores:p(r),rules:{"rexezuge/restricted-import":["error",{bans:[f]}]}},{files:l,ignores:[...p(r),...c],rules:{"rexezuge/restricted-import":["error",{bans:[f,...d]}],"rexezuge/no-hand-built-envelope":"error"}},{files:["apps/api/**/*.{ts,mts,cts,tsx}"],ignores:[...p(t.httpDirs),...c],rules:{"rexezuge/restricted-import":["error",{bans:d}],"rexezuge/no-hand-built-envelope":"error"}}]}s(v,"strictConfigs");export{f as FRAMEWORK_BAN,E as REXEZUGE_PLUGIN,d as STRICT_IMPORT_BANS,v as strictConfigs};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/eslint-strict.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Rule } from 'eslint';\nimport type tseslint from 'typescript-eslint';\n\n/**\n * The family's **strict side** of the lint config: rules a repo cannot switch\n * off wholesale, only waive per file with an `eslint-disable` comment.\n *\n * Every rule here exists because a family repo once re-implemented something the\n * kit now owns; each message names the kit API to use instead. They use two\n * kit-local rules (`rexezuge/restricted-import`, `rexezuge/no-hand-built-envelope`)\n * and `no-restricted-globals` rather than `no-restricted-imports` /\n * `no-restricted-syntax`: flat config replaces a rule's options per file instead\n * of merging them, so a strict entry in those two would silently erase the layer\n * boundaries (or be erased by them) wherever the globs overlap.\n */\n\ntype ConfigInput = Parameters<typeof tseslint.config>[number];\n\ninterface ImportBan {\n readonly names: readonly string[];\n readonly message: string;\n}\n\ninterface Node {\n readonly type: string;\n readonly [key: string]: unknown;\n}\n\nconst asRecord = (value: unknown): Record<string, unknown> | null =>\n typeof value === 'object' && value !== null ? (value as Record<string, unknown>) : null;\n\nfunction keyName(property: Record<string, unknown>): string | null {\n const key = asRecord(property.key);\n if (key === null) return null;\n if (key.type === 'Identifier' && typeof key.name === 'string') return key.name;\n return key.type === 'Literal' && typeof key.value === 'string' ? key.value : null;\n}\n\n/**\n * Flags a module specifier (static, re-export, dynamic `import()` or `require`)\n * that equals, or is a subpath of, a banned name. Type-only imports are flagged\n * too: a framework type leaking across a layer is the failure being prevented.\n */\nconst restrictedImport: Rule.RuleModule = {\n meta: {\n type: 'problem',\n schema: [{ type: 'object', properties: { bans: { type: 'array' } }, additionalProperties: false }],\n messages: { banned: '`{{specifier}}` is not allowed here. {{message}}' },\n },\n create(context) {\n const bans = ((context.options[0] as { bans?: ImportBan[] } | undefined)?.bans ?? []) as readonly ImportBan[];\n const check = (node: Rule.Node, specifier: unknown): void => {\n if (typeof specifier !== 'string') return;\n const hit = bans.find((ban) => ban.names.some((name) => specifier === name || specifier.startsWith(`${name}/`)));\n if (hit) context.report({ node, messageId: 'banned', data: { specifier, message: hit.message } });\n };\n const literal = (source: unknown): unknown => asRecord(source)?.value;\n return {\n ImportDeclaration: (node) => check(node, literal(node.source)),\n ExportAllDeclaration: (node) => check(node, literal(node.source)),\n ExportNamedDeclaration: (node) => check(node, literal(node.source)),\n ImportExpression: (node) => check(node, literal(node.source)),\n CallExpression: (node) => {\n const callee = asRecord(node.callee);\n if (callee?.type === 'Identifier' && callee.name === 'require') check(node, literal(node.arguments[0]));\n },\n };\n },\n};\n\n/**\n * Flags an object literal shaped `{ Exception: { Type, … } }`: the family error\n * envelope, built by hand. The envelope is produced by the kit's error mapper\n * from a thrown typed error, so a hand-built one skips redaction and the\n * status/type mapping.\n */\nconst noHandBuiltEnvelope: Rule.RuleModule = {\n meta: {\n type: 'problem',\n schema: [],\n messages: {\n handBuilt:\n 'Do not hand-build the `{ Exception: { Type, Message } }` envelope. Throw a typed error from @rexezuge/errors and let the @rexezuge/http error mapper (createErrorHandler / ErrorMapper) produce it.',\n },\n },\n create(context) {\n return {\n Property(node) {\n const property = node as unknown as Record<string, unknown>;\n const value = asRecord(property.value);\n if (keyName(property) !== 'Exception' || value?.type !== 'ObjectExpression') return;\n const inner = Array.isArray(value.properties) ? (value.properties as Node[]) : [];\n if (inner.some((entry) => entry.type === 'Property' && keyName(entry) === 'Type')) context.report({ node, messageId: 'handBuilt' });\n },\n };\n },\n};\n\nexport const REXEZUGE_PLUGIN = { rules: { 'restricted-import': restrictedImport, 'no-hand-built-envelope': noHandBuiltEnvelope } };\n\nconst TS_FILES = ['**/*.{ts,mts,cts,tsx}'];\nconst SOURCE_FILES = ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}'];\n/**\nTests, mocks and fixtures: they may spy on `console`, sign tokens, assert the envelope.\n*/\nconst TEST_GLOBS = ['test/**', '**/test/**', '**/*.test.*', '**/*.spec.*'];\n\nconst under = (dirs: readonly string[]): string[] => dirs.map((dir) => `${dir}/**`);\n\nexport const STRICT_IMPORT_BANS: readonly ImportBan[] = [\n {\n names: ['jose'],\n message: 'Verify Cloudflare Access tokens with accessAuth from @rexezuge/http (and forgeAccessJwt from @rexezuge/testing in tests).',\n },\n {\n names: ['uuid', 'nanoid'],\n message: 'Use UUIDUtil / CryptoIdGenerator from @rexezuge/shared (inject an IdGenerator so tests can fix it).',\n },\n];\n\nexport const FRAMEWORK_BAN: ImportBan = {\n names: ['hono', 'chanfana'],\n message:\n 'The server framework lives in @rexezuge/http/hono and apps/api. Build the app with createApiApp; keep framework types out of other layers.',\n};\n\nexport interface StrictOptions {\n /**\n * Directories that are the http layer: they may import hono/chanfana, jose and build envelopes\n * themselves. `apps/api` may import the framework too, but never the rest: it uses the kit.\n */\n readonly httpDirs: readonly string[];\n /**\n Directories where `console` is allowed.\n */\n readonly browserDirs: readonly string[];\n}\n\n/**\n * The strict rule blocks. Appended after the layer rules; a consumer's own later\n * blocks (and per-file `eslint-disable` comments) are the only way to waive them.\n */\nexport function strictConfigs(options: StrictOptions): ConfigInput[] {\n const http = ['apps/api', ...options.httpDirs];\n return [\n {\n files: SOURCE_FILES,\n ignores: [...under(options.browserDirs), ...TEST_GLOBS, '**/scripts/**'],\n rules: {\n 'no-restricted-globals': [\n 'error',\n {\n name: 'console',\n message:\n 'Log through createLogger from @rexezuge/runtime: it redacts, levels and correlates. console.* is for apps/web and scripts only.',\n },\n ],\n },\n },\n {\n files: TS_FILES,\n plugins: { rexezuge: REXEZUGE_PLUGIN },\n rules: {},\n },\n // Rules of one name replace each other per file, so each region states its\n // whole ban list: framework + kit outside the http layer and apps/api (the\n // framework is allowed there), kit only inside apps/api, framework only in\n // tests.\n {\n files: TS_FILES,\n ignores: under(http),\n rules: { 'rexezuge/restricted-import': ['error', { bans: [FRAMEWORK_BAN] }] },\n },\n {\n files: TS_FILES,\n ignores: [...under(http), ...TEST_GLOBS],\n rules: {\n 'rexezuge/restricted-import': ['error', { bans: [FRAMEWORK_BAN, ...STRICT_IMPORT_BANS] }],\n 'rexezuge/no-hand-built-envelope': 'error',\n },\n },\n {\n files: ['apps/api/**/*.{ts,mts,cts,tsx}'],\n ignores: [...under(options.httpDirs), ...TEST_GLOBS],\n rules: {\n 'rexezuge/restricted-import': ['error', { bans: STRICT_IMPORT_BANS }],\n 'rexezuge/no-hand-built-envelope': 'error',\n },\n },\n ];\n}\n"],
|
|
5
|
+
"mappings": "+EA4BA,MAAMA,EAAWC,EAACC,GAChB,OAAOA,GAAU,UAAYA,IAAU,KAAQA,EAAoC,KADpE,YAGjB,SAASC,EAAQC,EAAiC,CAChD,MAAMC,EAAML,EAASI,EAAS,GAAG,EACjC,OAAIC,IAAQ,KAAa,KACrBA,EAAI,OAAS,cAAgB,OAAOA,EAAI,MAAS,SAAiBA,EAAI,KACnEA,EAAI,OAAS,WAAa,OAAOA,EAAI,OAAU,SAAWA,EAAI,MAAQ,IAC/E,CALSJ,EAAAE,EAAA,WAYT,MAAMG,EAAoC,CACxC,KAAM,CACJ,KAAM,UACN,OAAQ,CAAC,CAAE,KAAM,SAAU,WAAY,CAAE,KAAM,CAAE,KAAM,OAAO,CAAE,EAAI,qBAAsB,EAAK,CAAE,EACjG,SAAU,CAAE,OAAQ,kDAAkD,GAExE,OAAOC,EAAO,CACZ,MAAMC,EAASD,EAAQ,QAAQ,CAAC,GAA0C,MAAQ,CAAA,EAC5EE,EAAQR,EAAA,CAACS,EAAiBC,IAA4B,CAC1D,GAAI,OAAOA,GAAc,SAAU,OACnC,MAAMC,EAAMJ,EAAK,KAAMK,GAAQA,EAAI,MAAM,KAAMC,GAASH,IAAcG,GAAQH,EAAU,WAAW,GAAGG,CAAI,GAAG,CAAC,CAAC,EAC3GF,GAAKL,EAAQ,OAAO,CAAE,KAAAG,EAAM,UAAW,SAAU,KAAM,CAAE,UAAAC,EAAW,QAASC,EAAI,OAAO,CAAE,CAAE,CAClG,EAJc,SAKRG,EAAUd,EAACe,GAA6BhB,EAASgB,CAAM,GAAG,MAAhD,WAChB,MAAO,CACL,kBAAmBf,EAACS,GAASD,EAAMC,EAAMK,EAAQL,EAAK,MAAM,CAAC,EAA1C,qBACnB,qBAAsBT,EAACS,GAASD,EAAMC,EAAMK,EAAQL,EAAK,MAAM,CAAC,EAA1C,wBACtB,uBAAwBT,EAACS,GAASD,EAAMC,EAAMK,EAAQL,EAAK,MAAM,CAAC,EAA1C,0BACxB,iBAAkBT,EAACS,GAASD,EAAMC,EAAMK,EAAQL,EAAK,MAAM,CAAC,EAA1C,oBAClB,eAAgBT,EAACS,GAAQ,CACvB,MAAMO,EAASjB,EAASU,EAAK,MAAM,EAC/BO,GAAQ,OAAS,cAAgBA,EAAO,OAAS,WAAWR,EAAMC,EAAMK,EAAQL,EAAK,UAAU,CAAC,CAAC,CAAC,CACxG,EAHgB,kBAKpB,GASIQ,EAAuC,CAC3C,KAAM,CACJ,KAAM,UACN,OAAQ,CAAA,EACR,SAAU,CACR,UACE,wMAGN,OAAOX,EAAO,CACZ,MAAO,CACL,SAASG,EAAI,CACX,MAAMN,EAAWM,EACXR,EAAQF,EAASI,EAAS,KAAK,EACrC,GAAID,EAAQC,CAAQ,IAAM,aAAeF,GAAO,OAAS,mBAAoB,QAC/D,MAAM,QAAQA,EAAM,UAAU,EAAKA,EAAM,WAAwB,CAAA,GACrE,KAAMiB,GAAUA,EAAM,OAAS,YAAchB,EAAQgB,CAAK,IAAM,MAAM,GAAGZ,EAAQ,OAAO,CAAE,KAAAG,EAAM,UAAW,WAAW,CAAE,CACpI,EAEJ,GAGWU,EAAkB,CAAE,MAAO,CAAE,oBAAqBd,EAAkB,yBAA0BY,CAAmB,CAAE,EAE1HG,EAAW,CAAC,uBAAuB,EACnCC,EAAe,CAAC,sCAAsC,EAItDC,EAAa,CAAC,UAAW,aAAc,cAAe,aAAa,EAEnEC,EAAQvB,EAACwB,GAAsCA,EAAK,IAAKC,GAAQ,GAAGA,CAAG,KAAK,EAApE,SAEDC,EAA2C,CACtD,CACE,MAAO,CAAC,MAAM,EACd,QAAS,6HAEX,CACE,MAAO,CAAC,OAAQ,QAAQ,EACxB,QAAS,wGAIAC,EAA2B,CACtC,MAAO,CAAC,OAAQ,UAAU,EAC1B,QACE,8IAmBE,SAAUC,EAAcC,EAAsB,CAClD,MAAMC,EAAO,CAAC,WAAY,GAAGD,EAAQ,QAAQ,EAC7C,MAAO,CACL,CACE,MAAOR,EACP,QAAS,CAAC,GAAGE,EAAMM,EAAQ,WAAW,EAAG,GAAGP,EAAY,eAAe,EACvE,MAAO,CACL,wBAAyB,CACvB,QACA,CACE,KAAM,UACN,QACE,sIAKV,CACE,MAAOF,EACP,QAAS,CAAE,SAAUD,CAAe,EACpC,MAAO,CAAA,GAMT,CACE,MAAOC,EACP,QAASG,EAAMO,CAAI,EACnB,MAAO,CAAE,6BAA8B,CAAC,QAAS,CAAE,KAAM,CAACH,CAAa,CAAC,CAAE,CAAC,GAE7E,CACE,MAAOP,EACP,QAAS,CAAC,GAAGG,EAAMO,CAAI,EAAG,GAAGR,CAAU,EACvC,MAAO,CACL,6BAA8B,CAAC,QAAS,CAAE,KAAM,CAACK,EAAe,GAAGD,CAAkB,CAAC,CAAE,EACxF,kCAAmC,UAGvC,CACE,MAAO,CAAC,gCAAgC,EACxC,QAAS,CAAC,GAAGH,EAAMM,EAAQ,QAAQ,EAAG,GAAGP,CAAU,EACnD,MAAO,CACL,6BAA8B,CAAC,QAAS,CAAE,KAAMI,CAAkB,CAAE,EACpE,kCAAmC,UAI3C,CAhDgB1B,EAAA4B,EAAA",
|
|
6
|
+
"names": ["asRecord", "__name", "value", "keyName", "property", "key", "restrictedImport", "context", "bans", "check", "node", "specifier", "hit", "ban", "name", "literal", "source", "callee", "noHandBuiltEnvelope", "entry", "REXEZUGE_PLUGIN", "TS_FILES", "SOURCE_FILES", "TEST_GLOBS", "under", "dirs", "dir", "STRICT_IMPORT_BANS", "FRAMEWORK_BAN", "strictConfigs", "options", "http"]
|
|
7
|
+
}
|
package/dist/eslint.d.ts
CHANGED
|
@@ -50,42 +50,8 @@
|
|
|
50
50
|
* {@link RepoLintConfigOptions}.
|
|
51
51
|
*/
|
|
52
52
|
import type { FlatConfig } from 'typescript-eslint';
|
|
53
|
-
import type {
|
|
54
|
-
|
|
55
|
-
* What `defineRepoLintConfig` accepts.
|
|
56
|
-
*/
|
|
57
|
-
export interface RepoLintConfigOptions {
|
|
58
|
-
/**
|
|
59
|
-
* The consuming repo's npm scope, e.g. `'@myapp'`. Every `no-restricted-imports`
|
|
60
|
-
* pattern in the boundary rules is derived from it, so the same factory serves
|
|
61
|
-
* all nine repos.
|
|
62
|
-
*/
|
|
63
|
-
readonly scope: string;
|
|
64
|
-
/**
|
|
65
|
-
* The workspace directories the layered boundary rules are scoped to, as repo-
|
|
66
|
-
* relative globs. Defaults to the canonical layout the nine repos share.
|
|
67
|
-
*/
|
|
68
|
-
readonly projectDirs?: readonly string[];
|
|
69
|
-
/**
|
|
70
|
-
* Extra ignore globs, merged with the canonical set.
|
|
71
|
-
*/
|
|
72
|
-
readonly extraIgnores?: readonly string[];
|
|
73
|
-
/**
|
|
74
|
-
* Where `projectService` resolves the tsconfig from. Defaults to the directory
|
|
75
|
-
* ESLint is invoked in, which is the repo root in every CI job.
|
|
76
|
-
*/
|
|
77
|
-
readonly tsconfigRootDir?: string;
|
|
78
|
-
/**
|
|
79
|
-
* Extra boundary layers, appended to the canonical table.
|
|
80
|
-
*
|
|
81
|
-
* The escape valve for a repo whose layout has a boundary the canonical table
|
|
82
|
-
* does not name — AWS-AccessBridge's `apps/api/src/endpoints/**` rule ("route
|
|
83
|
-
* classes must not import DAOs directly") and its `aws4fetch` ban are the shape.
|
|
84
|
-
* Same {@link LayerBan} form, so `extraLayers` flows through the
|
|
85
|
-
* `no-restricted-imports` and the `no-restricted-syntax` guard alike.
|
|
86
|
-
*/
|
|
87
|
-
readonly extraLayers?: readonly LayerBan[];
|
|
88
|
-
}
|
|
53
|
+
import type { RepoLintConfigOptions } from './eslint-options.ts';
|
|
54
|
+
export type { RepoLintConfigOptions } from './eslint-options.ts';
|
|
89
55
|
/**
|
|
90
56
|
* Build the repo's flat config.
|
|
91
57
|
*
|
package/dist/eslint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../src/eslint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../src/eslint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAMjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAsCjE;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,UAAU,CAAC,WAAW,CA4I3F"}
|
package/dist/eslint.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var l=Object.defineProperty;var t=(s,e)=>l(s,"name",{value:e,configurable:!0});import o from"globals";import a from"typescript-eslint";import m from"eslint-plugin-unicorn";import{configs as g}from"eslint-plugin-sonarjs";import d from"eslint-plugin-regexp";import u from"eslint-config-prettier";import R from"eslint-plugin-prettier";import{DEFAULT_PROJECT_DIRS as j,layerBans as x,restrictedDynamicImports as D,restrictedImports as w}from"./eslint-boundaries.js";import{manifestBrowserDirs as C,manifestHttpDirs as S,manifestLayerBans as E}from"./eslint-manifest.js";import{strictConfigs as L}from"./eslint-strict.js";import{loadManifest as b}from"./manifest.js";import{SONARJS_RULES as y,TEST_RULES as O,TYPESCRIPT_RULES as T,UNICORN_RULES as _}from"./eslint-rules.js";function W(s){return s}t(W,"asConfig");function Y(s){return s}t(Y,"asRules");function $(s){const e=s.manifest===!1?null:s.manifest??b(s.tsconfigRootDir??process.cwd()),i=s.scope??e?.scope;if(i===void 0)throw new Error("defineRepoLintConfig: pass `scope`, or add a `.rexezuge.jsonc` manifest that declares it.");const f=s.projectDirs??j,n=[...e?.layers===void 0?x(i).filter(r=>f.some(p=>r.dir.startsWith(p))):E(e),...s.extraLayers??[]],c=C(e);return a.config({ignores:["eslint.config.mjs","eslint.config.js","scripts/**","worker-configuration.d.ts","local/**","app/dist/**","apps/web/dist/**","apps/*/dist/**","src/generated/**","apps/api/src/generated/**","coverage/**","coverage-integration/**","coverage-web/**","node_modules/**",...s.extraIgnores??[]]},{files:["**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}"],languageOptions:{globals:o.node}},{files:["**/*.{ts,mts,cts,tsx}"],extends:a.configs.recommendedTypeChecked,languageOptions:{parserOptions:{projectService:!0,tsconfigRootDir:s.tsconfigRootDir??process.cwd()}}},{files:["**/*.{ts,mts,cts,tsx}"],rules:T},m.configs["flat/recommended"]??m.configs.recommended,g.recommended,{rules:_},{rules:y},d.configs["flat/recommended"],u,{plugins:{prettier:R},rules:{"prettier/prettier":"error"}},...w(n),...D(n),...L({httpDirs:[...S(e),...s.httpDirs??[]],browserDirs:c}),{files:c.map(r=>`${r}/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}`),languageOptions:{globals:{...o.node,...o.browser}}},{files:["test/**/*.{ts,tsx,mts,cts}","**/*.test.{ts,tsx,mts,cts}","**/*.spec.{ts,tsx,mts,cts}"],rules:O})}t($,"defineRepoLintConfig");export{$ as defineRepoLintConfig};
|
package/dist/eslint.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/eslint.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The converged ESLint flat config for a monorepo in the Rexezuge family.\n *\n * Provenance: the base is Durable-DAV's `eslint.config.mjs` (the most\n * elaborate of the nine repos, with the layered `no-restricted-imports` boundary\n * rules). Merged in from the stacks that share the same plugin set:\n *\n * - **Edge-Sonic** — `test/**` is *not* ignored (it is linted like everything else,\n * with a narrow override block for Vitest idioms), and `unicorn/prefer-ternary`\n * is off. Edge-Sonic is also the source for the dynamic-`import()` boundary\n * guard and its `apps/web` layer block.\n * - **Mail-Meow** — `prettier/prettier` is an **error**, not a warning.\n * - **AWS-AccessBridge** — the `apps/api` DAO/service boundary uses\n * `allowTypeImports` where the source repos do not. It is also the source for\n * the anchored skip patterns and the symlink-safe walk that came out of its own\n * backlog.\n * - **CalDAV-Bridge, Mail-Otter, Durable-DAV-Router, Edge-Git, Agent-Router** —\n * the `provider-clients` / `webdav`+`dav-store` / `git-protocol`+`git-service`\n * layers and the per-client `apps/api` alternatives in the boundary table.\n *\n * Canonical decisions, and why each one:\n *\n * 1. **`prettier/prettier: 'error'`.** Three of the four source repos had it at\n * `warn`, which under `eslint --quiet` is unenforceable — a gate nobody can see\n * is a gate that has never run. Formatting drift is therefore a hard failure.\n * 2. **The layered boundary rules are parameterized by `scope`.** Every source\n * repo wrote the same blocks with a different npm scope hardcoded; the\n * factory takes `scope` (`'@myapp'`) and generates the `@myapp/*` patterns.\n * The table itself lives in {@link ./eslint-boundaries.ts} and covers the\n * family superset — a repo without a domain package never triggers its ban,\n * so no repo needs `extraLayers` for a known package.\n * 3. **`test/**` is linted, not ignored.** Durable-DAV/AWS/Mail-Meow ignored it;\n * Edge-Sonic does not, and records why: ~200 KB of test code had accumulated\n * violations that nothing reported.\n * 4. **`apps/web` is a layer in its own right**, banned from every `@scope/*`\n * package. Edge-Sonic is the only source with that block; the others had none,\n * which is how their layer table's \"may import: the browser\" was a convention\n * rather than a gate. A backend package imported by the SPA compiles and then\n * fails at bundle time, with the error pointing at the bundler.\n * 5. **jsdom + node globals for web files.** The sources ran `globals.node` only;\n * `apps/web` needs browser globals as well, and the vitest config for the SPA\n * runs under jsdom, so the lint environment matches the test environment.\n * 6. **`eslint-plugin-react-hooks` is NOT imported here.** The kit stays\n * zero-dependency, and the plugin belongs to the app that has JSX. A consumer\n * appends it — the README shows the four lines.\n *\n * The rule bodies live in {@link ./eslint-rules.ts} and the boundary table in\n * {@link ./eslint-boundaries.ts}; this file is the assembly. A repo that needs a\n * boundary the canonical table does not name passes `extraLayers` — see\n * {@link RepoLintConfigOptions}.\n */\n\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\nimport unicorn from 'eslint-plugin-unicorn';\nimport { configs as sonarjsConfigs } from 'eslint-plugin-sonarjs';\nimport pluginRegexp from 'eslint-plugin-regexp';\nimport eslintConfigPrettier from 'eslint-config-prettier';\nimport prettier from 'eslint-plugin-prettier';\nimport type { FlatConfig } from 'typescript-eslint';\nimport { DEFAULT_PROJECT_DIRS, layerBans, restrictedDynamicImports, restrictedImports } from './eslint-boundaries.ts';\nimport type { LayerBan } from './eslint-boundaries.ts';\nimport { SONARJS_RULES, TEST_RULES, TYPESCRIPT_RULES, UNICORN_RULES } from './eslint-rules.ts';\n\n/**\n * What `defineRepoLintConfig` accepts.\n */\nexport interface RepoLintConfigOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`. Every `no-restricted-imports`\n * pattern in the boundary rules is derived from it, so the same factory serves\n * all nine repos.\n */\n readonly scope: string;\n /**\n * The workspace directories the layered boundary rules are scoped to, as repo-\n * relative globs. Defaults to the canonical layout the nine repos share.\n */\n readonly projectDirs?: readonly string[];\n /**\n * Extra ignore globs, merged with the canonical set.\n */\n readonly extraIgnores?: readonly string[];\n /**\n * Where `projectService` resolves the tsconfig from. Defaults to the directory\n * ESLint is invoked in, which is the repo root in every CI job.\n */\n readonly tsconfigRootDir?: string;\n /**\n * Extra boundary layers, appended to the canonical table.\n *\n * The escape valve for a repo whose layout has a boundary the canonical table\n * does not name — AWS-AccessBridge's `apps/api/src/endpoints/**` rule (\"route\n * classes must not import DAOs directly\") and its `aws4fetch` ban are the shape.\n * Same {@link LayerBan} form, so `extraLayers` flows through the\n * `no-restricted-imports` and the `no-restricted-syntax` guard alike.\n */\n readonly extraLayers?: readonly LayerBan[];\n}\n\n/**\n * One argument to `tseslint.config()`.\n */\ntype ConfigInput = Parameters<typeof tseslint.config>[number];\n\n/**\n * A plugin preset or config object as the source repos pass it.\n */\ntype MaybeConfig = FlatConfig.Config | readonly FlatConfig.Config[];\n\n/**\n * Bridge a third-party preset into `tseslint.config()`.\n *\n * `sonarjs`' `recommended` preset is typed as a union that includes the legacy\n * config shape, which `tseslint.config()` does not accept — but ESLint accepts it\n * at runtime, which is the only thing that matters here. One checked assertion,\n * rather than forking the plugin's own types.\n */\nfunction asConfig(config: MaybeConfig): ConfigInput {\n return config as ConfigInput;\n}\n\n/**\n * Bridge a rule block onto `tseslint.config()`'s `rules` field.\n *\n * The blocks in `eslint-rules.ts` are written as ESLint expects them —\n * `'off' | 'warn' | 'error' | [level, ...options]` — but spelled as data so a\n * rule's reason comment sits beside the rule itself. ESLint's own `RuleEntry`\n * union is narrower than the data shape, and widening every entry to that union\n * would buy nothing; one assertion here, with the reason, is the cheaper and\n * more honest of the two.\n */\nfunction asRules(block: Readonly<Record<string, unknown>>): FlatConfig.Config['rules'] {\n return block as FlatConfig.Config['rules'];\n}\n\n/**\n * Build the repo's flat config.\n *\n * Consumed from the repo root as three lines:\n *\n * ```js\n * // eslint.config.mjs\n * import { defineRepoLintConfig } from '@rexezuge/tooling/eslint';\n * export default defineRepoLintConfig({ scope: '@myapp' });\n * ```\n */\nexport function defineRepoLintConfig(options: RepoLintConfigOptions): FlatConfig.ConfigArray {\n const { scope } = options;\n const projectDirs = options.projectDirs ?? DEFAULT_PROJECT_DIRS;\n const canonical = layerBans(scope).filter((layer) => projectDirs.some((dir) => layer.dir.startsWith(dir)));\n const extra = options.extraLayers ?? [];\n const bans = [...canonical, ...extra];\n\n return tseslint.config(\n {\n ignores: [\n 'eslint.config.mjs',\n 'eslint.config.js',\n 'scripts/**',\n 'worker-configuration.d.ts',\n 'local/**',\n 'app/dist/**',\n 'apps/web/dist/**',\n 'apps/*/dist/**',\n 'src/generated/**',\n 'apps/api/src/generated/**',\n 'coverage/**',\n 'coverage-integration/**',\n 'coverage-web/**',\n 'node_modules/**',\n ...(options.extraIgnores ?? []),\n ],\n },\n\n // Base: globals for all JS/TS source files. Node is the floor because the\n // scripts and the workers both run on it; the web block below adds browser\n // globals rather than replacing them, so a shared file that touches both\n // (there are several in `shared/`) still lints.\n {\n files: ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}'],\n languageOptions: {\n globals: globals.node,\n },\n },\n\n // Type-aware TS rules, scoped to TS files only.\n {\n files: ['**/*.{ts,mts,cts,tsx}'],\n extends: tseslint.configs.recommendedTypeChecked,\n languageOptions: {\n parserOptions: {\n projectService: true,\n tsconfigRootDir: options.tsconfigRootDir ?? process.cwd(),\n },\n },\n },\n\n // --- typescript-eslint overrides (identical in all four source stacks) ---\n {\n files: ['**/*.{ts,mts,cts,tsx}'],\n rules: asRules(TYPESCRIPT_RULES),\n },\n\n // --- Unicorn + SonarJS presets, then the family's off-block ---\n //\n // Both presets come first on purpose: UNICORN_RULES carries `sonarjs/*`\n // offs as well as `unicorn/*` ones (it is the family's single\n // \"deliberately does not follow\" block), and a preset applied after it\n // would re-enable them. That is exactly what shipped — the sonarjs preset\n // sat between the block and the rules it relaxed, so `void-use`,\n // `different-types-comparison`, `use-type-alias`, `redundant-type-aliases`,\n // `no-nested-assignment` and `no-all-duplicated-branches` linted as errors\n // in every consumer. The two presets do not share rule names, so their\n // relative order decides nothing.\n //\n // The unicorn preset is read from whichever spelling the installed major\n // publishes. v78 dropped the `flat/`-prefixed aliases and exports the flat\n // configs directly, so `configs['flat/recommended']` is `undefined` there —\n // and a config object built around it is `undefined` too, which ESLint\n // rejects outright with \"Unexpected undefined config\". The fallback is\n // what makes the factory work on both majors rather than only the one the\n // kit was written against.\n asConfig(unicorn.configs['flat/recommended'] ?? unicorn.configs.recommended),\n asConfig(sonarjsConfigs.recommended),\n {\n rules: asRules(UNICORN_RULES),\n },\n\n // --- SonarJS advisories ---\n {\n rules: asRules(SONARJS_RULES),\n },\n\n // --- Regexp: static analysis for regular expressions ---\n asConfig(pluginRegexp.configs['flat/recommended']),\n\n // --- Prettier: formatting drift is a hard error ---\n //\n // Mail-Meow's decision, adopted repo-wide because the alternative is\n // unenforceable: `pnpm run lint` is `eslint --fix --quiet` in three of the\n // four source repos, and `--quiet` discards every warning, so a\n // `prettier/prettier` *warning* is a silent no-op. 242 files were in that\n // state in Edge-Sonic: the gate had never run.\n asConfig(eslintConfigPrettier),\n {\n plugins: { prettier },\n rules: {\n 'prettier/prettier': 'error',\n },\n },\n\n // --- Import direction guardrails (parameterized by scope) ---\n ...restrictedImports(bans),\n ...restrictedDynamicImports(bans),\n\n // --- Web: browser globals, matching the jsdom test environment ---\n //\n // The sources linted `apps/web` under `globals.node` only, so `window`,\n // `document` and `localStorage` read as undefined globals. The vitest web\n // config runs those suites under jsdom; the lint environment should agree\n // with the environment the code is executed in, or the rule is reporting\n // something untrue about how the file behaves.\n {\n files: ['apps/web/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}'],\n languageOptions: {\n globals: { ...globals.node, ...globals.browser },\n },\n },\n\n // --- Test suite ---\n //\n // `test/**` is deliberately NOT in the ignores list above. See TEST_RULES\n // for the override block and the reasoning behind it.\n {\n files: ['test/**/*.{ts,tsx,mts,cts}', '**/*.test.{ts,tsx,mts,cts}', '**/*.spec.{ts,tsx,mts,cts}'],\n rules: asRules(TEST_RULES),\n },\n );\n}\n"],
|
|
5
|
-
"mappings": "+EAoDA,OAAOA,MAAa,UACpB,OAAOC,MAAc,oBACrB,OAAOC,MAAa,wBACpB,OAAS,WAAWC,MAAsB,wBAC1C,OAAOC,MAAkB,uBACzB,OAAOC,MAA0B,yBACjC,OAAOC,MAAc,yBAErB,OAAS,wBAAAC,EAAsB,aAAAC,EAAW,4BAAAC,EAA0B,qBAAAC,MAAyB,yBAE7F,OAAS,iBAAAC,EAAe,cAAAC,EAAY,oBAAAC,EAAkB,iBAAAC,MAAqB,
|
|
6
|
-
"names": ["globals", "tseslint", "unicorn", "sonarjsConfigs", "pluginRegexp", "eslintConfigPrettier", "prettier", "DEFAULT_PROJECT_DIRS", "layerBans", "restrictedDynamicImports", "restrictedImports", "SONARJS_RULES", "TEST_RULES", "TYPESCRIPT_RULES", "UNICORN_RULES", "asConfig", "config", "__name", "asRules", "block", "defineRepoLintConfig", "options", "scope", "projectDirs", "
|
|
4
|
+
"sourcesContent": ["/**\n * The converged ESLint flat config for a monorepo in the Rexezuge family.\n *\n * Provenance: the base is Durable-DAV's `eslint.config.mjs` (the most\n * elaborate of the nine repos, with the layered `no-restricted-imports` boundary\n * rules). Merged in from the stacks that share the same plugin set:\n *\n * - **Edge-Sonic** — `test/**` is *not* ignored (it is linted like everything else,\n * with a narrow override block for Vitest idioms), and `unicorn/prefer-ternary`\n * is off. Edge-Sonic is also the source for the dynamic-`import()` boundary\n * guard and its `apps/web` layer block.\n * - **Mail-Meow** — `prettier/prettier` is an **error**, not a warning.\n * - **AWS-AccessBridge** — the `apps/api` DAO/service boundary uses\n * `allowTypeImports` where the source repos do not. It is also the source for\n * the anchored skip patterns and the symlink-safe walk that came out of its own\n * backlog.\n * - **CalDAV-Bridge, Mail-Otter, Durable-DAV-Router, Edge-Git, Agent-Router** —\n * the `provider-clients` / `webdav`+`dav-store` / `git-protocol`+`git-service`\n * layers and the per-client `apps/api` alternatives in the boundary table.\n *\n * Canonical decisions, and why each one:\n *\n * 1. **`prettier/prettier: 'error'`.** Three of the four source repos had it at\n * `warn`, which under `eslint --quiet` is unenforceable — a gate nobody can see\n * is a gate that has never run. Formatting drift is therefore a hard failure.\n * 2. **The layered boundary rules are parameterized by `scope`.** Every source\n * repo wrote the same blocks with a different npm scope hardcoded; the\n * factory takes `scope` (`'@myapp'`) and generates the `@myapp/*` patterns.\n * The table itself lives in {@link ./eslint-boundaries.ts} and covers the\n * family superset — a repo without a domain package never triggers its ban,\n * so no repo needs `extraLayers` for a known package.\n * 3. **`test/**` is linted, not ignored.** Durable-DAV/AWS/Mail-Meow ignored it;\n * Edge-Sonic does not, and records why: ~200 KB of test code had accumulated\n * violations that nothing reported.\n * 4. **`apps/web` is a layer in its own right**, banned from every `@scope/*`\n * package. Edge-Sonic is the only source with that block; the others had none,\n * which is how their layer table's \"may import: the browser\" was a convention\n * rather than a gate. A backend package imported by the SPA compiles and then\n * fails at bundle time, with the error pointing at the bundler.\n * 5. **jsdom + node globals for web files.** The sources ran `globals.node` only;\n * `apps/web` needs browser globals as well, and the vitest config for the SPA\n * runs under jsdom, so the lint environment matches the test environment.\n * 6. **`eslint-plugin-react-hooks` is NOT imported here.** The kit stays\n * zero-dependency, and the plugin belongs to the app that has JSX. A consumer\n * appends it — the README shows the four lines.\n *\n * The rule bodies live in {@link ./eslint-rules.ts} and the boundary table in\n * {@link ./eslint-boundaries.ts}; this file is the assembly. A repo that needs a\n * boundary the canonical table does not name passes `extraLayers` — see\n * {@link RepoLintConfigOptions}.\n */\n\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\nimport unicorn from 'eslint-plugin-unicorn';\nimport { configs as sonarjsConfigs } from 'eslint-plugin-sonarjs';\nimport pluginRegexp from 'eslint-plugin-regexp';\nimport eslintConfigPrettier from 'eslint-config-prettier';\nimport prettier from 'eslint-plugin-prettier';\nimport type { FlatConfig } from 'typescript-eslint';\nimport { DEFAULT_PROJECT_DIRS, layerBans, restrictedDynamicImports, restrictedImports } from './eslint-boundaries.ts';\nimport type { RepoLintConfigOptions } from './eslint-options.ts';\nimport { manifestBrowserDirs, manifestHttpDirs, manifestLayerBans } from './eslint-manifest.ts';\nimport { strictConfigs } from './eslint-strict.ts';\nimport { loadManifest } from './manifest.ts';\nimport { SONARJS_RULES, TEST_RULES, TYPESCRIPT_RULES, UNICORN_RULES } from './eslint-rules.ts';\n\nexport type { RepoLintConfigOptions } from './eslint-options.ts';\n\n/**\n * One argument to `tseslint.config()`.\n */\ntype ConfigInput = Parameters<typeof tseslint.config>[number];\n\n/**\n * A plugin preset or config object as the source repos pass it.\n */\ntype MaybeConfig = FlatConfig.Config | readonly FlatConfig.Config[];\n\n/**\n * Bridge a third-party preset into `tseslint.config()`.\n *\n * `sonarjs`' `recommended` preset is typed as a union that includes the legacy\n * config shape, which `tseslint.config()` does not accept — but ESLint accepts it\n * at runtime, which is the only thing that matters here. One checked assertion,\n * rather than forking the plugin's own types.\n */\nfunction asConfig(config: MaybeConfig): ConfigInput {\n return config as ConfigInput;\n}\n\n/**\n * Bridge a rule block onto `tseslint.config()`'s `rules` field.\n *\n * The blocks in `eslint-rules.ts` are written as ESLint expects them —\n * `'off' | 'warn' | 'error' | [level, ...options]` — but spelled as data so a\n * rule's reason comment sits beside the rule itself. ESLint's own `RuleEntry`\n * union is narrower than the data shape, and widening every entry to that union\n * would buy nothing; one assertion here, with the reason, is the cheaper and\n * more honest of the two.\n */\nfunction asRules(block: Readonly<Record<string, unknown>>): FlatConfig.Config['rules'] {\n return block as FlatConfig.Config['rules'];\n}\n\n/**\n * Build the repo's flat config.\n *\n * Consumed from the repo root as three lines:\n *\n * ```js\n * // eslint.config.mjs\n * import { defineRepoLintConfig } from '@rexezuge/tooling/eslint';\n * export default defineRepoLintConfig({ scope: '@myapp' });\n * ```\n */\nexport function defineRepoLintConfig(options: RepoLintConfigOptions): FlatConfig.ConfigArray {\n const manifest = options.manifest === false ? null : (options.manifest ?? loadManifest(options.tsconfigRootDir ?? process.cwd()));\n const scope = options.scope ?? manifest?.scope;\n if (scope === undefined) throw new Error('defineRepoLintConfig: pass `scope`, or add a `.rexezuge.jsonc` manifest that declares it.');\n const projectDirs = options.projectDirs ?? DEFAULT_PROJECT_DIRS;\n const layerRows =\n manifest?.layers === undefined\n ? layerBans(scope).filter((layer) => projectDirs.some((dir) => layer.dir.startsWith(dir)))\n : manifestLayerBans(manifest);\n const bans = [...layerRows, ...(options.extraLayers ?? [])];\n const browserDirs = manifestBrowserDirs(manifest);\n\n return tseslint.config(\n {\n ignores: [\n 'eslint.config.mjs',\n 'eslint.config.js',\n 'scripts/**',\n 'worker-configuration.d.ts',\n 'local/**',\n 'app/dist/**',\n 'apps/web/dist/**',\n 'apps/*/dist/**',\n 'src/generated/**',\n 'apps/api/src/generated/**',\n 'coverage/**',\n 'coverage-integration/**',\n 'coverage-web/**',\n 'node_modules/**',\n ...(options.extraIgnores ?? []),\n ],\n },\n\n // Base: globals for all JS/TS source files. Node is the floor because the\n // scripts and the workers both run on it; the web block below adds browser\n // globals rather than replacing them, so a shared file that touches both\n // (there are several in `shared/`) still lints.\n {\n files: ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}'],\n languageOptions: {\n globals: globals.node,\n },\n },\n\n // Type-aware TS rules, scoped to TS files only.\n {\n files: ['**/*.{ts,mts,cts,tsx}'],\n extends: tseslint.configs.recommendedTypeChecked,\n languageOptions: {\n parserOptions: {\n projectService: true,\n tsconfigRootDir: options.tsconfigRootDir ?? process.cwd(),\n },\n },\n },\n\n // --- typescript-eslint overrides (identical in all four source stacks) ---\n {\n files: ['**/*.{ts,mts,cts,tsx}'],\n rules: asRules(TYPESCRIPT_RULES),\n },\n\n // --- Unicorn + SonarJS presets, then the family's off-block ---\n //\n // Both presets come first on purpose: UNICORN_RULES carries `sonarjs/*`\n // offs as well as `unicorn/*` ones (it is the family's single\n // \"deliberately does not follow\" block), and a preset applied after it\n // would re-enable them. That is exactly what shipped — the sonarjs preset\n // sat between the block and the rules it relaxed, so `void-use`,\n // `different-types-comparison`, `use-type-alias`, `redundant-type-aliases`,\n // `no-nested-assignment` and `no-all-duplicated-branches` linted as errors\n // in every consumer. The two presets do not share rule names, so their\n // relative order decides nothing.\n //\n // The unicorn preset is read from whichever spelling the installed major\n // publishes. v78 dropped the `flat/`-prefixed aliases and exports the flat\n // configs directly, so `configs['flat/recommended']` is `undefined` there —\n // and a config object built around it is `undefined` too, which ESLint\n // rejects outright with \"Unexpected undefined config\". The fallback is\n // what makes the factory work on both majors rather than only the one the\n // kit was written against.\n asConfig(unicorn.configs['flat/recommended'] ?? unicorn.configs.recommended),\n asConfig(sonarjsConfigs.recommended),\n {\n rules: asRules(UNICORN_RULES),\n },\n\n // --- SonarJS advisories ---\n {\n rules: asRules(SONARJS_RULES),\n },\n\n // --- Regexp: static analysis for regular expressions ---\n asConfig(pluginRegexp.configs['flat/recommended']),\n\n // --- Prettier: formatting drift is a hard error ---\n //\n // Mail-Meow's decision, adopted repo-wide because the alternative is\n // unenforceable: `pnpm run lint` is `eslint --fix --quiet` in three of the\n // four source repos, and `--quiet` discards every warning, so a\n // `prettier/prettier` *warning* is a silent no-op. 242 files were in that\n // state in Edge-Sonic: the gate had never run.\n asConfig(eslintConfigPrettier),\n {\n plugins: { prettier },\n rules: {\n 'prettier/prettier': 'error',\n },\n },\n\n // --- Import direction guardrails (parameterized by scope) ---\n ...restrictedImports(bans),\n ...restrictedDynamicImports(bans),\n\n // --- Strict side: family rules a repo waives per file, never wholesale ---\n ...strictConfigs({ httpDirs: [...manifestHttpDirs(manifest), ...(options.httpDirs ?? [])], browserDirs }),\n\n // --- Web: browser globals, matching the jsdom test environment ---\n //\n // The sources linted `apps/web` under `globals.node` only, so `window`,\n // `document` and `localStorage` read as undefined globals. The vitest web\n // config runs those suites under jsdom; the lint environment should agree\n // with the environment the code is executed in, or the rule is reporting\n // something untrue about how the file behaves.\n {\n files: browserDirs.map((dir) => `${dir}/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}`),\n languageOptions: {\n globals: { ...globals.node, ...globals.browser },\n },\n },\n\n // --- Test suite ---\n //\n // `test/**` is deliberately NOT in the ignores list above. See TEST_RULES\n // for the override block and the reasoning behind it.\n {\n files: ['test/**/*.{ts,tsx,mts,cts}', '**/*.test.{ts,tsx,mts,cts}', '**/*.spec.{ts,tsx,mts,cts}'],\n rules: asRules(TEST_RULES),\n },\n );\n}\n"],
|
|
5
|
+
"mappings": "+EAoDA,OAAOA,MAAa,UACpB,OAAOC,MAAc,oBACrB,OAAOC,MAAa,wBACpB,OAAS,WAAWC,MAAsB,wBAC1C,OAAOC,MAAkB,uBACzB,OAAOC,MAA0B,yBACjC,OAAOC,MAAc,yBAErB,OAAS,wBAAAC,EAAsB,aAAAC,EAAW,4BAAAC,EAA0B,qBAAAC,MAAyB,yBAE7F,OAAS,uBAAAC,EAAqB,oBAAAC,EAAkB,qBAAAC,MAAyB,uBACzE,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,gBAAAC,MAAoB,gBAC7B,OAAS,iBAAAC,EAAe,cAAAC,EAAY,oBAAAC,EAAkB,iBAAAC,MAAqB,oBAsB3E,SAASC,EAASC,EAAmB,CACnC,OAAOA,CACT,CAFSC,EAAAF,EAAA,YAcT,SAASG,EAAQC,EAAwC,CACvD,OAAOA,CACT,CAFSF,EAAAC,EAAA,WAeH,SAAUE,EAAqBC,EAA8B,CACjE,MAAMC,EAAWD,EAAQ,WAAa,GAAQ,KAAQA,EAAQ,UAAYX,EAAaW,EAAQ,iBAAmB,QAAQ,IAAG,CAAE,EACzHE,EAAQF,EAAQ,OAASC,GAAU,MACzC,GAAIC,IAAU,OAAW,MAAM,IAAI,MAAM,2FAA2F,EACpI,MAAMC,EAAcH,EAAQ,aAAenB,EAKrCuB,EAAO,CAAC,GAHZH,GAAU,SAAW,OACjBnB,EAAUoB,CAAK,EAAE,OAAQG,GAAUF,EAAY,KAAMG,GAAQD,EAAM,IAAI,WAAWC,CAAG,CAAC,CAAC,EACvFnB,EAAkBc,CAAQ,EACJ,GAAID,EAAQ,aAAe,CAAA,CAAG,EACpDO,EAActB,EAAoBgB,CAAQ,EAEhD,OAAO1B,EAAS,OACd,CACE,QAAS,CACP,oBACA,mBACA,aACA,4BACA,WACA,cACA,mBACA,iBACA,mBACA,4BACA,cACA,0BACA,kBACA,kBACA,GAAIyB,EAAQ,cAAgB,CAAA,IAQhC,CACE,MAAO,CAAC,sCAAsC,EAC9C,gBAAiB,CACf,QAAS1B,EAAQ,OAKrB,CACE,MAAO,CAAC,uBAAuB,EAC/B,QAASC,EAAS,QAAQ,uBAC1B,gBAAiB,CACf,cAAe,CACb,eAAgB,GAChB,gBAAiByB,EAAQ,iBAAmB,QAAQ,IAAG,KAM7D,CACE,MAAO,CAAC,uBAAuB,EAC/B,MAAeR,GAsBRhB,EAAQ,QAAQ,kBAAkB,GAAKA,EAAQ,QAAQ,YACvDC,EAAe,YACxB,CACE,MAAegB,GAIjB,CACE,MAAeH,GAIRZ,EAAa,QAAQ,kBAAkB,EASvCC,EACT,CACE,QAAS,CAAE,SAAAC,CAAQ,EACnB,MAAO,CACL,oBAAqB,UAKzB,GAAGI,EAAkBoB,CAAI,EACzB,GAAGrB,EAAyBqB,CAAI,EAGhC,GAAGhB,EAAc,CAAE,SAAU,CAAC,GAAGF,EAAiBe,CAAQ,EAAG,GAAID,EAAQ,UAAY,CAAA,CAAG,EAAG,YAAAO,CAAW,CAAE,EASxG,CACE,MAAOA,EAAY,IAAKD,GAAQ,GAAGA,CAAG,uCAAuC,EAC7E,gBAAiB,CACf,QAAS,CAAE,GAAGhC,EAAQ,KAAM,GAAGA,EAAQ,OAAO,IAQlD,CACE,MAAO,CAAC,6BAA8B,6BAA8B,4BAA4B,EAChG,MAAeiB,EAChB,CAEL,CA5IgBK,EAAAG,EAAA",
|
|
6
|
+
"names": ["globals", "tseslint", "unicorn", "sonarjsConfigs", "pluginRegexp", "eslintConfigPrettier", "prettier", "DEFAULT_PROJECT_DIRS", "layerBans", "restrictedDynamicImports", "restrictedImports", "manifestBrowserDirs", "manifestHttpDirs", "manifestLayerBans", "strictConfigs", "loadManifest", "SONARJS_RULES", "TEST_RULES", "TYPESCRIPT_RULES", "UNICORN_RULES", "asConfig", "config", "__name", "asRules", "block", "defineRepoLintConfig", "options", "manifest", "scope", "projectDirs", "bans", "layer", "dir", "browserDirs"]
|
|
7
7
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* the repository they run in, so they are run from disk with `tsx`, not imported.
|
|
8
8
|
* See `README.md` for the copy-in recipe and the per-script usage.
|
|
9
9
|
*
|
|
10
|
-
* The zero-dependency rule: nothing here imports another `@rexezuge/*` package
|
|
11
|
-
*
|
|
10
|
+
* The near-zero-dependency rule: nothing here imports another `@rexezuge/*` package
|
|
11
|
+
* except `@rexezuge/testing` (the deprecated `cloudflare:workers` mock re-export). The
|
|
12
|
+
* one other exception in the tree is `scripts/backup/encrypt-backup.ts`, which uses
|
|
12
13
|
* `@rexezuge/d1`'s AES-GCM so the backup and the workers share one definition of
|
|
13
14
|
* "what an encryption key looks like"; that dependency is declared on the package
|
|
14
15
|
* and is only ever resolved in the consumer's repo, where the kit is installed
|
|
@@ -16,6 +17,8 @@
|
|
|
16
17
|
*/
|
|
17
18
|
export { defineRepoLintConfig } from './eslint.ts';
|
|
18
19
|
export type { RepoLintConfigOptions } from './eslint.ts';
|
|
20
|
+
export { FAMILY_GOD_FILE_LIMITS, loadManifest, MANIFEST_FILENAME, ManifestError, parseManifest, validateManifest } from './manifest.ts';
|
|
21
|
+
export type { FamilyManifest, ManifestCoverage, ManifestD1, ManifestFeatures, ManifestLayer, ManifestQuality, ManifestValidation, ManifestWeb, } from './manifest.ts';
|
|
19
22
|
export { defineUnitVitestConfig } from './vitest.ts';
|
|
20
23
|
export type { CoverageThresholds, UnitVitestConfigOptions, VitestAlias } from './vitest.ts';
|
|
21
24
|
export { defineWebVitestConfig } from './vitest-web.ts';
|