@antelopejs/tooling-configs 0.6.0 → 0.7.1
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 +15 -15
- package/dist/{api-CCOiLN3w.mjs → api-BQLrI_S1.mjs} +19 -2
- package/dist/bin/body-check.mjs +1 -1
- package/dist/bin/checks.mjs +1 -1
- package/dist/bin/garden.mjs +10 -18
- package/dist/bin/ratchet.mjs +2 -2
- package/dist/bin/suppressions.mjs +7 -3
- package/dist/bin/sync.mjs +3 -3
- package/dist/bin/triage.mjs +1 -1
- package/dist/{checks-C_I0jCN4.mjs → checks-DJ_CFEZH.mjs} +446 -23
- package/dist/eslint.mjs +1 -1
- package/dist/{guardrails-C72rFG8J.mjs → guardrails-6i82vsUi.mjs} +839 -124
- package/dist/npm-CIIqL5SG.mjs +18 -0
- package/dist/oxc/anti-slop/index.mjs +5 -4
- package/dist/oxc/guardrails/index.d.mts +1 -1
- package/dist/oxc/guardrails/index.mjs +1 -1
- package/dist/oxc/lint.d.mts +5 -2
- package/dist/oxc/lint.mjs +1 -0
- package/dist/{oxlint-CCOJqj3d.mjs → oxlint-CIeonWMB.mjs} +37 -11
- package/dist/{ratchet-qu2aLzQU.mjs → ratchet-DLCfeaPY.mjs} +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -142,20 +142,20 @@ No rule warns. oxlint reports `correctness` as warnings by default, and warnings
|
|
|
142
142
|
|
|
143
143
|
The guardrail rules:
|
|
144
144
|
|
|
145
|
-
| Rule | Fails on
|
|
146
|
-
| ----------------------------------------- |
|
|
147
|
-
| `antelopejs/no-comments` | `//` and `/* */` comments. Allowed: TSDoc `/** */`, `SAFETY: <reason>` (one block, or a run of `//` lines), `/*!` license headers, `@ts-expect-error <reason>`, oxlint/eslint directives that name their rules, `/// <reference />`, `#__PURE__`/`@__PURE__`, `@vite-ignore` and webpack magic comments, `prettier-ignore`/`oxfmt-ignore`
|
|
148
|
-
| `antelopejs/no-inherited-key-lookup` | `table[key]` (or `table[key] += ...`) with a computed key, or `key in table`, where `table` is declared in the same file as a string-keyed dictionary (`Record<string, V>`, `Record<PropertyKey, V>`, a string index signature, `Readonly`/`Partial` of one, a union with `undefined` or `null`, a local alias or `typeof` another table, `satisfies` or `as Record<string, V>`, a class field read as `this.field[key]`), or an untyped object literal read with an asserted key (`table[key as keyof typeof table]`). Inherited keys such as `constructor` answer `Object.prototype` members. Not reported: literal keys, `typeof x` keys, same-file `const` keys (`KEY`, `LABELS.name` of a literal-valued object), keys iterated from an array of string literals or from `Object.keys(table)`, `Object.entries(table)` or `for...in` of the same table (through `filter`, `sort` and similar), writes and `delete`, a read in a function that calls `Object.hasOwn(table, key)` or `hasOwnProperty`, null-prototype tables (`Object.create(null)`, `{ __proto__: null }`). Imported constants and keys iterated from another table are reported. Use a `Map` instead
|
|
149
|
-
| `antelopejs/no-presence-only-type-guard` | in a type predicate or assertion function narrowing `x`: `x in table` (also true for inherited keys; use `Object.hasOwn(table, x)` or a `Map`/`Set`); `"k" in x`, `Object.hasOwn(x, "k")`, `hasOwnProperty.call(x, "k")` or `Reflect.has(x, "k")` with no read of `x.k` (presence only; check the value; a read through a cast such as `(x as T).k` or `(<T>x).k` counts); a member of a type declared in the same file that the guard never reads. Members typed `unknown` and parameters typed as a union of object types (`pet: Cat \| Dog`, a discriminating `in`) are not reported, and a call to another local guard with `x` counts as checking that guard's members
|
|
150
|
-
| `antelopejs/no-read-then-insert` | a call to `insert`, `insertOne` or `insertMany` on a table an earlier `get`, `
|
|
151
|
-
| `antelopejs/no-unrun-query` | an `@antelopejs/interface-database` query
|
|
152
|
-
| `antelopejs/no-unsafe-object-assign` | `Object.assign(target, ...sources)` where a source writes over a property the target's type declares: a source typed `unknown` or `any`, or holding such values under a `string` index signature (`Object.fromEntries` of `[string, unknown]` pairs) while the target has a field that does not take `unknown`; a property typed `unknown` or `any`, or holding `any` in its elements (`[value]` with `value: any`); a property whose type neither the target property nor its setter accepts. A value written in the source keeps the types a direct assignment gives it: `{ status: "loading" }`, `{ modes: ["a"] }` and nested literals keep their literal types (required properties, undeclared properties and tuple lengths still count), and a shorthand property reads its variable. A union source such as `flag && { stages }` is checked member by member, an optional source property is compared without its `undefined` (kept under `exactOptionalPropertyTypes`) but keeps `null`, and a `this` or generic target is read through its constraint. `Object.assign<T, U>` returns `T & U`, so TypeScript never compares the two and the call is an unchecked assertion. Not reported: properties the target does not declare (`Object.assign(new Error(message), { code })`), fields typed `unknown` or `any`, setters declared in a generic class, interface or type alias, spread sources and targets with no properties. Types come from the TypeScript program of the tsconfig that lists the file. On only with type-aware lint
|
|
153
|
-
| `antelopejs/require-tsconfig-include` | a file type-aware lint reads that no `tsconfig.json` or `jsconfig.json` lists: not the nearest one, not a config it references, not one above. `oxlint-tsgolint` reads such a file in its inferred program, without the repository's compiler options or `types`, so Node and test-runner globals are error types: `typescript/no-unsafe-*` reports there are false, and findings that need those types go missing. List the file in a tsconfig that names its `types`: one beside it that extends the root tsconfig, or, for a file at the root, a composite tsconfig (`emitDeclarationOnly`, `outDir` under `node_modules/.cache`) that the root tsconfig references, which `tsc -p .` leaves unbuilt. The root `oxlint.config.ts`, `oxfmt.config.ts` and `knip.config.ts` that `antelopejs-sync` writes are exempt. Also an import in a TypeScript or `.vue` file that the tsconfig listing it cannot resolve: a static `import` with a specifier, an `export … from`, or `import("…")` of a string literal. The program types everything imported through it as an error type, so `typescript/no-unsafe-*` reports there are false and rules that need the types find none. Not reported: a side-effect `import "./x.css"`, an import in a JavaScript file, an untyped package, a module a `declare module` in a listed file declares, and a `.vue` component, which only Volar resolves. List the file in a tsconfig that resolves the import through its `paths`, `baseUrl` or `node_modules`; in a Nuxt layer, a `tsconfig.json` that extends the generated `.nuxt/tsconfig.json`, with the lint script running `nuxt prepare` first. On only with type-aware lint
|
|
154
|
-
| `antelopejs/no-fs-read-in-tests` | `readFileSync` or `readdirSync` from `fs` in a test file. Files under `fixtures/`, `helpers/` and `locales/` may read
|
|
155
|
-
| `antelopejs/no-self-import-in-tests` | a test file that imports its own package name (`@antelopejs/<self>`, a subpath, `require`, dynamic `import()` or a re-export; `import type` is fine) unless that resolves to local code: the `exports` map publishes the subpath and `node_modules/<name>` is a link back to the package (a workspace self-link such as `link:.`). Otherwise the import resolves to the installed published copy and the test never runs local code. In a package whose `antelopeJs.test` is set, `ajs module test` resolves the name through its own module resolver, so a self-link is no proof there and every self-import is reported. Import the module by relative path instead
|
|
156
|
-
| `antelopejs/require-assertion` | a test with no assertion. Counts: calls named `expect*` or `assert*`, `sinon.assert.*`, supertest `.expect(...)`, and should-style `x.should…` or `should(x)`
|
|
157
|
-
| `antelopejs/no-constant-value-assertion` | `expect(X).toBe(literal)` where the root of `X` is an UPPER_SNAKE constant (`MAX_ITEMS`, `NAMES.if`, not `process.env.NODE_ENV`); also `.toEqual`, `.to.equal`, `.to.eq`, `.eql` and synonyms
|
|
158
|
-
| `antelopejs/no-typeof-function-only-test` | a test whose only assertions are `toBeTypeOf("function")`, `to.be.a("function")` or equivalents
|
|
145
|
+
| Rule | Fails on |
|
|
146
|
+
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
147
|
+
| `antelopejs/no-comments` | `//` and `/* */` comments. Allowed: TSDoc `/** */`, `SAFETY: <reason>` (one block, or a run of `//` lines), `/*!` license headers, `@ts-expect-error <reason>`, oxlint/eslint directives that name their rules, `/// <reference />`, `#__PURE__`/`@__PURE__`, `@vite-ignore` and webpack magic comments, `prettier-ignore`/`oxfmt-ignore` |
|
|
148
|
+
| `antelopejs/no-inherited-key-lookup` | `table[key]` (or `table[key] += ...`) with a computed key, or `key in table`, where `table` is declared in the same file as a string-keyed dictionary (`Record<string, V>`, `Record<PropertyKey, V>`, a string index signature, `Readonly`/`Partial` of one, a union with `undefined` or `null`, a local alias or `typeof` another table, `satisfies` or `as Record<string, V>`, a class field read as `this.field[key]`), or an untyped object literal read with an asserted key (`table[key as keyof typeof table]`). Inherited keys such as `constructor` answer `Object.prototype` members. Not reported: literal keys, `typeof x` keys, same-file `const` keys (`KEY`, `LABELS.name` of a literal-valued object), keys iterated from an array of string literals or from `Object.keys(table)`, `Object.entries(table)` or `for...in` of the same table (through `filter`, `sort` and similar), writes and `delete`, a read in a function that calls `Object.hasOwn(table, key)` or `hasOwnProperty`, null-prototype tables (`Object.create(null)`, `{ __proto__: null }`). Imported constants and keys iterated from another table are reported. Use a `Map` instead |
|
|
149
|
+
| `antelopejs/no-presence-only-type-guard` | in a type predicate or assertion function narrowing `x`: `x in table` (also true for inherited keys; use `Object.hasOwn(table, x)` or a `Map`/`Set`); `"k" in x`, `Object.hasOwn(x, "k")`, `hasOwnProperty.call(x, "k")` or `Reflect.has(x, "k")` with no read of `x.k` (presence only; check the value; a read through a cast such as `(x as T).k` or `(<T>x).k` counts); a member of a type declared in the same file that the guard never reads. Members typed `unknown` and parameters typed as a union of object types (`pet: Cat \| Dog`, a discriminating `in`) are not reported, and a call to another local guard with `x` counts as checking that guard's members |
|
|
150
|
+
| `antelopejs/no-read-then-insert` | a call to `insert`, `insertOne` or `insertMany` on a table an earlier `get`, `getAll`, `count`, `find`, `findOne`, `getBy…` or `findBy…` (`getBy`, `getByEmail`, `findByKey`) read in the same function. Also an insert, on any table, that a function of the same file makes when an awaited read (directly or through `.run()` or `.then`, so not `Map.get` or `headers.get`) found nothing before the call to it: the call sits in the branch an `if`, `?:`, `&&`, `\ |
|
|
151
|
+
| `antelopejs/no-unrun-query` | an `@antelopejs/interface-database` query left unrun in what a caller awaits: returned from an async function or from a function handed to `then`, `catch` or `finally`, inline or by name, or passed to the `resolve` of a `new Promise` executor, inline or by name, such as `async () => table.count()`, `.then(countRows)` or `resolve(table.count())`. The query may sit behind `Promise.resolve`, or at any depth in arrays, tuples, object literals and the interfaces and object types the project declares, such as `async () => ({ total: table.count() })`. A held `Table` is a handle, not a pending query, so `async () => ({ table })` is not reported, nor is a class instance. A query is not thenable, so the caller awaits the query object and nothing reaches the database; `table.count().run()` is not reported, nor is a query a plain function returns to its caller. A query is a type whose `run` the installed `@antelopejs/interface-database` declares, read from the TypeScript program of the tsconfig that lists the file. On only with type-aware lint |
|
|
152
|
+
| `antelopejs/no-unsafe-object-assign` | `Object.assign(target, ...sources)` where a source writes over a property the target's type declares: a source typed `unknown` or `any`, or holding such values under a `string` index signature (`Object.fromEntries` of `[string, unknown]` pairs) while the target has a field that does not take `unknown`; a property typed `unknown` or `any`, or holding `any` in its elements (`[value]` with `value: any`); a property whose type neither the target property nor its setter accepts. A value written in the source keeps the types a direct assignment gives it: `{ status: "loading" }`, `{ modes: ["a"] }` and nested literals keep their literal types (required properties, undeclared properties and tuple lengths still count), and a shorthand property reads its variable. A union source such as `flag && { stages }` is checked member by member, an optional source property is compared without its `undefined` (kept under `exactOptionalPropertyTypes`) but keeps `null`, and a `this` or generic target is read through its constraint. `Object.assign<T, U>` returns `T & U`, so TypeScript never compares the two and the call is an unchecked assertion. Not reported: properties the target does not declare (`Object.assign(new Error(message), { code })`), fields typed `unknown` or `any`, setters declared in a generic class, interface or type alias, spread sources and targets with no properties. Types come from the TypeScript program of the tsconfig that lists the file. On only with type-aware lint |
|
|
153
|
+
| `antelopejs/require-tsconfig-include` | a file type-aware lint reads that no `tsconfig.json` or `jsconfig.json` lists: not the nearest one, not a config it references, not one above. `oxlint-tsgolint` reads such a file in its inferred program, without the repository's compiler options or `types`, so Node and test-runner globals are error types: `typescript/no-unsafe-*` reports there are false, and findings that need those types go missing. List the file in a tsconfig that names its `types`: one beside it that extends the root tsconfig, or, for a file at the root, a composite tsconfig (`emitDeclarationOnly`, `outDir` under `node_modules/.cache`) that the root tsconfig references, which `tsc -p .` leaves unbuilt. The root `oxlint.config.ts`, `oxfmt.config.ts` and `knip.config.ts` that `antelopejs-sync` writes are exempt. Also an import in a TypeScript or `.vue` file that the tsconfig listing it cannot resolve: a static `import` with a specifier, an `export … from`, or `import("…")` of a string literal. The program types everything imported through it as an error type, so `typescript/no-unsafe-*` reports there are false and rules that need the types find none. Not reported: a side-effect `import "./x.css"`, an import in a JavaScript file, an untyped package, a module a `declare module` in a listed file declares, and a `.vue` component, which only Volar resolves. List the file in a tsconfig that resolves the import through its `paths`, `baseUrl` or `node_modules`; in a Nuxt layer, a `tsconfig.json` that extends the generated `.nuxt/tsconfig.json`, with the lint script running `nuxt prepare` first. On only with type-aware lint |
|
|
154
|
+
| `antelopejs/no-fs-read-in-tests` | `readFileSync` or `readdirSync` from `fs` in a test file. Files under `fixtures/`, `helpers/` and `locales/` may read |
|
|
155
|
+
| `antelopejs/no-self-import-in-tests` | a test file that imports its own package name (`@antelopejs/<self>`, a subpath, `require`, dynamic `import()` or a re-export; `import type` is fine) unless that resolves to local code: the `exports` map publishes the subpath and `node_modules/<name>` is a link back to the package (a workspace self-link such as `link:.`). Otherwise the import resolves to the installed published copy and the test never runs local code. In a package whose `antelopeJs.test` is set, `ajs module test` resolves the name through its own module resolver, so a self-link is no proof there and every self-import is reported. Import the module by relative path instead |
|
|
156
|
+
| `antelopejs/require-assertion` | a test with no assertion. Counts: calls named `expect*` or `assert*`, `sinon.assert.*`, supertest `.expect(...)`, and should-style `x.should…` or `should(x)` |
|
|
157
|
+
| `antelopejs/no-constant-value-assertion` | `expect(X).toBe(literal)` where the root of `X` is an UPPER_SNAKE constant (`MAX_ITEMS`, `NAMES.if`, not `process.env.NODE_ENV`); also `.toEqual`, `.to.equal`, `.to.eq`, `.eql` and synonyms |
|
|
158
|
+
| `antelopejs/no-typeof-function-only-test` | a test whose only assertions are `toBeTypeOf("function")`, `to.be.a("function")` or equivalents |
|
|
159
159
|
|
|
160
160
|
`antelopejs/no-presence-only-type-guard` passes `x in table` when `x` is typed `` `prefix${string}` `` and no `Object.prototype` member starts with that prefix, because such a key cannot name an inherited member. The prefix is read as TypeScript reads it, so `\x63onstructor${string}` is `constructor${string}` and stays reported.
|
|
161
161
|
|
|
@@ -234,7 +234,7 @@ pnpm install
|
|
|
234
234
|
|
|
235
235
|
`--profile template` writes only what `antelopejs-checks` runs, for template repositories: the three preset configs, `.gitattributes`, a user-facing `AGENTS.md` block, `guardrails.suppressions.json`, and the `package.json` scripts and devDependencies of the table above without the hooks (no `prepare`, no `lefthook`). It sets `checks`, `size`, `suppressions` and `suppressions:update`, plus `ratchet` and `ratchet:update` once `guardrails.ratchet.json` exists. It adds `typecheck`, `lint`, `format`, `format:check`, `knip`, `sync` and `sync:check` only where the template has none, the sync scripts with `--profile template`. It writes no `guardrails.ratchet.json`. The agent layer, `verify-template` and the writing skills under `.agents/skills/` with their `.claude/skills` links, is synced and checked only in the template source, marked by its `.agents/skills/verify-template/` folder; a project scaffolded from the template ships without it, so the template's `AGENTS.md` block links no skill under `.agents/` or `.claude/skills/`. `antelopejs-sync --check` writes nothing and exits 1 on any drift; `pnpm run checks` runs it.
|
|
236
236
|
|
|
237
|
-
`pnpm run checks` runs `typecheck`, `lint`, `format:check`, `knip`, `test`, `size`, `suppressions` and `sync:check`, plus `ratchet` when `guardrails.ratchet.json` exists. It prints only the output of the steps that failed. Sync adds the ratchet scripts and pre-commit hook only while `guardrails.ratchet.json` exists. When the repository has a verify layer, an `.agents/skills/verify-*` folder holding a `verify.config.ts` or a `tsconfig.json`, it also runs `verify:types` and `verify:lockfiles`, which need no package script. Neither writes a file in the repository, spawns a package manager or fetches anything, so both pass offline after a root install, as CI runs them. When the repository holds a `pnpm-lock.yaml`, outside what `.gitignore` leaves out, it also runs `lockfile:singletons`, which fails when a lockfile resolves an `@antelopejs/interface-*` package at more than one version and names the importers and packages that pull each copy. It reads the lockfiles only. When a tracked `package.json` declares an `@antelopejs/*` package, it also runs `dependency:ranges` (see [Dependency ranges](#dependency-ranges)), which reads the manifests only. In a git checkout it also runs `git:identity`, which fails when the repository's own git config, the `.git/config` every worktree shares or a worktree's `config.worktree`, sets `user.name` or `user.email`, and names the file and value. An identity from the global config or a `git -c` passes. When the `README.md` of the root or of a workspace package holds a config example whose `package` is
|
|
237
|
+
`pnpm run checks` runs `typecheck`, `lint`, `format:check`, `knip`, `test`, `size`, `suppressions` and `sync:check`, plus `ratchet` when `guardrails.ratchet.json` exists. It prints only the output of the steps that failed. Sync adds the ratchet scripts and pre-commit hook only while `guardrails.ratchet.json` exists. When the repository has a verify layer, an `.agents/skills/verify-*` folder holding a `verify.config.ts` or a `tsconfig.json`, it also runs `verify:types` and `verify:lockfiles`, which need no package script. Neither writes a file in the repository, spawns a package manager or fetches anything, so both pass offline after a root install, as CI runs them. When the repository holds a `pnpm-lock.yaml`, outside what `.gitignore` leaves out, it also runs `lockfile:singletons`, which fails when a lockfile resolves an `@antelopejs/interface-*` package at more than one version and names the importers and packages that pull each copy. It reads the lockfiles only. When a tracked `package.json` declares an `@antelopejs/*` package, it also runs `dependency:ranges` (see [Dependency ranges](#dependency-ranges)), which reads the manifests only. In a git checkout it also runs `git:identity`, which fails when the repository's own git config, the `.git/config` every worktree shares or a worktree's `config.worktree`, sets `user.name` or `user.email`, and names the file and value. An identity from the global config or a `git -c` passes. When the `README.md` of the root or of a workspace package holds a config example whose `package` is an `@antelopejs/*` package, such as `source: { type: "package", package: "@antelopejs/brevo", version: ">=0.0.9 <0.1.0" }`, it also runs `readme:version`. It fails when that example's `version` range does not stop below the next minor of the package's newest version and admit it, as [Dependency ranges](#dependency-ranges) reads a range, and names the README line and the range to use. The newest version of a package of the repository is the `version` in its `package.json`. For any other package it is the `latest` dist-tag on the registry npm is configured with, and the step fails when it cannot read it. A value that is not a range, such as `latest`, passes. When the root or a workspace package is not `private` and names declarations through `types`, `typings` or `exports`, it also runs `published:types`, after `test` and alone. It runs each such package's `prepack` through `pnpm run` or `npm run`, then packs it with lifecycle scripts off, so `prepare` and `postpack` do not run. It installs the tarball alone in a scratch folder without install scripts, together with the package's peers (optional ones included), `typescript` and `@types/node`, both at their latest version unless the package names them as peers. A workspace package it depends on comes from that package's own tarball, not from the registry. Then it runs `tsc` with `skipLibCheck: false`, `strict` and `nodenext` resolution over a file that imports each entry the package's `exports` names, a `*` subpath once per shipped file it matches. A package without `exports` gets its bare name and every declaration file it ships instead. The step fails on any error and names each file as `<package>/<path>`. It needs the registry, so it fails offline unless the package manager's store already holds what the install needs.
|
|
238
238
|
|
|
239
239
|
- `verify:types` type-checks each layer's own code with the repository's own TypeScript, run as `node <typescript>/bin/tsc` without a shell. A repository that installs the TypeScript 6 API as `typescript` (`npm:@typescript/typescript6`) for tools that need it, beside TypeScript 7 as `@typescript/native`, runs `@typescript/native`'s `tsc`. The files are those the layer's `tsconfig.json` includes, minus its `playground` folder and any `node_modules` or `dist` folder: verify compiles a playground itself, with the playground's own config, after installing it. The step writes a config to the system temp folder that extends the layer's, lists those files, keeps the layer's type roots, sets `noEmit` and unsets with `null` the `declaration`, `composite`, `incremental`, `tsBuildInfoFile`, `declarationDir`, `declarationMap`, `emitDeclarationOnly` and `isolatedDeclarations` the layer may inherit, then deletes it. No `.tsbuildinfo` is written, no declaration check runs on code that is never emitted, and `skipLibCheck` keeps the layer's value. `antelopejs-sync` writes the `tsconfig.json` of the shared `verify-interface`, `verify-module` and `verify-template` layers; a repository's own layer, such as a `verify-dms-*` one, keeps the one it wrote. A layer with a `verify.config.ts` and no `tsconfig.json` fails, and so does one whose `tsconfig.json` does not include its `verify.config.ts`.
|
|
240
240
|
- `verify:lockfiles` compares, in code, the direct dependencies each lockfile records with the `package.json` files it locks, and fails on a difference in either direction, naming the dependency and the command that regenerates the lockfile. It reads each lockfile in a folder under a layer, `node_modules` and `dist` aside, and in the root `playground`. A `pnpm-lock.yaml` is compared importer by importer, for each importer it lists that has a `package.json` on disk; a `package-lock.json` by its root entry. Only `dependencies`, `devDependencies` and `optionalDependencies` are compared, by name and specifier: a name counts as present whichever of the three fields records it, and a `catalog:` or `workspace:` specifier compares as written, as pnpm stores it. A name the lockfile records that `package.json` declares only in `peerDependencies` passes, whether or not peers are auto-installed. A name an override selector in the `pnpm-lock.yaml` mentions is not compared, nor is a `link:` dependency the lockfile leaves out under `excludeLinksFromLockfile`. A lockfile it cannot parse, or of a version before pnpm's 6 or npm's 2, fails as unreadable. A missing lockfile fails only in a layer's `playground` or the root `playground` whose `package.json` has dependencies, unless a folder above it holds a `pnpm-workspace.yaml` or a `package.json` with `workspaces`; the fix it names is npm's when a `package-lock.json` sits in a folder above, pnpm's otherwise. It does not check workspace membership, `overrides`, lockfile `settings`, catalogs, `.npmrc` or user configuration, resolved versions, integrity hashes, transitive entries, npm workspace members, or `yarn.lock` and `bun.lock`: verify's own frozen install still rejects a lockfile stale there.
|
|
@@ -7,9 +7,12 @@ import { homedir, tmpdir } from "node:os";
|
|
|
7
7
|
/** A GitHub or npm answer that is not a success. */
|
|
8
8
|
var ApiError = class extends Error {
|
|
9
9
|
status;
|
|
10
|
-
|
|
10
|
+
/** The OAuth scopes GitHub accepts for the call, when the token holds none of them; empty otherwise. */
|
|
11
|
+
missingScopes;
|
|
12
|
+
constructor(status, message, missingScopes = []) {
|
|
11
13
|
super(message);
|
|
12
14
|
this.status = status;
|
|
15
|
+
this.missingScopes = missingScopes;
|
|
13
16
|
}
|
|
14
17
|
};
|
|
15
18
|
const GITHUB = "https://api.github.com";
|
|
@@ -85,6 +88,17 @@ function githubHeaders(token) {
|
|
|
85
88
|
"User-Agent": "antelopejs-garden"
|
|
86
89
|
};
|
|
87
90
|
}
|
|
91
|
+
function scopeList(header) {
|
|
92
|
+
return (header ?? "").split(",").map((scope) => scope.trim()).filter(Boolean);
|
|
93
|
+
}
|
|
94
|
+
/** The scopes a refused answer (403 or 404) accepts when the classic token it went to holds none; empty for any other answer or a token GitHub lists no scopes for. */
|
|
95
|
+
function missingScopes(response) {
|
|
96
|
+
const held = response.headers.get("x-oauth-scopes");
|
|
97
|
+
if (held === null || response.status !== 403 && response.status !== 404) return [];
|
|
98
|
+
const accepted = scopeList(response.headers.get("x-accepted-oauth-scopes"));
|
|
99
|
+
const holds = new Set(scopeList(held));
|
|
100
|
+
return accepted.some((scope) => holds.has(scope)) ? [] : accepted;
|
|
101
|
+
}
|
|
88
102
|
/** Retries a rate-limited or gateway answer up to four times and returns the last answer. */
|
|
89
103
|
async function request(headers, url, init) {
|
|
90
104
|
for (let attempt = 1;; attempt++) {
|
|
@@ -127,7 +141,10 @@ function createApi(token) {
|
|
|
127
141
|
async function get(path, accept) {
|
|
128
142
|
const url = path.startsWith("http") ? path : `${GITHUB}${path}`;
|
|
129
143
|
const response = await request(headers, url, { headers: accept ? { Accept: accept } : {} });
|
|
130
|
-
if (!response.ok)
|
|
144
|
+
if (!response.ok) {
|
|
145
|
+
const missing = missingScopes(response);
|
|
146
|
+
throw new ApiError(response.status, missing.length ? `GET ${path}: HTTP ${response.status}, the token lacks the ${missing.join(" or ")} scope` : `GET ${path}: HTTP ${response.status} ${(await response.text()).slice(0, 200)}`, missing);
|
|
147
|
+
}
|
|
131
148
|
return response;
|
|
132
149
|
}
|
|
133
150
|
return {
|
package/dist/bin/body-check.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot, l as resolveRevision } from "../files-C-JJhExM.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { n as lintDiagnostics } from "../oxlint-CIeonWMB.mjs";
|
|
5
5
|
import { n as proofDigest, r as proofLines, s as revisionCountRows, t as parseProofStamp } from "../proof-stamp-BFV7JTZT.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
package/dist/bin/checks.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot } from "../files-C-JJhExM.mjs";
|
|
4
|
-
import { r as runChecks, t as CHECKS_SKIP_ENV } from "../checks-
|
|
4
|
+
import { r as runChecks, t as CHECKS_SKIP_ENV } from "../checks-DJ_CFEZH.mjs";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
//#region src/bin/checks.ts
|
|
7
7
|
const SIGNAL_EXIT = /* @__PURE__ */ new Map([
|
package/dist/bin/garden.mjs
CHANGED
|
@@ -3,7 +3,8 @@ import { t as admits } from "../semver-BDxeEcP_.mjs";
|
|
|
3
3
|
import { a as isString, c as object, d as optTime, f as parseJson, h as time, i as isObject, l as optNum, m as strings, n as children, o as list, p as str, r as flag, s as num, t as child, u as optStr } from "../json-CG2L7YFl.mjs";
|
|
4
4
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
5
5
|
import { a as RENOVATE_CONFIGS, c as GITATTRIBUTES, d as enforcesLf, f as CI_CONTEXT, h as CI_RENOVATE_SYNC_REF, m as CI_PATH, n as ciNodeCallers, o as RENOVATE_PRESET, p as CI_NODE_REF, r as ciRenovateSyncCallers, u as LF_ATTRIBUTES } from "../workflow-C-oBwL2H.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { n as tagVersion, r as tooling, t as TOOLING_PACKAGE } from "../npm-CIIqL5SG.mjs";
|
|
7
|
+
import { i as ghToken, n as createApi, t as ApiError } from "../api-BQLrI_S1.mjs";
|
|
7
8
|
import { parseDocument } from "yaml";
|
|
8
9
|
import { parseArgs } from "node:util";
|
|
9
10
|
import { inflateRawSync } from "node:zlib";
|
|
@@ -753,22 +754,6 @@ async function applyPrunes(api, prunes) {
|
|
|
753
754
|
return failed;
|
|
754
755
|
}
|
|
755
756
|
//#endregion
|
|
756
|
-
//#region src/garden/npm.ts
|
|
757
|
-
const TOOLING_PACKAGE = "@antelopejs/tooling-configs";
|
|
758
|
-
function distTags(packument) {
|
|
759
|
-
return child(object(packument, "packument"), "dist-tags");
|
|
760
|
-
}
|
|
761
|
-
function tagVersion(packument, tag) {
|
|
762
|
-
return optStr(distTags(packument), tag);
|
|
763
|
-
}
|
|
764
|
-
/** The `latest` dist-tag of tooling-configs. */
|
|
765
|
-
async function tooling(context) {
|
|
766
|
-
const packument = await context.packument(TOOLING_PACKAGE);
|
|
767
|
-
const latest = packument === void 0 ? void 0 : tagVersion(packument, "latest");
|
|
768
|
-
if (latest === void 0) throw new Error(`${TOOLING_PACKAGE} has no latest version on npm.`);
|
|
769
|
-
return latest;
|
|
770
|
-
}
|
|
771
|
-
//#endregion
|
|
772
757
|
//#region src/garden/checks/conformance.ts
|
|
773
758
|
const CHECK$1 = "conformance";
|
|
774
759
|
const DAY$2 = 864e5;
|
|
@@ -1066,7 +1051,14 @@ async function orgDrift(context, summaries, policy) {
|
|
|
1066
1051
|
const orgChecksRuleset = {
|
|
1067
1052
|
id: "org-checks-ruleset",
|
|
1068
1053
|
async run(context) {
|
|
1069
|
-
|
|
1054
|
+
let listed;
|
|
1055
|
+
try {
|
|
1056
|
+
listed = await context.api.pages(`/orgs/${ORG}/rulesets`);
|
|
1057
|
+
} catch (error) {
|
|
1058
|
+
if (error instanceof ApiError && error.missingScopes.length) return skip(`listing organization rulesets needs the ${error.missingScopes.join(" or ")} scope, which the token lacks`);
|
|
1059
|
+
throw error;
|
|
1060
|
+
}
|
|
1061
|
+
const summaries = listed.map((entry) => object(entry, "ruleset"));
|
|
1070
1062
|
const findings = [];
|
|
1071
1063
|
for (const policy of ORG_RULESETS) findings.push(...await orgDrift(context, summaries, policy));
|
|
1072
1064
|
return found(findings);
|
package/dist/bin/ratchet.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { c as parseCeilings, l as readCeilings, t as CEILINGS_FILE } from "../ce
|
|
|
3
3
|
import { n as renamedPaths } from "../renames-L2owF5GD.mjs";
|
|
4
4
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
5
5
|
import { c as repositoryRoot, l as resolveRevision, t as LINT_CONFIG } from "../files-C-JJhExM.mjs";
|
|
6
|
-
import { n as ratchet, r as withPreviousTree } from "../ratchet-
|
|
7
|
-
import {
|
|
6
|
+
import { n as ratchet, r as withPreviousTree } from "../ratchet-DLCfeaPY.mjs";
|
|
7
|
+
import { n as lintDiagnostics } from "../oxlint-CIeonWMB.mjs";
|
|
8
8
|
import { d as stagedAdditions, f as stagedChanges, u as previousLine } from "../suppression-budget-CPDSFg4X.mjs";
|
|
9
9
|
import { n as suppressionBase } from "../suppression-base-CYaLZAq7.mjs";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as runCli } from "../cli-4Tv71vYk.mjs";
|
|
3
3
|
import { c as repositoryRoot, r as changedFiles } from "../files-C-JJhExM.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { t as directiveReport } from "../oxlint-CIeonWMB.mjs";
|
|
5
5
|
import { c as stagedSuppressions, i as checkSuppressions, l as checkPolicy, s as stagedNames } from "../suppression-budget-CPDSFg4X.mjs";
|
|
6
6
|
import { c as suppressionsIn, i as inWorktree } from "../suppressions-CxPnh4sC.mjs";
|
|
7
7
|
import { n as suppressionBase, t as raisedCeilings } from "../suppression-base-CYaLZAq7.mjs";
|
|
@@ -72,9 +72,13 @@ function deadDirectiveFailures(root, files) {
|
|
|
72
72
|
const directives = inWorktree(root, directivesIn, files);
|
|
73
73
|
const readByOxlint = directives.filter(({ file, directive }) => !file.endsWith(".vue") && !(directive.startsWith("eslint-") && lintedByEslint(root, file)));
|
|
74
74
|
const lintable = [...new Set(readByOxlint.map(({ file }) => file))];
|
|
75
|
+
const { unused, unreadable } = lintable.length ? directiveReport(root, lintable) : {
|
|
76
|
+
unused: [],
|
|
77
|
+
unreadable: []
|
|
78
|
+
};
|
|
75
79
|
const dead = /* @__PURE__ */ new Map();
|
|
76
|
-
const unplaced =
|
|
77
|
-
for (const item of
|
|
80
|
+
const unplaced = unreadable.map(({ location, message }) => `${location === void 0 ? "" : `${location}: `}oxlint cannot check the directives here: ${message}. Fix: correct the file so oxlint reads it without errors, then rerun the check.`);
|
|
81
|
+
for (const item of unused) {
|
|
78
82
|
const directive = reported(readByOxlint, item);
|
|
79
83
|
if (directive === void 0) {
|
|
80
84
|
unplaced.push(`${item.file}:${item.line}: ${item.message} Fix: delete the directive.`);
|
package/dist/bin/sync.mjs
CHANGED
|
@@ -9,8 +9,8 @@ import { _ as placeholderTestScript, f as CI_CONTEXT, g as ciWorkflow, i as hasC
|
|
|
9
9
|
import { a as gitFiles, c as repositoryRoot } from "../files-C-JJhExM.mjs";
|
|
10
10
|
import { n as workspaceDirectories, r as workspacePatterns, t as planDocs } from "../docs-compat-CSljVi3O.mjs";
|
|
11
11
|
import { n as shimInvocation } from "../run-command-BlFRPORx.mjs";
|
|
12
|
-
import { a as stepsOf, i as matchingScripts, n as droppedChecksSteps, o as moveDependencyRanges, s as runPnpm } from "../checks-
|
|
13
|
-
import { i as recordedRelease, t as measureBaseline } from "../ratchet-
|
|
12
|
+
import { a as stepsOf, i as matchingScripts, n as droppedChecksSteps, o as moveDependencyRanges, s as runPnpm } from "../checks-DJ_CFEZH.mjs";
|
|
13
|
+
import { i as recordedRelease, t as measureBaseline } from "../ratchet-DLCfeaPY.mjs";
|
|
14
14
|
import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-CPDSFg4X.mjs";
|
|
15
15
|
import { u as typescript } from "../suppressions-CxPnh4sC.mjs";
|
|
16
16
|
import { t as DEFAULT_SHARED } from "../map-BYkmnvNw.mjs";
|
|
@@ -142,7 +142,7 @@ const SHARED_RULES = [
|
|
|
142
142
|
["A type guard checks each member it narrows to; keys with `Object.hasOwn`", "`antelopejs/no-presence-only-type-guard`"],
|
|
143
143
|
["A type guard checks the nested elements and values it claims", "review; no tool"],
|
|
144
144
|
["A startup read does not decide an insert another replica can race", "`antelopejs/no-read-then-insert`"],
|
|
145
|
-
["An
|
|
145
|
+
["An awaited function or a promise resolves to no unrun database query", "`antelopejs/no-unrun-query`"],
|
|
146
146
|
["`Object.assign` writes no `unknown`, `any` or mistyped value over a field", "`antelopejs/no-unsafe-object-assign`"],
|
|
147
147
|
["Every file type-aware lint reads is listed by a tsconfig that resolves its imports", "`antelopejs/require-tsconfig-include`"],
|
|
148
148
|
["Params ≤ 5, function ≤ 120 lines, file ≤ 500 lines, depth ≤ 4, complexity ≤ 20", "`eslint/max-*`, `eslint/complexity`"],
|
package/dist/bin/triage.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { c as object, h as time, n as children, p as str, r as flag, s as num, t as child, u as optStr } from "../json-CG2L7YFl.mjs";
|
|
3
3
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
4
|
-
import { i as ghToken, r as createGraphql } from "../api-
|
|
4
|
+
import { i as ghToken, r as createGraphql } from "../api-BQLrI_S1.mjs";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
//#region src/triage/triage.ts
|
|
7
7
|
/** Open, unassigned issues labelled `needs-triage` in the organization's public, non-archived repositories. */
|