@antelopejs/tooling-configs 0.8.1-next.367.gdaef2de → 0.8.1-next.369.g76e8560

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 CHANGED
@@ -34,7 +34,7 @@ The AntelopeJS guardrail pack: shared lint, format and dead-code presets, the co
34
34
  | `./verify` | `import type { VerifyConfig } from "@antelopejs/tooling-configs/verify"` | Types and check helpers for a shared verification skill's `verify.config.ts` |
35
35
  | bin | `antelopejs-sync [--init]` | Writes the guardrail pack into a repository; `--check` reports drift; `--init` onboards a bare repository |
36
36
  | bin | `antelopejs-checks [--no-services]` | Runs every check and prints only the failures and the errors `published:types` declares as known; starts `.github/compose.yml` services around them |
37
- | bin | `antelopejs-suppressions` | Fails when suppressions exceed their budget or an added one breaks policy; `--update` lowers the budget |
37
+ | bin | `antelopejs-suppressions` | Fails when suppressions exceed their budget or a directive suppresses nothing; `--update` lowers the budget |
38
38
  | bin | `antelopejs-check-size` | Fails on authored files over 20,000 bytes and on blanket disable directives |
39
39
  | bin | `antelopejs-api-diff <base-ref>` | Compares published declaration bundles against committed HEAD |
40
40
  | bin | `antelopejs-comment-proof <base-ref>` | Compares comment-free JavaScript emit against committed HEAD |
@@ -349,8 +349,7 @@ Known differences between the two compilers' output:
349
349
  - `antelopejs-suppressions` also compares the budget with the one on the pull request base: `--base <ref>` when given, else the `GITHUB_BASE_REF` branch in CI (fetched from `origin` into a shallow checkout), else `origin/HEAD`. It fails when a ceiling is higher than on the base or a rule the base lists is removed, so a raise merges only through the operator's ruleset bypass. A base without a budget, a first adoption, passes. Without a base the comparison is skipped.
350
350
  - `antelopejs-suppressions --staged` compares the suppressions in the staged files with those files at HEAD, following renames and counting deleted files, and fails a kind that rises by more than the staged budget raises its ceiling. A suppression moved between staged files nets out.
351
351
  - `@ts-ignore` is also a lint error (`typescript/ban-ts-comment`); `@ts-expect-error` fails once its error is gone.
352
- - Both modes also judge what the change adds, whatever the budget allows: the full check against the same base (HEAD when there is none), the staged check against HEAD. A suppression counts as added when its kind, rule and reason occur more often than on the base, so one moved to another file with its reason is not added, and one whose reason a comment pass rewrote or stripped is. An added directive fails when it names a rule no directive may name (`anti-slop/require-safety-comment-for-type-assertion`, `antelopejs/no-comments`, the five `antelopejs` test rules, `typescript/ban-ts-comment`); the failure names what to do instead. An added directive naming its rules, `@ts-expect-error` or `SAFETY:` comment fails when its reason has fewer than three words, or only words like "safe", "intentional", "legacy" and the rule's own name. A block `oxlint-disable` or `eslint-disable` that no `-enable` closes before the end of its file fails when the change adds it. Suppressions already on the base stay under the budget until a burn-down removes them.
353
- - Both modes also hold each lint directive in a file the change touches to two rules, whether the directive was added or already on the base. It must suppress something: one extra `oxlint --report-unused-disable-directives` run over the touched files that contain a directive, under the repository's own lint configuration, so a directive for a rule the preset does not run is dead. A dead directive fails with its `file:line`, naming the rule to drop when the directive names several, or telling you to delete it. It must also give a reason: a directive naming rules with no ` -- <reason>` fails whenever its file is touched, though the added-suppression policy above only judges the reason of an added one. Touched files are the staged files with `--staged`, and in the full check the working tree against the merge-base with the pull request base (the base itself when there is no merge-base, as in a shallow checkout), untracked files included, or against HEAD without a base. A file the change does not touch is not read, so upgrading the pack fails no existing file; its dead and reasonless directives surface when a change next touches the file. `eslint-` directives in a directory with an ESLint config are left to ESLint, and `.vue` files are not read by oxlint. Deleting a dead directive lowers the budget: run `suppressions:update`.
352
+ - Both modes also fail a lint directive in a file the change touches that suppresses nothing, whether the directive was added or already on the base: one extra `oxlint --report-unused-disable-directives` run over the touched files that contain a directive, under the repository's own lint configuration, so a directive for a rule the preset does not run is dead. A dead directive fails with its `file:line`, naming the rule to drop when the directive names several, or telling you to delete it. Touched files are the staged files with `--staged`, and in the full check the working tree against the merge-base with the pull request base (the base itself when there is no merge-base, as in a shallow checkout), untracked files included, or against HEAD without a base. A file the change does not touch is not read, so upgrading the pack fails no existing file; its dead directives surface when a change next touches the file. `eslint-` directives in a directory with an ESLint config are left to ESLint, and `.vue` files are not read by oxlint. Deleting a dead directive lowers the budget: run `suppressions:update`.
354
353
 
