@antelopejs/tooling-configs 0.8.1-next.375.gde7597d → 0.8.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 CHANGED
@@ -344,9 +344,9 @@ Known differences between the two compilers' output:
344
344
  - `config` holds the rules a lint config switches off, to `allow` or to a warning, keyed `<rule> for <glob>`: in `oxlint.config.*`, `.oxlintrc.json`, `.oxlintrc.jsonc` and `eslint.config.*` at any depth, every `rules` and `categories` map (a category as `category:<name>`) and an ESLint composer's `overrideRules` argument, one key per glob of the block's `files` (`*` when it has none). A nested config's globs are anchored at its directory and its blocks without `files` are `<dir>/**`, so a rule-off moved between config files is a new key. Rule maps, severities and globs held in same-file variables or spread from them count where they are used; the pack's presets are not in the file, so they never count. A glob is a key of its own, so adding, widening or renaming a glob, deleting `files`, or moving an override's rules to the top level creates a key at ceiling 0 and fails. Narrowing or splitting a scope is burn-down: a key may use the room a same-rule key whose glob contains its glob gives up (`*`, `**` and `**/*` contain every glob; a single-segment `*` never contains `**`; other glob syntax counts only when equal), in the full, staged and base checks, and `--update` moves that ceiling to the narrower key. A scope split into several narrower globs gives each the old ceiling, so the `config` total can rise while the files it covers do not; read totals per key, not as a measure of scope. `.` and `..` segments count only when equal. A failure names the fix: delete the entry and fix the code its rule reports, or put the exception on the line that needs it as a directive with a reason. A config entry switching off a rule no directive may name fails as an added directive does. Sync adds `config` at today's counts to a budget that predates it; until then config rule-offs are not capped.
345
345
  - `agentFiles` is `true` once the budget counts the repository's own files under the agent directories (`.agents/`, `.claude/` and the others), skipping only what `antelopejs-sync` writes there, which is what lint skips. A budget without it counts none of them, so upgrading fails nothing: `antelopejs-sync` adds each key's count in those files to its ceiling and sets the field. `antelopejs-suppressions --base` allows that one rise on a base without the field, by no more than the count in those files at the base per key (a directive the same branch adds there is not adoptable), and fails a budget that drops the field once the base has it.
346
346
  - `antelopejs-suppressions` fails when a count is above its ceiling, printing each `file:line` in the files the change touched and the fix: fix the code, or remove another suppression of the same kind; a rule that keeps needing suppressions should be changed in the preset. It prints nothing on success.
347
- - `antelopejs-suppressions --update` lowers each ceiling to the current count and keeps rules at zero. No command raises a ceiling.
347
+ - `antelopejs-suppressions --update` lowers each ceiling to the current count and drops each `rules` and `config` key that suppresses nothing; a missing key has ceiling 0. No command raises a ceiling.
348
348
  - `SAFETY:` comments and directives disabling `anti-slop/require-safety-comment-for-type-assertion` share their room: a `SAFETY:` comment may use what those directives leave below their ceiling, in the full, base and staged checks, and `--update` moves that room to `safety`. Replacing such a directive with a `SAFETY:` comment needs no raise; their sum never rises.
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.
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 the budget drops the `config` the base has, so a raise merges only through the operator's ruleset bypass. A removed key is a ceiling of 0, so removing one that still suppresses something fails the ceiling check unless a containing scope of its rule lends it room. 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
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`.
@@ -1,7 +1,7 @@
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 coveredLimits, n as SUPPRESSIONS_FILE, o as safetyCeiling, s as stagedNames } from "../suppression-budget-B30kar1T.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-Dbb2RlAV.mjs";
5
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";
@@ -266,8 +266,8 @@ function suppressionBase(root, base) {
266
266
  }
267
267
  return verified(root, "refs/remotes/origin/HEAD");
268
268
  }
269
- function agentFilesDropped(base, current) {
270
- return base.agentFiles && !current.agentFiles ? [`${SUPPRESSIONS_FILE}: drops agentFiles, which the base has. Keep it; the repository's own files under the agent directories stay counted.`] : [];
269
+ function fieldsDropped(base, current) {
270
+ return [...base.agentFiles && !current.agentFiles ? [`${SUPPRESSIONS_FILE}: drops agentFiles, which the base has. Keep it; the repository's own files under the agent directories stay counted.`] : [], ...base.config !== void 0 && current.config === void 0 ? [`${SUPPRESSIONS_FILE}: drops config, which the base has. Keep it; without it lint config rule-offs go uncapped.`] : []];
271
271
  }
