@rexezuge/tooling 1.13.0 → 1.15.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 +67 -34
- 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-rules.d.ts.map +1 -1
- package/dist/eslint-rules.js +1 -1
- package/dist/eslint-rules.js.map +2 -2
- package/dist/eslint-strict.d.ts +2 -1
- package/dist/eslint-strict.d.ts.map +1 -1
- package/dist/eslint-strict.js +2 -1
- package/dist/eslint-strict.js.map +3 -3
- package/dist/eslint.d.ts +2 -53
- package/dist/eslint.d.ts.map +1 -1
- package/dist/eslint.js.map +2 -2
- package/dist/manifest-validate.d.ts.map +1 -1
- package/dist/manifest-validate.js +1 -1
- package/dist/manifest-validate.js.map +3 -3
- package/dist/manifest.d.ts +21 -0
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js.map +2 -2
- 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/backup/destinations.d.ts +40 -0
- package/dist/scripts/backup/destinations.d.ts.map +1 -0
- package/dist/scripts/backup/destinations.js +1 -0
- package/dist/scripts/backup/destinations.js.map +7 -0
- package/dist/scripts/backup/encrypt-backup.d.ts +5 -2
- package/dist/scripts/backup/encrypt-backup.d.ts.map +1 -1
- package/dist/scripts/backup/encrypt-backup.js +2 -3
- package/dist/scripts/backup/encrypt-backup.js.map +3 -3
- package/dist/scripts/backup/naming.d.ts +1 -1
- package/dist/scripts/backup/naming.d.ts.map +1 -1
- package/dist/scripts/backup/naming.js +1 -1
- package/dist/scripts/backup/naming.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/scripts/wrangler-config/resources.d.ts +11 -2
- package/dist/scripts/wrangler-config/resources.d.ts.map +1 -1
- package/dist/scripts/wrangler-config/resources.js +1 -1
- package/dist/scripts/wrangler-config/resources.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 +7 -1
- 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 +3 -2
- 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 +4 -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 +3 -3
- package/presets/tsconfig/web.json +2 -2
- package/schema/manifest.schema.json +28 -1
- package/src/eslint-options.ts +54 -0
- package/src/eslint-rules.ts +4 -0
- package/src/eslint-strict.test.ts +29 -0
- package/src/eslint-strict.ts +36 -4
- package/src/eslint.ts +2 -53
- package/src/github/dependabot.yml +14 -4
- package/src/github/workflows/backup-d1.yml +15 -0
- package/src/github/workflows/backup-main.yml +9 -126
- package/src/github/workflows/continuous-deployment.yml +11 -180
- package/src/github/workflows/continuous-integration.yml +9 -249
- package/src/github/workflows/scheduled-version-update.yml +8 -31
- package/src/github/workflows/upstream-sync.yml +8 -49
- package/src/manifest-validate.ts +31 -2
- package/src/manifest.test.ts +22 -0
- package/src/manifest.ts +22 -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 +5 -1
- package/src/scripts/backup/backup-rules.test.ts +22 -0
- package/src/scripts/backup/destinations.ts +59 -0
- package/src/scripts/backup/encrypt-backup.ts +58 -48
- package/src/scripts/backup/naming.ts +2 -2
- 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 +34 -14
- package/src/scripts/validate-locales.ts +39 -17
- package/src/scripts/verify-spa-shell.ts +21 -20
- package/src/scripts/wrangler-config/resources.test.ts +10 -0
- package/src/scripts/wrangler-config/resources.ts +21 -4
- package/src/vite.ts +5 -3
- package/src/vitest-aliases.test.ts +33 -0
- package/src/vitest-aliases.ts +37 -7
- package/src/vitest-integration.ts +7 -8
- package/src/vitest-repo.ts +7 -5
- package/src/vitest-web.ts +7 -5
- package/src/vitest.ts +8 -6
- package/src/github/actions/retry-step/action.yml +0 -55
- package/src/github/actions/setup-env/action.yml +0 -20
package/README.md
CHANGED
|
@@ -111,14 +111,20 @@ repo's layout stays out of its lint config.
|
|
|
111
111
|
}
|
|
112
112
|
```
|
|
113
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.
|
|
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?}`, `kv {bindings[], namespaceNames?}`, `web {pages, spaShell, buildScript?, pagesProject?}`, `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
|
+
`features.kv` drives `prepare-wrangler`'s KV provisioning: it adds the listed bindings a hand-written config lacks and creates their namespaces
|
|
124
|
+
(`<worker>-<binding lower-cased>`, or the name `namespaceNames` gives for a namespace that predates that convention). **No `features.kv`, no KV binding and no
|
|
125
|
+
namespace**: a repo without a cache no longer gets a phantom `CACHE`. A placeholder KV id the config itself carries is still resolved. `features.web.buildScript`
|
|
126
|
+
names a **root** `package.json` script that builds the SPA (a wrapper such as `verify:tailwind && build`); CI and CD run `pnpm run <script>` instead of
|
|
127
|
+
`pnpm --filter <scope>/web run build`. `features.web.pagesProject` names the Pages project (else the `CLOUDFLARE_PAGES_PROJECT_NAME` variable, else `<name>-web`).
|
|
122
128
|
|
|
123
129
|
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
130
|
typo that is silently ignored is a gate that never ran. Every problem is reported at once.
|
|
@@ -160,6 +166,12 @@ not `no-restricted-imports` / `no-restricted-syntax`, because flat config _repla
|
|
|
160
166
|
| `rexezuge/restricted-import` | `jose` | `accessAuth` / `authenticateAccess` from `@rexezuge/http` (`forgeAccessJwt` in tests) | `http: true` layers, `httpDirs`, tests |
|
|
161
167
|
| `rexezuge/restricted-import` | `uuid`, `nanoid` | `UUIDUtil` / `CryptoIdGenerator` from `@rexezuge/shared` (inject an `IdGenerator`) | `http: true` layers, `httpDirs`, tests |
|
|
162
168
|
| `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 |
|
|
169
|
+
| `rexezuge/todo-format` | a `TODO` / `FIXME` comment line without a scope or a description | `TODO(<scope>): <text>`, e.g. `// TODO(sdk): replace with the kit helper` | none |
|
|
170
|
+
|
|
171
|
+
**Task markers.** `rexezuge/todo-format` replaces `sonarjs/todo-tag` and `sonarjs/fixme-tag` (both switched off in the repo config), which flagged even a scoped
|
|
172
|
+
marker and made every tracked gap an error. A marker is a comment line that starts with `TODO` or `FIXME`: `TODO(<scope>): <text>` passes (the scope names who or what
|
|
173
|
+
it waits on, and the text what is to be done); a bare `TODO`, `TODO:`, `FIXME fix it` or `TODO(sdk)` with no text is an error. Prose that merely mentions the word
|
|
174
|
+
("the TODO list") is not a marker. A repo can no longer need `eslint-disable sonarjs/todo-tag` to track an SDK gap.
|
|
163
175
|
|
|
164
176
|
`description`-required disable comments (`eslint-comments/require-description`) are not enforced: no comments plugin is part of the kit's peer set.
|
|
165
177
|
Pass `httpDirs: ['packages/http']` for an http package in a repo without a manifest.
|
|
@@ -185,7 +197,8 @@ The family carried thirteen identical root `tsconfig.json` copies, near-identica
|
|
|
185
197
|
|
|
186
198
|
- `base.json`: ES2022, `module: ES2022`, `moduleResolution: Bundler`, `strict`, `isolatedModules`, `noEmit`, `resolveJsonModule`, `skipLibCheck`.
|
|
187
199
|
- `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
|
|
200
|
+
- `web.json`: base with `lib: [ES2022, DOM, DOM.Iterable]` (never behind the base: the SPA type-checks the shared `contracts` package) and `jsx: react-jsx`.
|
|
201
|
+
- `sync --write` sets `extends` (as the first key), and drops `compilerOptions` entries exactly equal to what the preset sets; a differing value is never touched.
|
|
189
202
|
- Prettier: `"prettier": "@rexezuge/tooling/prettier"` in `package.json` (140 columns, single quotes, semicolons, spaces), then delete `.prettierrc`.
|
|
190
203
|
A package that needs a tweak imports the config and spreads it from a `prettier.config.mjs`.
|
|
191
204
|
|
|
@@ -204,8 +217,9 @@ export default defineUnitVitestConfig({
|
|
|
204
217
|
```
|
|
205
218
|
|
|
206
219
|
v8 coverage with the converged include/exclude patterns (scripts, tests, barrels,
|
|
207
|
-
generated files, type-only modules), the `@scope/* → src` workspace table (the
|
|
208
|
-
|
|
220
|
+
generated files, type-only modules), the `@scope/* → src` workspace table (when the
|
|
221
|
+
manifest declares `layers`, one alias per layer: `<scope>/<package or basename of dir>` to `<dir>/src`; otherwise the family superset `DEFAULT_WORKSPACE_PACKAGES`,
|
|
222
|
+
which includes `contracts` and is exported from `@rexezuge/tooling/vitest`; an explicit `packages` always wins),
|
|
209
223
|
`cloudflare:workers` / `cloudflare:sockets` / `cloudflare:workflows` aliased to
|
|
210
224
|
the bundled Node stand-ins, `@rexezuge/*` kept inside Vite's pipeline
|
|
211
225
|
(`noExternal` — the kit ships bundler-style extensionless imports that Node's
|
|
@@ -331,6 +345,13 @@ import, so the module typechecks without a generated `worker-configuration.d.ts`
|
|
|
331
345
|
`createPagesProxy({ forwardClientIp: false })` is the Edge-Sonic variant, for a
|
|
332
346
|
worker that refuses `X-Forwarded-For` outright.
|
|
333
347
|
|
|
348
|
+
With the default options the whole file is a re-export (this is what `rexezuge sync` writes):
|
|
349
|
+
|
|
350
|
+
```ts
|
|
351
|
+
// functions/[[path]].ts
|
|
352
|
+
export { onRequest } from '@rexezuge/tooling/pages-proxy';
|
|
353
|
+
```
|
|
354
|
+
|
|
334
355
|
---
|
|
335
356
|
|
|
336
357
|
## 3. Test helpers
|
|
@@ -369,14 +390,28 @@ file and the statement.
|
|
|
369
390
|
|
|
370
391
|
## 4. Scripts
|
|
371
392
|
|
|
372
|
-
|
|
373
|
-
repo (that is the intended use — they resolve paths relative to the repository they
|
|
374
|
-
run in), or run it straight out of the installed package:
|
|
393
|
+
Run them through the [`rexezuge` CLI](../cli/README.md), which imports them as functions and runs compiled JavaScript on Node 24 (no `tsx`):
|
|
375
394
|
|
|
376
395
|
```bash
|
|
377
|
-
pnpm
|
|
396
|
+
pnpm add -D @rexezuge/cli
|
|
397
|
+
pnpm exec rexezuge god-files # check-god-files
|
|
398
|
+
pnpm exec rexezuge spa-shell ensure # ensure-spa-shell-stub
|
|
399
|
+
pnpm exec rexezuge spa-shell verify # verify-spa-shell
|
|
400
|
+
pnpm exec rexezuge locales validate # validate-locales
|
|
401
|
+
pnpm exec rexezuge migrations verify # verify-migrations
|
|
402
|
+
pnpm exec rexezuge migrations lock # migrations-lock
|
|
403
|
+
pnpm exec rexezuge prepare-wrangler # prepare-wrangler-config
|
|
404
|
+
pnpm exec rexezuge init-secrets # init-secrets
|
|
378
405
|
```
|
|
379
406
|
|
|
407
|
+
**Deprecated, still working:** running a script's `.ts` file directly (`pnpm exec tsx node_modules/@rexezuge/tooling/src/scripts/<name>.ts [args]`) or copying
|
|
408
|
+
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
|
|
409
|
+
(`vendored.*`); switch the `package.json` script and the workflow step to the CLI and delete the copy.
|
|
410
|
+
|
|
411
|
+
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
|
|
412
|
+
`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),
|
|
413
|
+
plus the pure rule functions (`checkGodFiles`, `verifyMigrations`, `verifySpaShell`, `collectLocaleProblems`). Each module runs its CLI only when it is the entrypoint.
|
|
414
|
+
|
|
380
415
|
| Script | What it does | Usage |
|
|
381
416
|
| ---------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
382
417
|
| `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` |
|
|
@@ -426,35 +461,33 @@ two places) and owns the retention window — `requireRetentionDays` rejects a b
|
|
|
426
461
|
`BACKUP_RETENTION_DAYS` rather than defaulting one — and
|
|
427
462
|
`encrypt-backup.ts` does the crypto in-process with the kit's own AES-GCM.
|
|
428
463
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
neither is tooling).
|
|
464
|
+
`destinations.ts` holds the pure half of the upload step (the `<name>/production` prefix, the `aws s3 ls` row parser, the rule that a prune only
|
|
465
|
+
ever deletes backup artifacts older than the cutoff, the WebDAV target). `rexezuge backup d1 upload s3|webdav` in `@rexezuge/cli` runs `aws` and
|
|
466
|
+
`rclone` with them, so the backup workflow carries no repo-local scripts.
|
|
467
|
+
|
|
468
|
+
**Left local, deliberately:** `compare-reference.ts` and `change-email.ts` (business logic and personal-data operations, respectively; neither is tooling).
|
|
434
469
|
|
|
435
470
|
---
|
|
436
471
|
|
|
437
472
|
## 5. GitHub templates
|
|
438
473
|
|
|
439
|
-
`src/github/` holds
|
|
474
|
+
`src/github/` holds what a repo copies, and it is small on purpose: the pipelines are the SDK's **reusable workflows**
|
|
475
|
+
(`.github/workflows/*.yml` in the SDK repository, `on: workflow_call`, tagged `v1`; see [`docs/workflows.md`](../../docs/workflows.md)).
|
|
440
476
|
|
|
441
477
|
```
|
|
442
478
|
src/github/
|
|
443
|
-
workflows/continuous-integration.yml
|
|
444
|
-
workflows/continuous-deployment.yml
|
|
445
|
-
workflows/scheduled-version-update.yml # .
|
|
446
|
-
workflows/backup-
|
|
447
|
-
workflows/
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
dependabot.yml # weekly, with the @rexezuge/* group
|
|
479
|
+
workflows/continuous-integration.yml # caller of worker-ci.yml
|
|
480
|
+
workflows/continuous-deployment.yml # caller of worker-cd.yml (workflow_run after CI)
|
|
481
|
+
workflows/scheduled-version-update.yml # caller of version-update.yml
|
|
482
|
+
workflows/backup-d1.yml # caller of backup-d1.yml (manifest features.backupD1)
|
|
483
|
+
workflows/backup-main.yml # caller of backup-main.yml (mirrors to Azure DevOps / GitLab)
|
|
484
|
+
workflows/upstream-sync.yml # caller of upstream-sync.yml (a fork's weekly pull)
|
|
485
|
+
dependabot.yml # weekly; groups kit, toolchain, cloudflare; updates the pnpm catalog
|
|
451
486
|
```
|
|
452
487
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
`continuous-deployment.yml`. `upstream-sync.yml` needs its `REPLACE_ME_ORG/REPLACE_ME_REPO`
|
|
457
|
-
upstream; `backup-main.yml` has no placeholders (every value is a secret).
|
|
488
|
+
Each caller is about a dozen lines: its triggers, the permissions the called jobs need, one `uses:` at `@v1` and `secrets: inherit`.
|
|
489
|
+
`rexezuge sync --write` writes them (replacing a repo's full copy of the same workflow) and a test keeps these files identical to what it writes.
|
|
490
|
+
The composite actions (`setup-env`, `retry-step`) are no longer copied: the reusable workflows call them from the SDK at `@v1`.
|
|
458
491
|
|
|
459
492
|
---
|
|
460
493
|
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-rules.d.ts","sourceRoot":"","sources":["../src/eslint-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsB9D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsI3D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"eslint-rules.d.ts","sourceRoot":"","sources":["../src/eslint-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsB9D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsI3D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwB3D,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwDxD,CAAC"}
|
package/dist/eslint-rules.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const n={"@typescript-eslint/no-unused-vars":["error",{argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"@typescript-eslint/no-floating-promises":["error",{ignoreVoid:!0}],"@typescript-eslint/no-explicit-any":"warn","@typescript-eslint/no-unsafe-assignment":"warn","@typescript-eslint/no-unsafe-member-access":"warn","@typescript-eslint/no-unsafe-call":"warn","@typescript-eslint/no-unsafe-return":"warn","@typescript-eslint/no-unsafe-argument":"warn","@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1,properties:!1}}],"@typescript-eslint/require-await":"off","@typescript-eslint/await-thenable":"off"},r={"unicorn/prevent-abbreviations":"off","unicorn/no-null":"off","unicorn/prefer-module":"off","unicorn/prefer-top-level-await":"off","unicorn/custom-error-definition":"off","unicorn/no-process-exit":"off","unicorn/no-array-reduce":"off","unicorn/prefer-number-properties":["error",{checkInfinity:!1}],"unicorn/no-nested-ternary":"off","unicorn/prefer-spread":"off","unicorn/filename-case":"off","unicorn/name-replacements":"off","unicorn/max-nested-calls":"off","unicorn/prefer-import-meta-properties":"off","unicorn/catch-error-name":"off","unicorn/consistent-boolean-name":"off","unicorn/prefer-uint8array-base64":"off","unicorn/consistent-class-member-order":"off","unicorn/no-non-function-verb-prefix":"off","unicorn/no-for-each":"off","unicorn/prefer-await":"warn","unicorn/no-array-callback-reference":"warn","unicorn/no-array-sort":"warn","unicorn/prefer-ternary":"off","unicorn/no-await-expression-member":"off","unicorn/prefer-number-coercion":"off","unicorn/prefer-code-point":"off","unicorn/prefer-simple-condition-first":"off","unicorn/no-top-level-assignment-in-function":"off","unicorn/no-unreadable-for-of-expression":"off","unicorn/no-computed-property-existence-check":"off","unicorn/no-break-in-nested-loop":"off","unicorn/no-this-outside-of-class":"off","unicorn/class-reference-in-static-methods":"off","unicorn/no-global-object-property-assignment":"off","unicorn/prefer-logical-operator-over-ternary":"off","unicorn/better-dom-traversing":"off","unicorn/prefer-iterator-to-array":"off","unicorn/no-array-method-this-argument":"off","unicorn/consistent-function-scoping":"off","unicorn/prefer-includes-over-repeated-comparisons":"off","sonarjs/use-type-alias":"off","sonarjs/redundant-type-aliases":"off","sonarjs/no-nested-assignment":"off","unicorn/prefer-number-is-safe-integer":"off","unicorn/prefer-unicode-code-point-escapes":"off","unicorn/no-this-assignment":"off","unicorn/no-top-level-side-effects":"off","sonarjs/no-all-duplicated-branches":"off","unicorn/prefer-else-if":"off","unicorn/prefer-minimal-ternary":"off","sonarjs/void-use":"off","sonarjs/different-types-comparison":"off","unicorn/prefer-array-from-async":"off"},o={"sonarjs/no-duplicate-string":["warn",{threshold:5}],"sonarjs/cognitive-complexity":["warn",20],"sonarjs/no-hardcoded-passwords":"off","sonarjs/deprecation":"warn","sonarjs/no-nested-conditional":"warn","sonarjs/prefer-read-only-props":"warn","sonarjs/public-static-readonly":"warn","sonarjs/no-nested-template-literals":"warn"},e={"@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{arguments:!1,attributes:!1}}],"@typescript-eslint/unbound-method":"off","@typescript-eslint/require-await":"off","@typescript-eslint/no-redundant-type-constituents":"off","@typescript-eslint/no-unnecessary-type-assertion":"off","unicorn/prefer-promise-with-resolvers":"off","unicorn/consistent-function-scoping":"off","unicorn/no-return-array-push":"off","unicorn/require-array-sort-compare":"off","unicorn/prefer-iterator-helpers":"off","unicorn/prefer-iterator-to-array":"off","unicorn/no-unsafe-string-replacement":"off","unicorn/no-await-expression-member":"off","sonarjs/void-use":"off","sonarjs/no-clear-text-protocols":"off","sonarjs/no-hardcoded-ip":"off","unicorn/prefer-https":"off","sonarjs/assertions-in-tests":"off","sonarjs/no-extra-arguments":"off","sonarjs/use-type-alias":"off","sonarjs/no-alphabetical-sort":"off","sonarjs/no-duplicate-string":"off","unicorn/no-break-in-nested-loop":"off","unicorn/no-array-sort":"off","unicorn/no-unreadable-for-of-expression":"off","unicorn/no-useless-template-literals":"off","unicorn/no-declarations-before-early-exit":"off","unicorn/prefer-includes-over-repeated-comparisons":"off","sonarjs/prefer-specific-assertions":"off","sonarjs/no-inverted-boolean-check":"off"};export{o as SONARJS_RULES,e as TEST_RULES,n as TYPESCRIPT_RULES,r as UNICORN_RULES};
|
|
1
|
+
const n={"@typescript-eslint/no-unused-vars":["error",{argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"@typescript-eslint/no-floating-promises":["error",{ignoreVoid:!0}],"@typescript-eslint/no-explicit-any":"warn","@typescript-eslint/no-unsafe-assignment":"warn","@typescript-eslint/no-unsafe-member-access":"warn","@typescript-eslint/no-unsafe-call":"warn","@typescript-eslint/no-unsafe-return":"warn","@typescript-eslint/no-unsafe-argument":"warn","@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1,properties:!1}}],"@typescript-eslint/require-await":"off","@typescript-eslint/await-thenable":"off"},r={"unicorn/prevent-abbreviations":"off","unicorn/no-null":"off","unicorn/prefer-module":"off","unicorn/prefer-top-level-await":"off","unicorn/custom-error-definition":"off","unicorn/no-process-exit":"off","unicorn/no-array-reduce":"off","unicorn/prefer-number-properties":["error",{checkInfinity:!1}],"unicorn/no-nested-ternary":"off","unicorn/prefer-spread":"off","unicorn/filename-case":"off","unicorn/name-replacements":"off","unicorn/max-nested-calls":"off","unicorn/prefer-import-meta-properties":"off","unicorn/catch-error-name":"off","unicorn/consistent-boolean-name":"off","unicorn/prefer-uint8array-base64":"off","unicorn/consistent-class-member-order":"off","unicorn/no-non-function-verb-prefix":"off","unicorn/no-for-each":"off","unicorn/prefer-await":"warn","unicorn/no-array-callback-reference":"warn","unicorn/no-array-sort":"warn","unicorn/prefer-ternary":"off","unicorn/no-await-expression-member":"off","unicorn/prefer-number-coercion":"off","unicorn/prefer-code-point":"off","unicorn/prefer-simple-condition-first":"off","unicorn/no-top-level-assignment-in-function":"off","unicorn/no-unreadable-for-of-expression":"off","unicorn/no-computed-property-existence-check":"off","unicorn/no-break-in-nested-loop":"off","unicorn/no-this-outside-of-class":"off","unicorn/class-reference-in-static-methods":"off","unicorn/no-global-object-property-assignment":"off","unicorn/prefer-logical-operator-over-ternary":"off","unicorn/better-dom-traversing":"off","unicorn/prefer-iterator-to-array":"off","unicorn/no-array-method-this-argument":"off","unicorn/consistent-function-scoping":"off","unicorn/prefer-includes-over-repeated-comparisons":"off","sonarjs/use-type-alias":"off","sonarjs/redundant-type-aliases":"off","sonarjs/no-nested-assignment":"off","unicorn/prefer-number-is-safe-integer":"off","unicorn/prefer-unicode-code-point-escapes":"off","unicorn/no-this-assignment":"off","unicorn/no-top-level-side-effects":"off","sonarjs/no-all-duplicated-branches":"off","unicorn/prefer-else-if":"off","unicorn/prefer-minimal-ternary":"off","sonarjs/void-use":"off","sonarjs/different-types-comparison":"off","unicorn/prefer-array-from-async":"off"},o={"sonarjs/no-duplicate-string":["warn",{threshold:5}],"sonarjs/cognitive-complexity":["warn",20],"sonarjs/no-hardcoded-passwords":"off","sonarjs/todo-tag":"off","sonarjs/fixme-tag":"off","sonarjs/deprecation":"warn","sonarjs/no-nested-conditional":"warn","sonarjs/prefer-read-only-props":"warn","sonarjs/public-static-readonly":"warn","sonarjs/no-nested-template-literals":"warn"},e={"@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{arguments:!1,attributes:!1}}],"@typescript-eslint/unbound-method":"off","@typescript-eslint/require-await":"off","@typescript-eslint/no-redundant-type-constituents":"off","@typescript-eslint/no-unnecessary-type-assertion":"off","unicorn/prefer-promise-with-resolvers":"off","unicorn/consistent-function-scoping":"off","unicorn/no-return-array-push":"off","unicorn/require-array-sort-compare":"off","unicorn/prefer-iterator-helpers":"off","unicorn/prefer-iterator-to-array":"off","unicorn/no-unsafe-string-replacement":"off","unicorn/no-await-expression-member":"off","sonarjs/void-use":"off","sonarjs/no-clear-text-protocols":"off","sonarjs/no-hardcoded-ip":"off","unicorn/prefer-https":"off","sonarjs/assertions-in-tests":"off","sonarjs/no-extra-arguments":"off","sonarjs/use-type-alias":"off","sonarjs/no-alphabetical-sort":"off","sonarjs/no-duplicate-string":"off","unicorn/no-break-in-nested-loop":"off","unicorn/no-array-sort":"off","unicorn/no-unreadable-for-of-expression":"off","unicorn/no-useless-template-literals":"off","unicorn/no-declarations-before-early-exit":"off","unicorn/prefer-includes-over-repeated-comparisons":"off","sonarjs/prefer-specific-assertions":"off","sonarjs/no-inverted-boolean-check":"off"};export{o as SONARJS_RULES,e as TEST_RULES,n as TYPESCRIPT_RULES,r as UNICORN_RULES};
|
package/dist/eslint-rules.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/eslint-rules.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The rule-override blocks of the repo lint config.\n *\n * Extracted from `eslint.ts` with the boundary rules: each block is a plain\n * rules object with the provenance comment that says *why* it is set to this\n * value, because a per-rule decision with no reason attached is a decision the\n * next reader re-litigates. `eslint.ts` composes these; this file is where a\n * rule's story lives.\n */\n\n/**\n * TypeScript rules, identical in all four source stacks.\n */\nexport const TYPESCRIPT_RULES: Readonly<Record<string, unknown>> = {\n '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],\n // Allow `void expr` for intentional fire-and-forget in Workers.\n '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],\n // Relax the unsafe-any rules to warn: the external API boundaries (Cloudflare\n // bindings, provider SDKs) are typed `any` upstream, and the alternative is a\n // config that cannot be adopted.\n '@typescript-eslint/no-explicit-any': 'warn',\n '@typescript-eslint/no-unsafe-assignment': 'warn',\n '@typescript-eslint/no-unsafe-member-access': 'warn',\n '@typescript-eslint/no-unsafe-call': 'warn',\n '@typescript-eslint/no-unsafe-return': 'warn',\n '@typescript-eslint/no-unsafe-argument': 'warn',\n // JSX event handlers and hook callback objects commonly use async functions\n // where void is expected.\n '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: { attributes: false, properties: false } }],\n // An `async` function with no `await`: every handler and DAO method is\n // `async` by shape so a future `await` does not change its signature.\n '@typescript-eslint/require-await': 'off',\n // `await` on a value the types say is not thenable, where the value is a\n // `PromiseLike` from an interface declared that way.\n '@typescript-eslint/await-thenable': 'off',\n};\n\n/**\n * Unicorn and SonarJS rules carried from the source repos, each off for a\n * stated reason.\n *\n * This is the family's \"deliberately does not follow\" block: every entry is\n * off because complying would make the code worse for what the project is,\n * and each is listed rather than dropped so the decision stays reviewable.\n */\nexport const UNICORN_RULES: Readonly<Record<string, unknown>> = {\n // Codebase uses ctx, req, res, env, err, util, db, dao, etc. — too invasive\n // to rename.\n 'unicorn/prevent-abbreviations': 'off',\n // D1/DAO layer returns null; disabling this avoids mass rewrites.\n 'unicorn/no-null': 'off',\n // Monorepo uses CommonJS-compatible module style in some configs.\n 'unicorn/prefer-module': 'off',\n // Top-level await not available in all Workers entry points.\n 'unicorn/prefer-top-level-await': 'off',\n // Error subclassing via `new MyError()` is intentional in backend-errors.\n 'unicorn/custom-error-definition': 'off',\n // Allow process.exit in build/script files.\n 'unicorn/no-process-exit': 'off',\n // Array reduce is used intentionally in analytics/data transformation.\n 'unicorn/no-array-reduce': 'off',\n // Allow Number() — parseInt/parseFloat are used in some cases intentionally.\n 'unicorn/prefer-number-properties': ['error', { checkInfinity: false }],\n // Allow nested ternaries in JSX (React render patterns).\n 'unicorn/no-nested-ternary': 'off',\n // Allow Array.from — codebase uses it for iterables.\n 'unicorn/prefer-spread': 'off',\n // Entire codebase uses PascalCase for TS files; kebab-case would require\n // mass renames.\n 'unicorn/filename-case': 'off',\n // Established names should not be force-renamed.\n 'unicorn/name-replacements': 'off',\n // Zod schema builder chains and other deep method chains are intentional.\n 'unicorn/max-nested-calls': 'off',\n // import.meta.dirname is not available in all test environments.\n 'unicorn/prefer-import-meta-properties': 'off',\n // Codebase uses `err` as catch parameter name throughout.\n 'unicorn/catch-error-name': 'off',\n // Established boolean param names (retryable, enabled, etc.).\n 'unicorn/consistent-boolean-name': 'off',\n // Uint8Array#toBase64 / fromBase64 are not in all Workers runtime versions.\n 'unicorn/prefer-uint8array-base64': 'off',\n // Class member ordering would require extensive restructuring.\n 'unicorn/consistent-class-member-order': 'off',\n // API response fields use verb prefixes by convention.\n 'unicorn/no-non-function-verb-prefix': 'off',\n // forEach is used intentionally throughout the provider and utility layers.\n 'unicorn/no-for-each': 'off',\n // .then() chains in DAO and provider layers are often intentional.\n 'unicorn/prefer-await': 'warn',\n // Callback references (e.g. .map(Number)) are sometimes intentional.\n 'unicorn/no-array-callback-reference': 'warn',\n // toSorted() is ES2023 and may not be in all tsconfig lib targets.\n 'unicorn/no-array-sort': 'warn',\n // Early-return guard clauses are the established style; the rule only\n // rewrites the final guard of a ladder, which yields asymmetric mixed style\n // and long inline ternaries. Off in Mail-Meow and Edge-Sonic; canonical here\n // because it is the family's established style.\n 'unicorn/prefer-ternary': 'off',\n // `(await x).y` -> a named intermediate. Fires constantly in the tests,\n // where destructuring beside the assertion it serves is clearer.\n 'unicorn/no-await-expression-member': 'off',\n // `Number(x)` over `+x`: the `+` form is used where an explicit typeof check\n // has already narrowed the operand.\n 'unicorn/prefer-number-coercion': 'off',\n // Code-point iteration: the byte-level readers index deliberately, because\n // the offset *is* what they are reading.\n 'unicorn/prefer-code-point': 'off',\n // `if (!x) return;` over a compound condition: one guard per line, each with\n // its own comment, is what keeps endpoint guards readable.\n 'unicorn/prefer-simple-condition-first': 'off',\n // Module-scope `let` assigned from `beforeEach` in the test harnesses.\n 'unicorn/no-top-level-assignment-in-function': 'off',\n // Sequential `for...of` with `await` in the DAOs — D1's subrequest budget is\n // the scarce resource.\n 'unicorn/no-unreadable-for-of-expression': 'off',\n // `Object.hasOwn` over `in`: used where a prototype-chain hit is harmless.\n 'unicorn/no-computed-property-existence-check': 'off',\n // A labeled `break` out of two loops.\n 'unicorn/no-break-in-nested-loop': 'off',\n // `this` outside a class body: the module-level cache singletons document\n // their `this` contract in prose.\n 'unicorn/no-this-outside-of-class': 'off',\n // A class named inside its own static method.\n 'unicorn/class-reference-in-static-methods': 'off',\n // Assigning `globalThis.fetch` in a test — the only way to intercept the\n // ambient fetch in Node without a module mock.\n 'unicorn/no-global-object-property-assignment': 'off',\n // `(a ? b : c) && d`: written longhand so each precedence decision is\n // visible.\n 'unicorn/prefer-logical-operator-over-ternary': 'off',\n // `children[0]` in the XML helpers, which index a child list positionally.\n 'unicorn/better-dom-traversing': 'off',\n // `entries()` -> `keys()`/`values()`: the full entry is destructured.\n 'unicorn/prefer-iterator-to-array': 'off',\n // `.map(fn, thisArg)`: rejected on purpose.\n 'unicorn/no-array-method-this-argument': 'off',\n // A module-scope function that closes over nothing.\n 'unicorn/consistent-function-scoping': 'off',\n // `foo[0] === 'a' || foo[0] === 'b'` written longhand where the\n // alternatives are not adjacent.\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off',\n // A `type` alias over an inline union, where the name is what makes the\n // signature and its doc comment readable.\n 'sonarjs/use-type-alias': 'off',\n // A short local alias for a type imported from a protocol package.\n 'sonarjs/redundant-type-aliases': 'off',\n // `type: value` narrowing the other way, where both spellings appear in the\n // same schema and the code follows whichever the spec uses there.\n 'sonarjs/no-nested-assignment': 'off',\n // `Number.isInteger` plus a separate range check, where the bounds come from\n // the caller's own options in one place.\n 'unicorn/prefer-number-is-safe-integer': 'off',\n // `\\u{...}` over a `\\xNN` escape: the table is written in the byte form the\n // spec prints.\n 'unicorn/prefer-unicode-code-point-escapes': 'off',\n // `self.x = this.x` in an entry model: the alias makes the verbatim\n // round-trip explicit.\n 'unicorn/no-this-assignment': 'off',\n // Building a `Set` at module scope from a constant list, for O(1) membership\n // on a path that runs per parameter.\n 'unicorn/no-top-level-side-effects': 'off',\n // A conditional whose branches are identical, kept where the two branches\n // are named separately to document that they are meant to diverge.\n 'sonarjs/no-all-duplicated-branches': 'off',\n // An `else` after a `return`: the flat form keeps the remaining cases at one\n // indent level in the dispatch tables.\n 'unicorn/prefer-else-if': 'off',\n // A nested ternary in a sort comparator, where the three-way order is the\n // point.\n 'unicorn/prefer-minimal-ternary': 'off',\n // `void promise` where initiating the call is the point and the rejection is\n // handled at a named site elsewhere.\n 'sonarjs/void-use': 'off',\n // `x === undefined` reported as always-true/false. With\n // `noUncheckedIndexedAccess` on, the guard is exactly right.\n 'sonarjs/different-types-comparison': 'off',\n // An accumulating loop with a sequential `await` in it, over D1 writes.\n 'unicorn/prefer-array-from-async': 'off',\n};\n\n/**\n * SonarJS rules the sources turned from errors into advisories, with the\n * threshold raised to a value that has actually held.\n */\nexport const SONARJS_RULES: Readonly<Record<string, unknown>> = {\n // Raise duplicate-string threshold to avoid flagging intentional repeated\n // literals like provider IDs.\n 'sonarjs/no-duplicate-string': ['warn', { threshold: 5 }],\n // Cognitive complexity — warn rather than error, so the ratchet can move\n // without a red build. Raise the number only as files are decomposed.\n 'sonarjs/cognitive-complexity': ['warn', 20],\n // False positives: connection method names like 'imap-password' and field\n // names like 'password_hash'.\n 'sonarjs/no-hardcoded-passwords': 'off',\n // Third-party deprecations are warnings, not errors.\n 'sonarjs/deprecation': 'warn',\n // Nested ternaries in complex data-mapping code.\n 'sonarjs/no-nested-conditional': 'warn',\n // React component props are commonly not marked Readonly<>.\n 'sonarjs/prefer-read-only-props': 'warn',\n // Static readonly properties require invasive refactoring.\n 'sonarjs/public-static-readonly': 'warn',\n // Nested template literals in SQL queries and prompt construction.\n 'sonarjs/no-nested-template-literals': 'warn',\n};\n\n/**\n * Test-suite overrides.\n *\n * `test/**` is deliberately *not* in the config's ignores list. Durable-DAV,\n * AWS and Mail-Meow all ignored it, and ~200 KB of test code had accumulated\n * violations that nothing reported. This block puts the suite back under the\n * same rules as the rest of the workspace and switches off only the handful\n * whose findings are structural artefacts of test code rather than defects.\n * It does not disable correctness rules: the unused-variable, dead-store,\n * regex and sorting findings in the suite are real and are fixed, not\n * suppressed.\n */\nexport const TEST_RULES: Readonly<Record<string, unknown>> = {\n // `it('…', async () => …)` is the Vitest idiom.\n '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: { arguments: false, attributes: false } }],\n // Unbound method is a common false positive in mock assertions like\n // expect(fn).toHaveBeenCalledWith(...).\n '@typescript-eslint/unbound-method': 'off',\n // Test helpers and stubs routinely use async functions without await.\n '@typescript-eslint/require-await': 'off',\n // Redundant type constituents appear in typed mock stubs.\n '@typescript-eslint/no-redundant-type-constituents': 'off',\n // `as never` casts are the standard fake-DB double pattern in tests.\n '@typescript-eslint/no-unnecessary-type-assertion': 'off',\n // Promise.withResolvers() and function-scoping refactors are cosmetic.\n 'unicorn/prefer-promise-with-resolvers': 'off',\n 'unicorn/consistent-function-scoping': 'off',\n // Fake-DB builders push-then-return and sort without comparators.\n 'unicorn/no-return-array-push': 'off',\n 'unicorn/require-array-sort-compare': 'off',\n // Iterator-helper rewrites churn test fakes with no runtime benefit.\n 'unicorn/prefer-iterator-helpers': 'off',\n 'unicorn/prefer-iterator-to-array': 'off',\n // String replacement with test-driven values is intentional in assertions.\n 'unicorn/no-unsafe-string-replacement': 'off',\n // Fake-D1 doubles await a DAO thunk and call straight onto the result.\n 'unicorn/no-await-expression-member': 'off',\n // `void promise` marks a deliberately unawaited promise in a test.\n 'sonarjs/void-use': 'off',\n // A test asserting request routing has to name `http://` hosts, and a proxy\n // test has to name a loopback upstream. Both are the subject matter, not\n // leaked configuration. `unicorn/prefer-https` must stay off here and this\n // is not a style preference: it rewrites `http://` to `https://` *inside\n // string literals*, and `--fix` applies it silently.\n 'sonarjs/no-clear-text-protocols': 'off',\n 'sonarjs/no-hardcoded-ip': 'off',\n 'unicorn/prefer-https': 'off',\n // sonarjs/assertions-in-tests fires false positives when test helpers handle\n // assertions indirectly.\n 'sonarjs/assertions-in-tests': 'off',\n // sonarjs/no-extra-arguments fires incorrectly on Vitest mock overloads.\n 'sonarjs/no-extra-arguments': 'off',\n // Union/inline types in test fakes are more readable than aliases.\n 'sonarjs/use-type-alias': 'off',\n // Alphabetical-sort rule fights deterministic fixture ordering.\n 'sonarjs/no-alphabetical-sort': 'off',\n // Repeated string literals in fixtures/assertions are clearer inline.\n 'sonarjs/no-duplicate-string': 'off',\n // Fake-D1 doubles break out of a nested loop to model a statement miss.\n 'unicorn/no-break-in-nested-loop': 'off',\n // Fixtures are naturally built with sort()/for…of over composed expressions.\n 'unicorn/no-array-sort': 'off',\n 'unicorn/no-unreadable-for-of-expression': 'off',\n 'unicorn/no-useless-template-literals': 'off',\n 'unicorn/no-declarations-before-early-exit': 'off',\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off',\n 'sonarjs/prefer-specific-assertions': 'off',\n 'sonarjs/no-inverted-boolean-check': 'off',\n};\n"],
|
|
5
|
-
"mappings": "AAaO,MAAMA,EAAsD,CACjE,oCAAqC,CAAC,QAAS,CAAE,kBAAmB,KAAM,kBAAmB,IAAI,CAAE,EAEnG,0CAA2C,CAAC,QAAS,CAAE,WAAY,EAAI,CAAE,EAIzE,qCAAsC,OACtC,0CAA2C,OAC3C,6CAA8C,OAC9C,oCAAqC,OACrC,sCAAuC,OACvC,wCAAyC,OAGzC,yCAA0C,CAAC,QAAS,CAAE,iBAAkB,CAAE,WAAY,GAAO,WAAY,EAAK,CAAE,CAAE,EAGlH,mCAAoC,MAGpC,oCAAqC,OAW1BC,EAAmD,CAG9D,gCAAiC,MAEjC,kBAAmB,MAEnB,wBAAyB,MAEzB,iCAAkC,MAElC,kCAAmC,MAEnC,0BAA2B,MAE3B,0BAA2B,MAE3B,mCAAoC,CAAC,QAAS,CAAE,cAAe,EAAK,CAAE,EAEtE,4BAA6B,MAE7B,wBAAyB,MAGzB,wBAAyB,MAEzB,4BAA6B,MAE7B,2BAA4B,MAE5B,wCAAyC,MAEzC,2BAA4B,MAE5B,kCAAmC,MAEnC,mCAAoC,MAEpC,wCAAyC,MAEzC,sCAAuC,MAEvC,sBAAuB,MAEvB,uBAAwB,OAExB,sCAAuC,OAEvC,wBAAyB,OAKzB,yBAA0B,MAG1B,qCAAsC,MAGtC,iCAAkC,MAGlC,4BAA6B,MAG7B,wCAAyC,MAEzC,8CAA+C,MAG/C,0CAA2C,MAE3C,+CAAgD,MAEhD,kCAAmC,MAGnC,mCAAoC,MAEpC,4CAA6C,MAG7C,+CAAgD,MAGhD,+CAAgD,MAEhD,gCAAiC,MAEjC,mCAAoC,MAEpC,wCAAyC,MAEzC,sCAAuC,MAGvC,oDAAqD,MAGrD,yBAA0B,MAE1B,iCAAkC,MAGlC,+BAAgC,MAGhC,wCAAyC,MAGzC,4CAA6C,MAG7C,6BAA8B,MAG9B,oCAAqC,MAGrC,qCAAsC,MAGtC,yBAA0B,MAG1B,iCAAkC,MAGlC,mBAAoB,MAGpB,qCAAsC,MAEtC,kCAAmC,OAOxBC,EAAmD,CAG9D,8BAA+B,CAAC,OAAQ,CAAE,UAAW,CAAC,CAAE,EAGxD,+BAAgC,CAAC,OAAQ,EAAE,EAG3C,iCAAkC,
|
|
4
|
+
"sourcesContent": ["/**\n * The rule-override blocks of the repo lint config.\n *\n * Extracted from `eslint.ts` with the boundary rules: each block is a plain\n * rules object with the provenance comment that says *why* it is set to this\n * value, because a per-rule decision with no reason attached is a decision the\n * next reader re-litigates. `eslint.ts` composes these; this file is where a\n * rule's story lives.\n */\n\n/**\n * TypeScript rules, identical in all four source stacks.\n */\nexport const TYPESCRIPT_RULES: Readonly<Record<string, unknown>> = {\n '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],\n // Allow `void expr` for intentional fire-and-forget in Workers.\n '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],\n // Relax the unsafe-any rules to warn: the external API boundaries (Cloudflare\n // bindings, provider SDKs) are typed `any` upstream, and the alternative is a\n // config that cannot be adopted.\n '@typescript-eslint/no-explicit-any': 'warn',\n '@typescript-eslint/no-unsafe-assignment': 'warn',\n '@typescript-eslint/no-unsafe-member-access': 'warn',\n '@typescript-eslint/no-unsafe-call': 'warn',\n '@typescript-eslint/no-unsafe-return': 'warn',\n '@typescript-eslint/no-unsafe-argument': 'warn',\n // JSX event handlers and hook callback objects commonly use async functions\n // where void is expected.\n '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: { attributes: false, properties: false } }],\n // An `async` function with no `await`: every handler and DAO method is\n // `async` by shape so a future `await` does not change its signature.\n '@typescript-eslint/require-await': 'off',\n // `await` on a value the types say is not thenable, where the value is a\n // `PromiseLike` from an interface declared that way.\n '@typescript-eslint/await-thenable': 'off',\n};\n\n/**\n * Unicorn and SonarJS rules carried from the source repos, each off for a\n * stated reason.\n *\n * This is the family's \"deliberately does not follow\" block: every entry is\n * off because complying would make the code worse for what the project is,\n * and each is listed rather than dropped so the decision stays reviewable.\n */\nexport const UNICORN_RULES: Readonly<Record<string, unknown>> = {\n // Codebase uses ctx, req, res, env, err, util, db, dao, etc. — too invasive\n // to rename.\n 'unicorn/prevent-abbreviations': 'off',\n // D1/DAO layer returns null; disabling this avoids mass rewrites.\n 'unicorn/no-null': 'off',\n // Monorepo uses CommonJS-compatible module style in some configs.\n 'unicorn/prefer-module': 'off',\n // Top-level await not available in all Workers entry points.\n 'unicorn/prefer-top-level-await': 'off',\n // Error subclassing via `new MyError()` is intentional in backend-errors.\n 'unicorn/custom-error-definition': 'off',\n // Allow process.exit in build/script files.\n 'unicorn/no-process-exit': 'off',\n // Array reduce is used intentionally in analytics/data transformation.\n 'unicorn/no-array-reduce': 'off',\n // Allow Number() — parseInt/parseFloat are used in some cases intentionally.\n 'unicorn/prefer-number-properties': ['error', { checkInfinity: false }],\n // Allow nested ternaries in JSX (React render patterns).\n 'unicorn/no-nested-ternary': 'off',\n // Allow Array.from — codebase uses it for iterables.\n 'unicorn/prefer-spread': 'off',\n // Entire codebase uses PascalCase for TS files; kebab-case would require\n // mass renames.\n 'unicorn/filename-case': 'off',\n // Established names should not be force-renamed.\n 'unicorn/name-replacements': 'off',\n // Zod schema builder chains and other deep method chains are intentional.\n 'unicorn/max-nested-calls': 'off',\n // import.meta.dirname is not available in all test environments.\n 'unicorn/prefer-import-meta-properties': 'off',\n // Codebase uses `err` as catch parameter name throughout.\n 'unicorn/catch-error-name': 'off',\n // Established boolean param names (retryable, enabled, etc.).\n 'unicorn/consistent-boolean-name': 'off',\n // Uint8Array#toBase64 / fromBase64 are not in all Workers runtime versions.\n 'unicorn/prefer-uint8array-base64': 'off',\n // Class member ordering would require extensive restructuring.\n 'unicorn/consistent-class-member-order': 'off',\n // API response fields use verb prefixes by convention.\n 'unicorn/no-non-function-verb-prefix': 'off',\n // forEach is used intentionally throughout the provider and utility layers.\n 'unicorn/no-for-each': 'off',\n // .then() chains in DAO and provider layers are often intentional.\n 'unicorn/prefer-await': 'warn',\n // Callback references (e.g. .map(Number)) are sometimes intentional.\n 'unicorn/no-array-callback-reference': 'warn',\n // toSorted() is ES2023 and may not be in all tsconfig lib targets.\n 'unicorn/no-array-sort': 'warn',\n // Early-return guard clauses are the established style; the rule only\n // rewrites the final guard of a ladder, which yields asymmetric mixed style\n // and long inline ternaries. Off in Mail-Meow and Edge-Sonic; canonical here\n // because it is the family's established style.\n 'unicorn/prefer-ternary': 'off',\n // `(await x).y` -> a named intermediate. Fires constantly in the tests,\n // where destructuring beside the assertion it serves is clearer.\n 'unicorn/no-await-expression-member': 'off',\n // `Number(x)` over `+x`: the `+` form is used where an explicit typeof check\n // has already narrowed the operand.\n 'unicorn/prefer-number-coercion': 'off',\n // Code-point iteration: the byte-level readers index deliberately, because\n // the offset *is* what they are reading.\n 'unicorn/prefer-code-point': 'off',\n // `if (!x) return;` over a compound condition: one guard per line, each with\n // its own comment, is what keeps endpoint guards readable.\n 'unicorn/prefer-simple-condition-first': 'off',\n // Module-scope `let` assigned from `beforeEach` in the test harnesses.\n 'unicorn/no-top-level-assignment-in-function': 'off',\n // Sequential `for...of` with `await` in the DAOs — D1's subrequest budget is\n // the scarce resource.\n 'unicorn/no-unreadable-for-of-expression': 'off',\n // `Object.hasOwn` over `in`: used where a prototype-chain hit is harmless.\n 'unicorn/no-computed-property-existence-check': 'off',\n // A labeled `break` out of two loops.\n 'unicorn/no-break-in-nested-loop': 'off',\n // `this` outside a class body: the module-level cache singletons document\n // their `this` contract in prose.\n 'unicorn/no-this-outside-of-class': 'off',\n // A class named inside its own static method.\n 'unicorn/class-reference-in-static-methods': 'off',\n // Assigning `globalThis.fetch` in a test — the only way to intercept the\n // ambient fetch in Node without a module mock.\n 'unicorn/no-global-object-property-assignment': 'off',\n // `(a ? b : c) && d`: written longhand so each precedence decision is\n // visible.\n 'unicorn/prefer-logical-operator-over-ternary': 'off',\n // `children[0]` in the XML helpers, which index a child list positionally.\n 'unicorn/better-dom-traversing': 'off',\n // `entries()` -> `keys()`/`values()`: the full entry is destructured.\n 'unicorn/prefer-iterator-to-array': 'off',\n // `.map(fn, thisArg)`: rejected on purpose.\n 'unicorn/no-array-method-this-argument': 'off',\n // A module-scope function that closes over nothing.\n 'unicorn/consistent-function-scoping': 'off',\n // `foo[0] === 'a' || foo[0] === 'b'` written longhand where the\n // alternatives are not adjacent.\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off',\n // A `type` alias over an inline union, where the name is what makes the\n // signature and its doc comment readable.\n 'sonarjs/use-type-alias': 'off',\n // A short local alias for a type imported from a protocol package.\n 'sonarjs/redundant-type-aliases': 'off',\n // `type: value` narrowing the other way, where both spellings appear in the\n // same schema and the code follows whichever the spec uses there.\n 'sonarjs/no-nested-assignment': 'off',\n // `Number.isInteger` plus a separate range check, where the bounds come from\n // the caller's own options in one place.\n 'unicorn/prefer-number-is-safe-integer': 'off',\n // `\\u{...}` over a `\\xNN` escape: the table is written in the byte form the\n // spec prints.\n 'unicorn/prefer-unicode-code-point-escapes': 'off',\n // `self.x = this.x` in an entry model: the alias makes the verbatim\n // round-trip explicit.\n 'unicorn/no-this-assignment': 'off',\n // Building a `Set` at module scope from a constant list, for O(1) membership\n // on a path that runs per parameter.\n 'unicorn/no-top-level-side-effects': 'off',\n // A conditional whose branches are identical, kept where the two branches\n // are named separately to document that they are meant to diverge.\n 'sonarjs/no-all-duplicated-branches': 'off',\n // An `else` after a `return`: the flat form keeps the remaining cases at one\n // indent level in the dispatch tables.\n 'unicorn/prefer-else-if': 'off',\n // A nested ternary in a sort comparator, where the three-way order is the\n // point.\n 'unicorn/prefer-minimal-ternary': 'off',\n // `void promise` where initiating the call is the point and the rejection is\n // handled at a named site elsewhere.\n 'sonarjs/void-use': 'off',\n // `x === undefined` reported as always-true/false. With\n // `noUncheckedIndexedAccess` on, the guard is exactly right.\n 'sonarjs/different-types-comparison': 'off',\n // An accumulating loop with a sequential `await` in it, over D1 writes.\n 'unicorn/prefer-array-from-async': 'off',\n};\n\n/**\n * SonarJS rules the sources turned from errors into advisories, with the\n * threshold raised to a value that has actually held.\n */\nexport const SONARJS_RULES: Readonly<Record<string, unknown>> = {\n // Raise duplicate-string threshold to avoid flagging intentional repeated\n // literals like provider IDs.\n 'sonarjs/no-duplicate-string': ['warn', { threshold: 5 }],\n // Cognitive complexity — warn rather than error, so the ratchet can move\n // without a red build. Raise the number only as files are decomposed.\n 'sonarjs/cognitive-complexity': ['warn', 20],\n // False positives: connection method names like 'imap-password' and field\n // names like 'password_hash'.\n 'sonarjs/no-hardcoded-passwords': 'off',\n // Task markers are governed by `rexezuge/todo-format` (`TODO(<scope>): <text>` is the family form);\n // the stock tags flag even the scoped form, so every tracked gap became an error.\n 'sonarjs/todo-tag': 'off',\n 'sonarjs/fixme-tag': 'off',\n // Third-party deprecations are warnings, not errors.\n 'sonarjs/deprecation': 'warn',\n // Nested ternaries in complex data-mapping code.\n 'sonarjs/no-nested-conditional': 'warn',\n // React component props are commonly not marked Readonly<>.\n 'sonarjs/prefer-read-only-props': 'warn',\n // Static readonly properties require invasive refactoring.\n 'sonarjs/public-static-readonly': 'warn',\n // Nested template literals in SQL queries and prompt construction.\n 'sonarjs/no-nested-template-literals': 'warn',\n};\n\n/**\n * Test-suite overrides.\n *\n * `test/**` is deliberately *not* in the config's ignores list. Durable-DAV,\n * AWS and Mail-Meow all ignored it, and ~200 KB of test code had accumulated\n * violations that nothing reported. This block puts the suite back under the\n * same rules as the rest of the workspace and switches off only the handful\n * whose findings are structural artefacts of test code rather than defects.\n * It does not disable correctness rules: the unused-variable, dead-store,\n * regex and sorting findings in the suite are real and are fixed, not\n * suppressed.\n */\nexport const TEST_RULES: Readonly<Record<string, unknown>> = {\n // `it('…', async () => …)` is the Vitest idiom.\n '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: { arguments: false, attributes: false } }],\n // Unbound method is a common false positive in mock assertions like\n // expect(fn).toHaveBeenCalledWith(...).\n '@typescript-eslint/unbound-method': 'off',\n // Test helpers and stubs routinely use async functions without await.\n '@typescript-eslint/require-await': 'off',\n // Redundant type constituents appear in typed mock stubs.\n '@typescript-eslint/no-redundant-type-constituents': 'off',\n // `as never` casts are the standard fake-DB double pattern in tests.\n '@typescript-eslint/no-unnecessary-type-assertion': 'off',\n // Promise.withResolvers() and function-scoping refactors are cosmetic.\n 'unicorn/prefer-promise-with-resolvers': 'off',\n 'unicorn/consistent-function-scoping': 'off',\n // Fake-DB builders push-then-return and sort without comparators.\n 'unicorn/no-return-array-push': 'off',\n 'unicorn/require-array-sort-compare': 'off',\n // Iterator-helper rewrites churn test fakes with no runtime benefit.\n 'unicorn/prefer-iterator-helpers': 'off',\n 'unicorn/prefer-iterator-to-array': 'off',\n // String replacement with test-driven values is intentional in assertions.\n 'unicorn/no-unsafe-string-replacement': 'off',\n // Fake-D1 doubles await a DAO thunk and call straight onto the result.\n 'unicorn/no-await-expression-member': 'off',\n // `void promise` marks a deliberately unawaited promise in a test.\n 'sonarjs/void-use': 'off',\n // A test asserting request routing has to name `http://` hosts, and a proxy\n // test has to name a loopback upstream. Both are the subject matter, not\n // leaked configuration. `unicorn/prefer-https` must stay off here and this\n // is not a style preference: it rewrites `http://` to `https://` *inside\n // string literals*, and `--fix` applies it silently.\n 'sonarjs/no-clear-text-protocols': 'off',\n 'sonarjs/no-hardcoded-ip': 'off',\n 'unicorn/prefer-https': 'off',\n // sonarjs/assertions-in-tests fires false positives when test helpers handle\n // assertions indirectly.\n 'sonarjs/assertions-in-tests': 'off',\n // sonarjs/no-extra-arguments fires incorrectly on Vitest mock overloads.\n 'sonarjs/no-extra-arguments': 'off',\n // Union/inline types in test fakes are more readable than aliases.\n 'sonarjs/use-type-alias': 'off',\n // Alphabetical-sort rule fights deterministic fixture ordering.\n 'sonarjs/no-alphabetical-sort': 'off',\n // Repeated string literals in fixtures/assertions are clearer inline.\n 'sonarjs/no-duplicate-string': 'off',\n // Fake-D1 doubles break out of a nested loop to model a statement miss.\n 'unicorn/no-break-in-nested-loop': 'off',\n // Fixtures are naturally built with sort()/for…of over composed expressions.\n 'unicorn/no-array-sort': 'off',\n 'unicorn/no-unreadable-for-of-expression': 'off',\n 'unicorn/no-useless-template-literals': 'off',\n 'unicorn/no-declarations-before-early-exit': 'off',\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off',\n 'sonarjs/prefer-specific-assertions': 'off',\n 'sonarjs/no-inverted-boolean-check': 'off',\n};\n"],
|
|
5
|
+
"mappings": "AAaO,MAAMA,EAAsD,CACjE,oCAAqC,CAAC,QAAS,CAAE,kBAAmB,KAAM,kBAAmB,IAAI,CAAE,EAEnG,0CAA2C,CAAC,QAAS,CAAE,WAAY,EAAI,CAAE,EAIzE,qCAAsC,OACtC,0CAA2C,OAC3C,6CAA8C,OAC9C,oCAAqC,OACrC,sCAAuC,OACvC,wCAAyC,OAGzC,yCAA0C,CAAC,QAAS,CAAE,iBAAkB,CAAE,WAAY,GAAO,WAAY,EAAK,CAAE,CAAE,EAGlH,mCAAoC,MAGpC,oCAAqC,OAW1BC,EAAmD,CAG9D,gCAAiC,MAEjC,kBAAmB,MAEnB,wBAAyB,MAEzB,iCAAkC,MAElC,kCAAmC,MAEnC,0BAA2B,MAE3B,0BAA2B,MAE3B,mCAAoC,CAAC,QAAS,CAAE,cAAe,EAAK,CAAE,EAEtE,4BAA6B,MAE7B,wBAAyB,MAGzB,wBAAyB,MAEzB,4BAA6B,MAE7B,2BAA4B,MAE5B,wCAAyC,MAEzC,2BAA4B,MAE5B,kCAAmC,MAEnC,mCAAoC,MAEpC,wCAAyC,MAEzC,sCAAuC,MAEvC,sBAAuB,MAEvB,uBAAwB,OAExB,sCAAuC,OAEvC,wBAAyB,OAKzB,yBAA0B,MAG1B,qCAAsC,MAGtC,iCAAkC,MAGlC,4BAA6B,MAG7B,wCAAyC,MAEzC,8CAA+C,MAG/C,0CAA2C,MAE3C,+CAAgD,MAEhD,kCAAmC,MAGnC,mCAAoC,MAEpC,4CAA6C,MAG7C,+CAAgD,MAGhD,+CAAgD,MAEhD,gCAAiC,MAEjC,mCAAoC,MAEpC,wCAAyC,MAEzC,sCAAuC,MAGvC,oDAAqD,MAGrD,yBAA0B,MAE1B,iCAAkC,MAGlC,+BAAgC,MAGhC,wCAAyC,MAGzC,4CAA6C,MAG7C,6BAA8B,MAG9B,oCAAqC,MAGrC,qCAAsC,MAGtC,yBAA0B,MAG1B,iCAAkC,MAGlC,mBAAoB,MAGpB,qCAAsC,MAEtC,kCAAmC,OAOxBC,EAAmD,CAG9D,8BAA+B,CAAC,OAAQ,CAAE,UAAW,CAAC,CAAE,EAGxD,+BAAgC,CAAC,OAAQ,EAAE,EAG3C,iCAAkC,MAGlC,mBAAoB,MACpB,oBAAqB,MAErB,sBAAuB,OAEvB,gCAAiC,OAEjC,iCAAkC,OAElC,iCAAkC,OAElC,sCAAuC,QAe5BC,EAAgD,CAE3D,yCAA0C,CAAC,QAAS,CAAE,iBAAkB,CAAE,UAAW,GAAO,WAAY,EAAK,CAAE,CAAE,EAGjH,oCAAqC,MAErC,mCAAoC,MAEpC,oDAAqD,MAErD,mDAAoD,MAEpD,wCAAyC,MACzC,sCAAuC,MAEvC,+BAAgC,MAChC,qCAAsC,MAEtC,kCAAmC,MACnC,mCAAoC,MAEpC,uCAAwC,MAExC,qCAAsC,MAEtC,mBAAoB,MAMpB,kCAAmC,MACnC,0BAA2B,MAC3B,uBAAwB,MAGxB,8BAA+B,MAE/B,6BAA8B,MAE9B,yBAA0B,MAE1B,+BAAgC,MAEhC,8BAA+B,MAE/B,kCAAmC,MAEnC,wBAAyB,MACzB,0CAA2C,MAC3C,uCAAwC,MACxC,4CAA6C,MAC7C,oDAAqD,MACrD,qCAAsC,MACtC,oCAAqC",
|
|
6
6
|
"names": ["TYPESCRIPT_RULES", "UNICORN_RULES", "SONARJS_RULES", "TEST_RULES"]
|
|
7
7
|
}
|
package/dist/eslint-strict.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type tseslint from 'typescript-eslint';
|
|
|
6
6
|
*
|
|
7
7
|
* Every rule here exists because a family repo once re-implemented something the
|
|
8
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`)
|
|
9
|
+
* kit-local rules (`rexezuge/restricted-import`, `rexezuge/no-hand-built-envelope`, `rexezuge/todo-format`)
|
|
10
10
|
* and `no-restricted-globals` rather than `no-restricted-imports` /
|
|
11
11
|
* `no-restricted-syntax`: flat config replaces a rule's options per file instead
|
|
12
12
|
* of merging them, so a strict entry in those two would silently erase the layer
|
|
@@ -21,6 +21,7 @@ export declare const REXEZUGE_PLUGIN: {
|
|
|
21
21
|
rules: {
|
|
22
22
|
'restricted-import': Rule.RuleModule;
|
|
23
23
|
'no-hand-built-envelope': Rule.RuleModule;
|
|
24
|
+
'todo-format': Rule.RuleModule;
|
|
24
25
|
};
|
|
25
26
|
};
|
|
26
27
|
export declare const STRICT_IMPORT_BANS: readonly ImportBan[];
|
|
@@ -1 +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;
|
|
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;AA2GD,eAAO,MAAM,eAAe;;;;;;CAE3B,CAAC;AAWF,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"}
|
package/dist/eslint-strict.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var x=Object.defineProperty;var o=(r,e)=>x(r,"name",{value:e,configurable:!0});const i=o(r=>typeof r=="object"&&r!==null?r:null,"asRecord");function m(r){const e=i(r.key);return e===null?null:e.type==="Identifier"&&typeof e.name=="string"?e.name:e.type==="Literal"&&typeof e.value=="string"?e.value:null}o(m,"keyName");const b={meta:{type:"problem",schema:[{type:"object",properties:{bans:{type:"array"}},additionalProperties:!1}],messages:{banned:"`{{specifier}}` is not allowed here. {{message}}"}},create(r){const e=r.options[0]?.bans??[],n=o((t,a)=>{if(typeof a!="string")return;const l=e.find(y=>y.names.some(u=>a===u||a.startsWith(`${u}/`)));l&&r.report({node:t,messageId:"banned",data:{specifier:a,message:l.message}})},"check"),s=o(t=>i(t)?.value,"literal");return{ImportDeclaration:o(t=>n(t,s(t.source)),"ImportDeclaration"),ExportAllDeclaration:o(t=>n(t,s(t.source)),"ExportAllDeclaration"),ExportNamedDeclaration:o(t=>n(t,s(t.source)),"ExportNamedDeclaration"),ImportExpression:o(t=>n(t,s(t.source)),"ImportExpression"),CallExpression:o(t=>{const a=i(t.callee);a?.type==="Identifier"&&a.name==="require"&&n(t,s(t.arguments[0]))},"CallExpression")}}},E={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(r){return{Property(e){const n=e,s=i(n.value);if(m(n)!=="Exception"||s?.type!=="ObjectExpression")return;(Array.isArray(s.properties)?s.properties:[]).some(a=>a.type==="Property"&&m(a)==="Type")&&r.report({node:e,messageId:"handBuilt"})}}}},I=/^[\s*/]*(TODO|FIXME)\b(.*)$/,T=/^\([^()\s]+\):\s*\S/,z={meta:{type:"suggestion",schema:[],messages:{bare:"`{{tag}}` needs a scope and a description: `{{tag}}(<scope>): <what is to be done>`."}},create(r){return{Program(){for(const e of r.sourceCode.getAllComments())for(const n of e.value.split(`
|
|
2
|
+
`)){const s=I.exec(n);s===null||T.test(s[2]??"")||r.report({loc:e.loc??{line:1,column:0},messageId:"bare",data:{tag:s[1]??"TODO"}})}}}}},A={rules:{"restricted-import":b,"no-hand-built-envelope":E,"todo-format":z}},g=["**/*.{ts,mts,cts,tsx}"],d=["**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}"],c=["test/**","**/test/**","**/*.test.*","**/*.spec.*"],p=o(r=>r.map(e=>`${e}/**`),"under"),f=[{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)."}],h={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(r){const e=["apps/api",...r.httpDirs];return[{files:d,ignores:[...p(r.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:d,plugins:{rexezuge:A},rules:{"rexezuge/todo-format":"error"}},{files:g,ignores:p(e),rules:{"rexezuge/restricted-import":["error",{bans:[h]}]}},{files:g,ignores:[...p(e),...c],rules:{"rexezuge/restricted-import":["error",{bans:[h,...f]}],"rexezuge/no-hand-built-envelope":"error"}},{files:["apps/api/**/*.{ts,mts,cts,tsx}"],ignores:[...p(r.httpDirs),...c],rules:{"rexezuge/restricted-import":["error",{bans:f}],"rexezuge/no-hand-built-envelope":"error"}}]}o(v,"strictConfigs");export{h as FRAMEWORK_BAN,A as REXEZUGE_PLUGIN,f as STRICT_IMPORT_BANS,v as strictConfigs};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 = {
|
|
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,
|
|
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"]
|
|
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`, `rexezuge/todo-format`)\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\n/**\n * A task marker is `TODO(<scope>): <text>` (or `FIXME(...)`): who or what it waits on, and what is to be done.\n * A bare `TODO`, `TODO:` or `TODO(sdk)` with no text is a note nobody can act on, so it is an error.\n * Only a marker that starts a comment line is a marker, so prose that mentions the word is left alone.\n * This replaces `sonarjs/todo-tag` and `sonarjs/fixme-tag`, which flagged the scoped form too.\n */\nconst TODO_MARKER = /^[\\s*/]*(TODO|FIXME)\\b(.*)$/;\nconst TODO_FORMAT = /^\\([^()\\s]+\\):\\s*\\S/;\n\nconst todoFormat: Rule.RuleModule = {\n meta: {\n type: 'suggestion',\n schema: [],\n messages: { bare: '`{{tag}}` needs a scope and a description: `{{tag}}(<scope>): <what is to be done>`.' },\n },\n create(context) {\n return {\n Program() {\n for (const comment of context.sourceCode.getAllComments()) {\n for (const line of comment.value.split('\\n')) {\n const match = TODO_MARKER.exec(line);\n if (match === null || TODO_FORMAT.test(match[2] ?? '')) continue;\n context.report({ loc: comment.loc ?? { line: 1, column: 0 }, messageId: 'bare', data: { tag: match[1] ?? 'TODO' } });\n }\n }\n },\n };\n },\n};\n\nexport const REXEZUGE_PLUGIN = {\n rules: { 'restricted-import': restrictedImport, 'no-hand-built-envelope': noHandBuiltEnvelope, 'todo-format': todoFormat },\n};\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: SOURCE_FILES,\n plugins: { rexezuge: REXEZUGE_PLUGIN },\n rules: { 'rexezuge/todo-format': 'error' },\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,GASIU,EAAc,8BACdC,EAAc,sBAEdC,EAA8B,CAClC,KAAM,CACJ,KAAM,aACN,OAAQ,CAAA,EACR,SAAU,CAAE,KAAM,sFAAsF,GAE1G,OAAOf,EAAO,CACZ,MAAO,CACL,SAAO,CACL,UAAWgB,KAAWhB,EAAQ,WAAW,eAAc,EACrD,UAAWiB,KAAQD,EAAQ,MAAM,MAAM;CAAI,EAAG,CAC5C,MAAME,EAAQL,EAAY,KAAKI,CAAI,EAC/BC,IAAU,MAAQJ,EAAY,KAAKI,EAAM,CAAC,GAAK,EAAE,GACrDlB,EAAQ,OAAO,CAAE,IAAKgB,EAAQ,KAAO,CAAE,KAAM,EAAG,OAAQ,CAAC,EAAI,UAAW,OAAQ,KAAM,CAAE,IAAKE,EAAM,CAAC,GAAK,MAAM,CAAE,CAAE,CACrH,CAEJ,EAEJ,GAGWC,EAAkB,CAC7B,MAAO,CAAE,oBAAqBpB,EAAkB,yBAA0BY,EAAqB,cAAeI,CAAU,GAGpHK,EAAW,CAAC,uBAAuB,EACnCC,EAAe,CAAC,sCAAsC,EAItDC,EAAa,CAAC,UAAW,aAAc,cAAe,aAAa,EAEnEC,EAAQ7B,EAAC8B,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,MAAOD,EACP,QAAS,CAAE,SAAUF,CAAe,EACpC,MAAO,CAAE,uBAAwB,OAAO,GAM1C,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,CAhDgBhC,EAAAkC,EAAA",
|
|
6
|
+
"names": ["asRecord", "__name", "value", "keyName", "property", "key", "restrictedImport", "context", "bans", "check", "node", "specifier", "hit", "ban", "name", "literal", "source", "callee", "noHandBuiltEnvelope", "entry", "TODO_MARKER", "TODO_FORMAT", "todoFormat", "comment", "line", "match", "REXEZUGE_PLUGIN", "TS_FILES", "SOURCE_FILES", "TEST_GLOBS", "under", "dirs", "dir", "STRICT_IMPORT_BANS", "FRAMEWORK_BAN", "strictConfigs", "options", "http"]
|
|
7
7
|
}
|
package/dist/eslint.d.ts
CHANGED
|
@@ -50,59 +50,8 @@
|
|
|
50
50
|
* {@link RepoLintConfigOptions}.
|
|
51
51
|
*/
|
|
52
52
|
import type { FlatConfig } from 'typescript-eslint';
|
|
53
|
-
import type {
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* What `defineRepoLintConfig` accepts.
|
|
57
|
-
*/
|
|
58
|
-
export interface RepoLintConfigOptions {
|
|
59
|
-
/**
|
|
60
|
-
* The consuming repo's npm scope, e.g. `'@myapp'`. Every `no-restricted-imports`
|
|
61
|
-
* pattern in the boundary rules is derived from it, so the same factory serves
|
|
62
|
-
* all nine repos.
|
|
63
|
-
*/
|
|
64
|
-
readonly scope?: string;
|
|
65
|
-
/**
|
|
66
|
-
* The family manifest. Omitted: `<tsconfigRootDir or cwd>/.rexezuge.jsonc` is
|
|
67
|
-
* loaded when it exists. Pass `false` to ignore the file. A manifest supplies
|
|
68
|
-
* `scope` (unless given here), replaces the canonical layer table with its own
|
|
69
|
-
* `layers` (when it declares any), and names the http and browser directories
|
|
70
|
-
* the strict rules exempt.
|
|
71
|
-
*/
|
|
72
|
-
readonly manifest?: FamilyManifest | false;
|
|
73
|
-
/**
|
|
74
|
-
* Extra http-layer directories (may import `hono`/`chanfana`, hand-build the
|
|
75
|
-
* error envelope), beside `apps/api` and the manifest's `http: true` layers.
|
|
76
|
-
*/
|
|
77
|
-
readonly httpDirs?: readonly string[];
|
|
78
|
-
/**
|
|
79
|
-
* The workspace directories the legacy canonical layer table is scoped to, as
|
|
80
|
-
* repo-relative globs. Only used when no manifest declares `layers`.
|
|
81
|
-
*
|
|
82
|
-
* @deprecated Declare `layers` in `.rexezuge.jsonc` instead: the canonical
|
|
83
|
-
* table encodes consumer package names.
|
|
84
|
-
*/
|
|
85
|
-
readonly projectDirs?: readonly string[];
|
|
86
|
-
/**
|
|
87
|
-
* Extra ignore globs, merged with the canonical set.
|
|
88
|
-
*/
|
|
89
|
-
readonly extraIgnores?: readonly string[];
|
|
90
|
-
/**
|
|
91
|
-
* Where `projectService` resolves the tsconfig from. Defaults to the directory
|
|
92
|
-
* ESLint is invoked in, which is the repo root in every CI job.
|
|
93
|
-
*/
|
|
94
|
-
readonly tsconfigRootDir?: string;
|
|
95
|
-
/**
|
|
96
|
-
* Extra boundary layers, appended to the canonical table.
|
|
97
|
-
*
|
|
98
|
-
* The escape valve for a repo whose layout has a boundary the canonical table
|
|
99
|
-
* does not name — AWS-AccessBridge's `apps/api/src/endpoints/**` rule ("route
|
|
100
|
-
* classes must not import DAOs directly") and its `aws4fetch` ban are the shape.
|
|
101
|
-
* Same {@link LayerBan} form, so `extraLayers` flows through the
|
|
102
|
-
* `no-restricted-imports` and the `no-restricted-syntax` guard alike.
|
|
103
|
-
*/
|
|
104
|
-
readonly extraLayers?: readonly LayerBan[];
|
|
105
|
-
}
|
|
53
|
+
import type { RepoLintConfigOptions } from './eslint-options.ts';
|
|
54
|
+
export type { RepoLintConfigOptions } from './eslint-options.ts';
|
|
106
55
|
/**
|
|
107
56
|
* Build the repo's flat config.
|
|
108
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"}
|