355
354
  ### Size
356
355
 
@@ -484,10 +483,9 @@ When the package sits in the same repository, as in a DMS monorepo, its range mu
484
483
  The [documentation action](./docs/documentation-checks.md) checks local Markdown
485
484
  links, explicitly labeled compatibility tables, and reference-page export
486
485
  coverage, and typechecks every TypeScript fence against the repository's own
487
- source; a fence opts out only with a `fragment` marker. Versions of
488
- `@antelopejs/*` packages belong only in the block `antelopejs-sync` generates:
489
- the action fails on version ranges and "requires … or later" claims in prose and
490
- checks the block against the package.json beside it. Pin
486
+ source; a fence opts out only with a `fragment` marker. It checks the
487
+ compatibility block `antelopejs-sync` generates against the package.json beside
488
+ it. Pin
491
489
  `AntelopeJS/tooling-configs/actions/docs` to a full commit SHA; no npm release is
492
490
  required. The guide includes CI and local commands, marker syntax, and the
493
491
  checks that remain the author's responsibility.
@@ -5,7 +5,7 @@ import { r as installedTypeScriptMajor, t as asInstalledCompilerReads } from "..
5
5
  import { t as runCli } from "../cli-4Tv71vYk.mjs";
6
6
  import { c as resolveRevision, s as repositoryRoot } from "../files-C0avD1Eo.mjs";
7
7
  import { n as shimInvocation } from "../run-command-BlFRPORx.mjs";
8
- import { _ as recordVerdict, c as unpublishedAt, d as revisionCounts, f as workspaceManifests, g as fillStars, h as describeAllowance, i as isTestSource, l as DIRECTORY_LINK, m as createAddedPolicy, o as outputRoot, p as allowedByGlob, r as isExportPath, s as packagesAt, t as emitPackage, u as compareRevisions } from "../typescript-BRlDIsP3.mjs";
8
+ import { _ as recordVerdict, c as unpublishedAt, d as revisionCounts, f as workspaceManifests, g as fillStars, h as describeAllowance, i as isTestSource, l as DIRECTORY_LINK, m as createAddedPolicy, o as outputRoot, p as allowedByGlob, r as isExportPath, s as packagesAt, t as emitPackage, u as compareRevisions } from "../typescript-BMXhi9hl.mjs";
9
9
  import { createRequire } from "node:module";
10
10
  import { copyFileSync, cpSync, existsSync, globSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
11
11
  import { basename, dirname, isAbsolute, join, matchesGlob, parse, posix, relative, resolve, sep } from "node:path";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as runCli } from "../cli-4Tv71vYk.mjs";
3
3
  import { o as repositoryPath, s as repositoryRoot, t as authoredSizes, u as MAX_FILE_BYTES } from "../files-C0avD1Eo.mjs";
4
- import { l as worktreeSuppressions, o as revisionSuppressions } from "../suppressions-CQq6ngSW.mjs";
4
+ import { i as revisionSuppressions, s as worktreeSuppressions } from "../suppressions-BWTxQbDL.mjs";
5
5
  import { realpathSync } from "node:fs";
6
6
  import { resolve } from "node:path";
7
7
  import { parseArgs } from "node:util";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as runCli } from "../cli-4Tv71vYk.mjs";