272
272
  /** What the agent directories hold, when `current` begins recording them and `base` does not; nothing otherwise. */
273
273
  function adoptableAgentCounts(root, revision, base, current) {
@@ -287,8 +287,9 @@ function adoptableAgentCounts(root, revision, base, current) {
287
287
  }
288
288
  /**
289
289
  * Fails each ceiling of the working-tree budget that is higher than on
290
- * `revision`, and each rule that `revision` lists but the working tree
291
- * dropped, config rule-offs included once the base has their ceilings; a
290
+ * `revision`, config rule-offs included once the base has their ceilings,
291
+ * and a working tree that drops the `config` the base has; a key the working
292
+ * tree drops is a ceiling of zero, which the ceiling check holds it to. A
292
293
  * config ceiling may rise by what a containing scope of its rule falls. The
293
294
  * safety ceiling may rise by what the SAFETY rule's own ceiling falls. A
294
295
  * base that does not record the agent directories' files lets the working
@@ -305,17 +306,17 @@ function raisedCeilings(root, revision) {
305
306
  const label = `${revision.slice(0, 12)}:${SUPPRESSIONS_FILE}`;
306
307
  const base = parseBudget(committed.stdout, label);
307
308
  const current = parseBudget(readFileSync(join(root, SUPPRESSIONS_FILE), "utf8"), SUPPRESSIONS_FILE);
308
- const failures = agentFilesDropped(base, current);
309
+ const failures = fieldsDropped(base, current);
309
310
  const room = adoptableAgentCounts(root, revision, base, current);
310
311
  const compare = (key, ceiling, after, adoptable = 0) => {
311
312
  const before = ceiling + adoptable;
312
- if (after === void 0) failures.push(`${SUPPRESSIONS_FILE}: removes ${key}, which has ceiling ${before} on the base. Keep the key; lower it with suppressions:update.`);
313
- else if (after > before) failures.push(`${SUPPRESSIONS_FILE}: raises ${key} from ${ceiling} on the base to ${after}${adoptable ? `, above the ${before} that recording the agent files allows` : ""}.`);
313
+ if (after > before) failures.push(`${SUPPRESSIONS_FILE}: raises ${key} from ${ceiling} on the base to ${after}${adoptable ? `, above the ${before} that recording the agent files allows` : ""}.`);
314
314
  };
315
- for (const rule of /* @__PURE__ */ new Set([...Object.keys(base.rules), ...Object.keys(current.rules)])) compare(`lint rule \`${rule}\``, base.rules[rule] ?? 0, Object.hasOwn(base.rules, rule) ? current.rules[rule] : current.rules[rule] ?? 0, room.rules[rule]);
316
- const baseConfig = base.config ?? {};
317
- const covered = coveredLimits(baseConfig, current.config ?? {});
318
- for (const rule of /* @__PURE__ */ new Set([...Object.keys(baseConfig), ...Object.keys(current.config ?? {})])) if (base.config !== void 0) compare(`lint config rule-off \`${rule}\``, covered[rule] ?? 0, current.config === void 0 || Object.hasOwn(baseConfig, rule) && !Object.hasOwn(current.config, rule) ? void 0 : current.config[rule] ?? 0, room.config[rule]);
315
+ for (const rule of Object.keys(current.rules)) compare(`lint rule \`${rule}\``, base.rules[rule] ?? 0, current.rules[rule], room.rules[rule]);
316
+ if (base.config !== void 0 && current.config !== void 0) {
317
+ const covered = coveredLimits(base.config, current.config);
318
+ for (const rule of Object.keys(current.config)) compare(`lint config rule-off \`${rule}\``, covered[rule] ?? 0, current.config[rule], room.config[rule]);
319
+ }
319
320
  compare("`@ts-expect-error`", base.tsExpectError, current.tsExpectError, room.tsExpectError);