3
3
  import { s as repositoryRoot } from "../files-C0avD1Eo.mjs";
4
- import { a as listsNoFiles, d as revisionCounts, n as extendedConfigs, s as packagesAt, t as emitPackage, u as compareRevisions } from "../typescript-BRlDIsP3.mjs";
4
+ import { a as listsNoFiles, d as revisionCounts, n as extendedConfigs, s as packagesAt, t as emitPackage, u as compareRevisions } from "../typescript-BMXhi9hl.mjs";
5
5
  import { copyFileSync, existsSync, mkdirSync } from "node:fs";
6
6
  import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
7
7
  //#region src/guardrails/comment-proof.ts
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as runCli } from "../cli-4Tv71vYk.mjs";
3
3
  import { a as isAgentFile, c as resolveRevision, n as changedFiles, o as repositoryPath, s as repositoryRoot } from "../files-C0avD1Eo.mjs";
4
- import { a as parseBudget, c as stagedSuppressions, i as checkSuppressions, l as checkPolicy, n as SUPPRESSIONS_FILE, o as safetyCeiling, s as stagedNames, u as coveredLimits } from "../suppression-budget-fGT7mwW5.mjs";
5
- import { c as suppressionsIn, i as inWorktree, o as revisionSuppressions, r as countSuppressions } from "../suppressions-CQq6ngSW.mjs";
4
+ import { a as parseBudget, c as stagedSuppressions, i as checkSuppressions, l as coveredLimits, n as SUPPRESSIONS_FILE, o as safetyCeiling, s as stagedNames } from "../suppression-budget-B30kar1T.mjs";
5
+ import { i as revisionSuppressions, n as countSuppressions, o as suppressionsIn, r as inWorktree } from "../suppressions-BWTxQbDL.mjs";
6
6
  import { createRequire } from "node:module";
7
7
  import { mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
8
8
  import { basename, dirname, join, posix } from "node:path";
@@ -118,8 +118,7 @@ function entry(found) {
118
118
  file: found.file,
119
119
  line: found.line,
120
120
  directive: found.directive,
121
- rules: [found.rule],
122
- reason: found.reason
121
+ rules: [found.rule]
123
122
  };
124
123
  }
125
124
  function written(directive, rules = directive.rules) {
@@ -146,16 +145,11 @@ function deadFailure(directive, dead) {
146
145
  const closing = BLOCK_DISABLE.test(directive.directive) ? " and from its enable" : "";
147
146
  return [...dead].map((rule) => `${at}: ${written(directive, [rule])} suppresses nothing. Fix: drop \`${rule}\` from the directive${closing}.`);
148
147
  }
149
- function reasonlessFailure(directive) {
150
- if (directive.reason !== "" || directive.rules.includes("*")) return [];
151
- return [`${directive.file}:${directive.line}: ${written(directive)} gives no reason. Fix: add \` -- <why this line needs it>\` after the rules, or delete the directive.`];
152
- }
153
148
  /**
154
149
  * Fails, in each of `files`, every lint directive that suppresses nothing
155
- * under the repository's own lint configuration, and every directive naming
156
- * rules that gives no reason. Directives
157
- * in other files are left alone, so adopting the check changes no existing
158
- * file until a change touches it. `eslint-` directives under an ESLint config
150
+ * under the repository's own lint configuration. Directives in other files
151
+ * are left alone, so adopting the check changes no existing file until a
152
+ * change touches it. `eslint-` directives under an ESLint config
159
153
  * are left to ESLint, and `.vue` files are not linted by oxlint.
160
154
  */
161
155
  function deadDirectiveFailures(root, files) {
@@ -180,7 +174,7 @@ function deadDirectiveFailures(root, files) {
180
174
  }
181
175
  return [...unplaced, ...directives.flatMap((directive) => {
182
176
  const rules = dead.get(directive);
183
- return rules === void 0 ? reasonlessFailure(directive) : deadFailure(directive, rules);
177
+ return rules === void 0 ? [] : deadFailure(directive, rules);
184
178
  })];
185
179
  }
186
180
  function mergeBase(root, revision) {
@@ -333,14 +327,9 @@ function fullCheck(root, update, base) {
333
327
  const failures = checkSuppressions(root, update);
334
328
  const revision = suppressionBase(root, base);
335
329
  const dead = deadDirectiveFailures(root, touchedFiles(root, revision));
336
- return revision === void 0 ? [
337
- ...failures,
338
- ...checkPolicy(root),
339
- ...dead
340
- ] : [
330
+ return revision === void 0 ? [...failures, ...dead] : [
341
331
  ...raisedCeilings(root, revision),
342
332
  ...failures,
343
- ...checkPolicy(root, revision),
344
333
  ...dead
345
334
  ];
346
335
  }
package/dist/bin/sync.mjs CHANGED
@@ -10,8 +10,8 @@ import { i as gitFiles, s as repositoryRoot } from "../files-C0avD1Eo.mjs";
10
10
  import { n as workspaceDirectories, r as workspacePatterns, t as planDocs } from "../docs-compat-CdgBviGf.mjs";
11
11
  import { n as shimInvocation } from "../run-command-BlFRPORx.mjs";
12
12
  import { a as matchingScripts, c as inWorkspace, d as runPnpm, i as verifyLayers, l as installsWithPnpm, n as droppedChecksSteps, o as stepsOf, s as pnpmLockfiles, u as moveDependencyRanges } from "../checks-adt8vdq_.mjs";
13
- import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-fGT7mwW5.mjs";
14
- import { u as typescript } from "../suppressions-CQq6ngSW.mjs";
13
+ import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-B30kar1T.mjs";
14
+ import { c as typescript } from "../suppressions-BWTxQbDL.mjs";
15
15
  import { t as DEFAULT_SHARED } from "../map-C3j9QGqf.mjs";
16
16
  import { createRequire } from "node:module";
17
17
  import { isAlias, isMap, isNode, isScalar, isSeq, parseDocument, stringify } from "yaml";
@@ -1,5 +1,5 @@
1
1
  import { a as isAgentFile, n as changedFiles } from "./files-C0avD1Eo.mjs";
2
- import { a as openDisablesIn, i as inWorktree, l as worktreeSuppressions, n as configKey, o as revisionSuppressions, r as countSuppressions, s as sortedKeys, t as atRevision } from "./suppressions-CQq6ngSW.mjs";
2
+ import { a as sortedKeys, i as revisionSuppressions, n as countSuppressions, s as worktreeSuppressions, t as configKey } from "./suppressions-BWTxQbDL.mjs";
3
3
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
4
4
  import { join, matchesGlob } from "node:path";
5
5
  import { execFileSync, spawnSync } from "node:child_process";
@@ -155,134 +155,6 @@ function stagedAdditions(root, targets, revision) {
155
155
  }))]));
156
156
  }
157
157
  //#endregion