320
321
  compare("`@ts-ignore`", base.tsIgnore, current.tsIgnore, room.tsIgnore);
321
322
  compare("`SAFETY:` comments", safetyCeiling(base, current.rules["anti-slop/require-safety-comment-for-type-assertion"] ?? 0), current.safety, room.safety);
package/dist/bin/sync.mjs CHANGED
@@ -10,7 +10,7 @@ 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 verifyLayers, c as pnpmLockfiles, d as moveDependencyRanges, f as runPnpm, l as inWorkspace, o as matchingScripts, r as droppedChecksSteps, s as stepsOf, u as installsWithPnpm } from "../checks-Crg3yU_o.mjs";
13
- import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-B30kar1T.mjs";
13
+ import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-Dbb2RlAV.mjs";
14
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";
@@ -216,7 +216,7 @@ function parseBudget(text, source) {
216
216
  }
217
217
  return budget;
218
218
  }
219
- /** Serializes a budget with sorted rules and config rule-offs, zero ceilings kept, so rewriting an unchanged budget is a no-op. */
219
+ /** Serializes a budget with sorted rules and config rule-offs, so rewriting an unchanged budget is a no-op. */
220
220
  function formatBudget(budget) {
221
221
  const sorted = {
222
222
  ...budget,
@@ -299,9 +299,12 @@ function groupByKey(suppressions) {
299
299
  }
300
300
  return groups;
301
301
  }
302
- /** Each ceiling of `limits` lowered to its count in `current`, rules at zero kept. */
302
+ /** Each ceiling of `limits` lowered to its count in `current`, a key that suppresses nothing dropped. */
303
303
  function lowerEach(limits, current = {}) {
304
- return Object.fromEntries(Object.entries(limits).map(([rule, limit]) => [rule, Math.min(limit, Object.hasOwn(current, rule) ? current[rule] : 0)]));
304
+ return Object.fromEntries(Object.entries(limits).flatMap(([rule, limit]) => {
305
+ const count = Object.hasOwn(current, rule) ? current[rule] : 0;
306
+ return count > 0 ? [[rule, Math.min(limit, count)]] : [];
307
+ }));
305
308
  }
306
309
  function lowered(budget, current) {
307
310
  const result = {
@@ -319,7 +322,8 @@ function lowered(budget, current) {
319
322
  * listing the suppressions in the files this change touches (all of them when
320
323
  * it touches none). SAFETY comments may also use the room the
321
324
  * directives disabling the SAFETY rule leave below their ceiling. `update`
322
- * lowers every ceiling to its current count, moving that room to `safety`;
325
+ * lowers every ceiling to its current count, drops each rule and config key
326
+ * that suppresses nothing, and moves that room to `safety`;
323
327
  * no command ever raises the two together. A config rule-off may use the
324
328
  * room a containing scope of its rule gives up, and `update` moves that room
325
329
  * to the narrower key.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/tooling-configs",
3
- "version": "0.8.1-next.375.gde7597d",
3
+ "version": "0.8.1",
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": "de7597d7ba60be1f4a359e707392ce4182df9384",
155
+ "gitHead": "120b2a42f1162e272d112b2db5f34236aa6b4331",
156
156
  "scripts": {
157
157
  "build": "tsdown",
158
158
  "lint": "oxlint",