158
- //#region src/guardrails/suppression-policy.ts
159
- /** Rules a directive may never name, each with what to do instead. */
160
- const NEVER_SUPPRESSED = /* @__PURE__ */ new Map([
161
- ["anti-slop/require-safety-comment-for-type-assertion", "remove the assertion (a type guard, a schema parse at the boundary, an inferred or owner-derived type), or, where it really holds, write `SAFETY: <why it holds>` above it"],
162
- ["antelopejs/no-comments", "say it in code, move a public contract into TSDoc, or delete the comment"],
163
- ["antelopejs/no-constant-value-assertion", "assert on a value the code under test computes, or delete the test"],
164
- ["antelopejs/no-fs-read-in-tests", "drive the behaviour through the public interface, or read from fixtures/"],
165
- ["antelopejs/no-self-import-in-tests", "import the module under test by relative path, or publish the subpath in exports and link the package to itself"],
166
- ["antelopejs/no-typeof-function-only-test", "assert on what the function returns or does, or delete the test"],
167
- ["antelopejs/require-assertion", "assert on the behaviour, or delete the test"],
168
- ["typescript/ban-ts-comment", "use `@ts-expect-error <reason>`"]
169
- ]);
170
- const MIN_REASON_WORDS = 3;
171
- /** Words that say a suppression is wanted without saying why the code needs it. */
172
- const VAGUE_WORDS = new Set(`a an the this that it its is are be was here there we for of to as and or not no
173
- ok okay fine safe safely correct valid works working intended intentional intentionally
174
- needed necessary required expected known false positive legacy existing old behavior behaviour
175
- preserve preserved preserves preserving keep kept compat compatibility workaround hack
176
- temporary todo fixme later ignore ignored disable disabled suppress suppressed lint rule
177
- type types typing typescript cast casting assert assertion by design trust trusted me`.split(/\s+/u));
178
- function words(text) {
179
- return text.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);
180
- }
181
- /** A reason too short or too vague to tell a reader why this code needs its suppression. */
182
- function genericReason(suppression) {
183
- const said = words(suppression.reason);
184
- if (said.length < MIN_REASON_WORDS) return true;
185
- const named = new Set(suppression.kind === "rule" ? words(suppression.rule) : []);
186
- return said.every((word) => VAGUE_WORDS.has(word) || named.has(word));
187
- }
188
- function identity(suppression) {
189
- if (suppression.kind === "config") return [
190
- suppression.kind,
191
- suppression.rule,
192
- suppression.scope
193
- ].join("\0");
194
- return [
195
- suppression.kind,
196
- suppression.kind === "rule" ? suppression.rule : "",
197
- suppression.reason
198
- ].join("\0");
199
- }
200
- /** Takes one occurrence of `key` from `counts`, reporting whether one was left. */
201
- function take(counts, key) {
202
- const left = counts.get(key) ?? 0;
203
- if (left > 0) counts.set(key, left - 1);
204
- return left > 0;
205
- }
206
- /**
207
- * The items of `after` that `before` does not account for, as multisets of
208
- * `key`: an item is matched first in its own file, then in any file, so a
209
- * moved item is not added and an added one is reported where it was added.
210
- */
211
- function unmatched(before, after, key) {
212
- const sameFile = /* @__PURE__ */ new Map();
213
- for (const item of before) {
214
- const local = `${item.file}\0${key(item)}`;
215
- sameFile.set(local, (sameFile.get(local) ?? 0) + 1);
216
- }
217
- const elsewhere = after.filter((item) => !take(sameFile, `${item.file}\0${key(item)}`));
218
- const anyFile = /* @__PURE__ */ new Map();
219
- for (const [local, count] of sameFile) {
220
- const global = local.slice(local.indexOf("\0") + 1);
221
- anyFile.set(global, (anyFile.get(global) ?? 0) + count);
222
- }
223
- return elsewhere.filter((item) => !take(anyFile, key(item)));
224
- }
225
- /**
226
- * The suppressions of `after` that `before` does not account for, by kind,
227
- * rule and reason, so a suppression moved to another file with its reason is
228
- * not added, and one whose reason changed is.
229
- */
230
- function addedSuppressions(before, after) {
231
- return unmatched(before, after, identity);
232
- }
233
- function label(suppression) {
234
- if (suppression.kind === "rule") return `\`${suppression.directive} ${suppression.rule}\``;
235
- if (suppression.kind === "config") return `lint config rule-off \`${suppression.rule}\` for \`${suppression.scope}\``;
236
- if (suppression.kind === "safety") return "`SAFETY:`";
237
- return suppression.kind === "tsIgnore" ? "`@ts-ignore`" : "`@ts-expect-error`";
238
- }
239
- /**
240
- * Fails each added suppression that names a rule no directive may name, and
241
- * each whose reason is empty or generic. Suppressions already on the base
242
- * are left to the burn-down the budget tracks.
243
- */
244
- function policyFailures(added) {
245
- return added.flatMap((suppression) => {
246
- const at = `${suppression.file}:${suppression.line}`;
247
- const instead = suppression.kind === "rule" || suppression.kind === "config" ? NEVER_SUPPRESSED.get(suppression.rule) : void 0;
248
- if (instead !== void 0) return [`${at}: ${label(suppression)}: this rule is never suppressed. Fix: ${instead}.`];
249
- if (suppression.kind === "config" || suppression.kind === "rule" && suppression.rule === "*") return [];
250
- if (!genericReason(suppression)) return [];
251
- const quoted = suppression.reason ? `"${suppression.reason}"` : "none";
252
- return [`${at}: ${label(suppression)} reason ${quoted} does not say why this code needs it. Fix: state the fact about this line that makes the suppression hold (at least ${MIN_REASON_WORDS} words${suppression.kind === "rule" ? ", after ` -- `" : ""}), or fix the code.`];
253
- });
254
- }
255
- /** Fails each block disable left open at the end of its file. */
256
- function openDisableFailures(open) {
257
- return open.map(({ directive, rule, file, line }) => `${file}:${line}: \`${directive}${rule === "*" ? "" : ` ${rule}`}\` is never closed, so it also silences every line added below it. Fix: add \`${directive.replace("disable", "enable")}${rule === "*" ? "" : ` ${rule}`}\` right after the last line that needs it, or use \`${directive}-next-line\`.`);
258
- }
259
- /** The open blocks of `after` beyond those of `before`, by directive and rule. */
260
- function addedOpenDisables(before, after) {
261
- return unmatched(before, after, ({ directive, rule }) => [directive, rule].join("\0"));
262
- }
263
- function hasCommit(root, revision) {
264
- return spawnSync("git", [
265
- "rev-parse",
266
- "--verify",
267
- "--quiet",
268
- `${revision}^{commit}`
269
- ], { cwd: root }).status === 0;
270
- }
271
- /**
272
- * Fails what the working tree adds against `revision` (HEAD when none is
273
- * given): a suppression that names a never-suppressed rule or gives no
274
- * specific reason, and a block disable left open.
275
- */
276
- function checkPolicy(root, revision = "HEAD") {
277
- if (!hasCommit(root, revision)) return [];
278
- return [...policyFailures(addedSuppressions(revisionSuppressions(root, revision), worktreeSuppressions(root))), ...openDisableFailures(addedOpenDisables(atRevision(root, revision, openDisablesIn), inWorktree(root, openDisablesIn)))];
279
- }
280
- /** The same policy for a commit: the staged files against their HEAD versions, rename sources and deleted files included. */
281
- function checkStagedPolicy(root, staged, previous) {
282
- if (!hasCommit(root, "HEAD")) return [];
283
- return [...policyFailures(addedSuppressions(revisionSuppressions(root, "HEAD", previous), revisionSuppressions(root, "", staged))), ...openDisableFailures(addedOpenDisables(atRevision(root, "HEAD", openDisablesIn, previous), atRevision(root, "", openDisablesIn, staged)))];
284
- }
285
- //#endregion
286
158
  //#region src/guardrails/suppression-budget.ts
287
159
  /** The per-repository suppression budget, at the repository root. It is permanent: nothing deletes it, even at zero. */
288
160
  const SUPPRESSIONS_FILE = "guardrails.suppressions.json";
@@ -505,15 +377,13 @@ function stagedNames(root, filter) {
505
377
  /**
506
378
  * Compares the staged files' suppressions with those files at HEAD, rename
507
379
  * sources and deleted files included, and fails each key that rises by more
508
- * than the staged budget raises its ceiling, then applies the suppression
509
- * policy to what the commit adds. A commit that first adds the budget is
510
- * not compared.
380
+ * than the staged budget raises its ceiling. A commit that first adds the
381
+ * budget is not compared.
511
382
  */
512
383
  function stagedSuppressions(root) {
513
384
  const renames = renamedPaths(root, true);
514
385
  const staged = stagedNames(root, "ACMR");
515
- const previous = [...staged.map((file) => renames.get(file) ?? file), ...stagedNames(root, "D")];
516
- return [...stagedBudget(root, staged, previous), ...checkStagedPolicy(root, staged, previous)];
386
+ return stagedBudget(root, staged, [...staged.map((file) => renames.get(file) ?? file), ...stagedNames(root, "D")]);
517
387
  }
518
388
  /**
519
389
  * How much a staged config key may rise: what the staged budget raises its
@@ -552,4 +422,4 @@ function stagedBudget(root, staged, previous) {
552
422
  return [...failures, ...fixesFor(failed)];
553
423
  }
554
424
  //#endregion
555
- export { parseBudget as a, stagedSuppressions as c, checkSuppressions as i, checkPolicy as l, SUPPRESSIONS_FILE as n, safetyCeiling as o, adoptedBudget as r, stagedNames as s, SAFETY_RULE as t, coveredLimits as u };
425
+ export { parseBudget as a, stagedSuppressions as c, checkSuppressions as i, coveredLimits as l, SUPPRESSIONS_FILE as n, safetyCeiling as o, adoptedBudget as r, stagedNames as s, SAFETY_RULE as t };
@@ -162,8 +162,6 @@ const DESCRIPTION = /\s-{2,}\s|\s-{2,}$/u;
162
162
  /** The comment `anti-slop/require-safety-comment-for-type-assertion` accepts as a justification. */
163
163
  const SAFETY_COMMENT = markerPattern(DEFAULT_SAFETY_MARKERS);
164
164
  const TS_DIRECTIVE = /^[/*\s]*@ts-(expect-error|ignore)(?![\w-])/u;
165
- const SAFETY_REASON = /SAFETY\s*:([\s\S]*)$/u;
166
- const ENABLE_DIRECTIVE = /^((?:oxlint|eslint)-enable)(?=\s|$)([\s\S]*)$/u;
167
165
  function scriptKind(lang) {
168
166
  const kinds = typescript().ScriptKind;
169
167
  if (/^[cm]?tsx$/u.test(lang)) return kinds.TSX;
@@ -210,28 +208,19 @@ function vueComments(text) {
210
208
  });
211
209
  return comments;
212
210
  }
213
- /** Collapses whitespace and the leading `*` of block comment lines. */
214
- function normalized(text) {
215
- return text.replaceAll(/\n\s*\*(?!\/)/gu, "\n").replaceAll(/\s+/gu, " ").trim();
216
- }
217
- /** The rules a directive's text names, `*` for none, and the reason after its ` -- `. */
218
- function directiveParts(rest) {
211
+ /** The rules a directive's text names before its ` -- ` description, `*` for none. */
212
+ function directiveRules(rest) {
219
213
  const separator = DESCRIPTION.exec(rest);
220
214
  const rules = (separator === null ? rest : rest.slice(0, separator.index)).split(",").map((rule) => rule.trim()).filter(Boolean);
221
- return {
222
- rules: rules.length ? rules : ["*"],
223
- reason: separator === null ? "" : normalized(rest.slice(separator.index + separator[0].length))
224
- };
215
+ return rules.length ? rules : ["*"];
225
216
  }
226
217
  function lintDirective(value) {
227
218
  const text = value.replace(/^\s*\*?\s*/u, "");
228
219
  const directive = LINT_DIRECTIVE.exec(text);
229
220
  if (directive === null) return [];
230
- const { rules, reason } = directiveParts(directive[2]);
231
- return rules.map((rule) => ({
221
+ return directiveRules(directive[2]).map((rule) => ({
232
222
  directive: directive[1],
233
- rule,
234
- reason
223
+ rule
235
224
  }));
236
225
  }
237
226
  /** TypeScript reads a directive from a line comment, or from the last line of a block comment. */
@@ -239,10 +228,7 @@ function tsDirective(comment) {
239
228
  const text = comment.line ? comment.value : comment.value.slice(comment.value.lastIndexOf("\n") + 1);
240
229
  const match = TS_DIRECTIVE.exec(text);
241
230
  if (match === null) return void 0;
242
- return {
243
- kind: match[1] === "ignore" ? "tsIgnore" : "tsExpectError",
244
- reason: normalized(text.slice(match[0].length))
245
- };
231
+ return { kind: match[1] === "ignore" ? "tsIgnore" : "tsExpectError" };
246
232
  }
247
233
  /** Parsed comments by language and text, so a file unchanged between the base and the working tree is parsed once per run. */
248
234
  const parsedComments = /* @__PURE__ */ new Map();
@@ -270,11 +256,10 @@ function suppressionsIn(file, text) {
270
256
  if (!CODE_FILE.test(file) || !(CANDIDATE.test(text) || SAFETY_COMMENT.test(text))) return found;
271
257
  for (const comment of fileComments(file, text)) {
272
258
  const line = lineOf(text, comment.start);
273
- for (const { directive, rule, reason } of lintDirective(comment.value)) found.push({
259
+ for (const { directive, rule } of lintDirective(comment.value)) found.push({
274
260
  kind: "rule",
275
261
  rule,
276
262
  directive,
277
- reason,
278
263
  file,
279
264
  line
280
265
  });
@@ -286,42 +271,12 @@ function suppressionsIn(file, text) {
286
271
  });
287
272
  if (SAFETY_COMMENT.test(comment.value)) found.push({
288
273
  kind: "safety",
289
- reason: normalized(SAFETY_REASON.exec(comment.value)?.[1] ?? ""),
290
274
  file,
291
275
  line
292
276
  });
293
277
  }
294
278
  return found;
295
279
  }
296
- /**
297
- * The block disables in one code file's text that are still open at its end.
298
- * An `-enable` naming rules closes those rules; one naming none closes every
299
- * open block.
300
- */
301
- function openDisablesIn(file, text) {
302
- if (!CODE_FILE.test(file) || !CANDIDATE.test(text)) return [];
303
- const open = /* @__PURE__ */ new Map();
304
- for (const comment of fileComments(file, text)) {
305
- const value = comment.value.replace(/^\s*\*?\s*/u, "");
306
- const disable = LINT_DIRECTIVE.exec(value);
307
- if (disable !== null && !disable[1].endsWith("line")) {
308
- const line = lineOf(text, comment.start);
309
- for (const rule of directiveParts(disable[2]).rules) open.set(rule, {
310
- rule,
311
- directive: disable[1],
312
- file,
313
- line
314
- });
315
- continue;
316
- }
317
- const enable = ENABLE_DIRECTIVE.exec(value);
318
- if (enable === null) continue;
319
- const { rules } = directiveParts(enable[2]);
320
- if (rules[0] === "*") open.clear();
321
- else for (const rule of rules) open.delete(rule);
322
- }
323
- return [...open.values()];
324
- }
325
280
  /** Each repository's generated-output test, remembered per path, since the base and the working tree list mostly the same files. */
326
281
  const generatedPaths = /* @__PURE__ */ new Map();
327
282
  function generatedIn(root) {
@@ -433,4 +388,4 @@ function countSuppressions(suppressions) {
433
388
  };
434
389
  }
435
390
  //#endregion
436
- export { openDisablesIn as a, suppressionsIn as c, inWorktree as i, worktreeSuppressions as l, configKey as n, revisionSuppressions as o, countSuppressions as r, sortedKeys as s, atRevision as t, typescript as u };
391
+ export { sortedKeys as a, typescript as c, revisionSuppressions as i, countSuppressions as n, suppressionsIn as o, inWorktree as r, worktreeSuppressions as s, configKey as t };
@@ -3,7 +3,7 @@ import { t as typescript6_default } from "./typescript6-HdyOMBv3.mjs";
3
3
  import { n as installedCompilerDefaults, r as installedTypeScriptMajor } from "./installed-typescript-CF_FR9DV.mjs";
4
4
  import { c as resolveRevision, l as trackedManifests } from "./files-C0avD1Eo.mjs";
5
5
  import { n as workspaceDirectories, r as workspacePatterns } from "./docs-compat-CdgBviGf.mjs";
6
- import { o as revisionSuppressions, r as countSuppressions } from "./suppressions-CQq6ngSW.mjs";
6
+ import { i as revisionSuppressions, n as countSuppressions } from "./suppressions-BWTxQbDL.mjs";
7
7
  import { copyFileSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
8
8
  import { dirname, isAbsolute, join, matchesGlob, relative, resolve, sep } from "node:path";
9
9
  import { execFileSync, spawnSync } from "node:child_process";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/tooling-configs",
3
- "version": "0.8.1-next.367.gdaef2de",
3
+ "version": "0.8.1-next.369.g76e8560",
4
4
  "description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and a dependency range check",
5
5
  "keywords": [
6
6
  "antelopejs",
@@ -152,7 +152,7 @@
152
152
  "engines": {
153
153
  "node": ">=22.18.0"
154
154
  },
155
- "gitHead": "daef2de383a83a9422f3bf44f349b72ac7ba2c3c",
155
+ "gitHead": "76e85602a9de4fc7492aa68b0af2de7593a2a0d5",
156
156
  "scripts": {
157
157
  "build": "tsdown",
158
158
  "lint": "oxlint",