Skip to content

feat(lint): add no-unused-vars ratchet scoped to src+open-sse+tests - #11247

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.50from
maxmad64bis:feat/ratchet-no-unused-vars
Aug 23, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.50from
maxmad64bis:feat/ratchet-no-unused-vars

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #9985

Summary

Unused variables are currently invisible in this repo. No rule watches them, so they don't show up in the ratchet drift either — every release cycle quietly accumulates a few more: parameters left behind by refactors, catch clauses that drop the error, destructuring that grabs more than it uses. Nobody writes them on purpose, and individually they're harmless. The problem is cumulative: after a while readers can't tell which parameters are actually part of a function's contract, and an unused parameter is often the fingerprint of a call path that no longer works the way its signature suggests.

This PR doesn't fix any of them and doesn't ask anyone to. It just extends the mechanism the repo already trusts — bulk suppressions with a hard wall for new code — to the last big category of lint debt that has no gate. Everything frozen today stays frozen; from the next commit on, a new unused binding fails lint inside the PR that introduced it, where fixing it costs seconds and the author still remembers why it was there. The escape hatch is deliberately generous: prefix it with _ and the linter stays out of your way.

Concretely:

Related Issues

Validation

Choose the change type and focused loop from the
Contribution Golden Path. The full unit suite,
Vitest, the 60% coverage gate, and the production build all run in CI on this PR (#8329):

  • Change type: other (lint tooling / quality gate)
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR
  • SonarQube is temporarily opt-in while the private project has no quota; it is not a PR gate.

Tests Added Or Updated

  • No production code changed — config (eslint.config.mjs) and suppressions data only, so no new test file is added. The ratchet behavior was verified with throwaway probe files (removed): a new unused variable in src/ fails lint, a leading unused parameter is still flagged (args: "all"), and scripts/*.mjs remains ignored.

Coverage Notes

  • No src/, open-sse/, electron/ or bin/ runtime code is touched by the rule itself; the only tracked-file deletions are the two leaked planning docs. Coverage is unaffected.

Reviewer Notes

  • The bulk-suppressions JSON was produced by ESLint's native --suppress-rule + --suppressions-location mechanism (the same one wired into npm run lint and lint-staged — see package.json:109 and :411). The exact command to reproduce / refresh the file from the current base is:

    npx eslint --fix --no-error-on-unmatched-pattern --no-warn-ignored \
      --suppress-rule "@typescript-eslint/no-unused-vars" \
      --suppressions-location config/quality/eslint-suppressions.json \
      'src/**/*.{ts,tsx,js,jsx}' 'open-sse/**/*.ts' 'tests/**/*.{ts,tsx,mjs}'
    

    Output is keyed by file path; each entry holds { "@typescript-eslint/no-unused-vars": { "count": N } }. The -455 lines in this diff are the --prune-suppressions half of the same run — entries that no longer occur on the current tip. The freeze count (1393) covers args, vars and catch clauses together across all three scopes, which is why it's higher than a spot-check would suggest. One ESLint pass over the three scoped globs takes ~3 min on a warm cache.

  • docs/superpowers/ is gitignored on release/v3.8.50 (/.gitignore:169), so the two files leaked via feat: guide Qdrant memory configuration #11213 are an isolated slip, not an ongoing drift. This PR git rms them so the tracked-artifacts pre-commit hook stops rejecting every new commit on the branch. The untrack is kept in this PR rather than split out because (a) it is the symptom of the same merge (feat: guide Qdrant memory configuration #11213) that also brings the ~20 unsuppressed no-explicit-any mentioned below, and (b) splitting would force PR-A to merge before PR-B or risk the hook rejecting PR-A's own commits. Happy to split on maintainer request.

  • On top of the inherited base-red (🔴 Release branch not green: release/v3.8.50 #9985), the current tip also carries ~20 unsuppressed no-explicit-any in tests/integration/qdrant-routes.test.ts (arrived with feat: guide Qdrant memory configuration #11213). Pre-existing and untouched here.

Bar NEW unused vars/args/catches outside the `_` escape hatch via
@typescript-eslint/no-unused-vars (args:"all", caughtErrors:"all",
ignoreRestSiblings), scoped to src/**/*.{ts,tsx,js,jsx} + open-sse/**/*.ts
+ tests/**/*.{ts,tsx,mjs} — scripts/, bin/ and docs/ stay out of scope.

Pre-existing violations (1393 across 1251 files) are frozen in
config/quality/eslint-suppressions.json via --suppress-rule, same
pattern as diegosouzapw#7879 (toNumber tier-by-tier). Only genuinely NEW unused
bindings fail lint from now on.

Also untracks two docs/superpowers/* planning files that slipped into
the tree via diegosouzapw#11213 while being gitignored; their presence makes the
tracked-artifacts pre-commit hook reject every new commit.

Refs diegosouzapw#9985
@maxmad64bis
maxmad64bis force-pushed the feat/ratchet-no-unused-vars branch from 673b4f4 to 8866ffb Compare August 23, 2026 13:34
@maxmad64bis
maxmad64bis marked this pull request as ready for review August 23, 2026 13:39
@maxmad64bis maxmad64bis reopened this Aug 23, 2026
@diegosouzapw
diegosouzapw merged commit 5b92dbd into diegosouzapw:release/v3.8.50 Aug 23, 2026
23 of 37 checks passed
diegosouzapw pushed a commit that referenced this pull request Aug 23, 2026
#11249/#11251/#11252/#10952 follow-ups)

The gate (eslint full-tree, baseline 0) failed on the merged head with 26
unsuppressed errors, all introduced by same-day base merges — none by this
PR. Each fixed at the cause (no new suppressions):

1. tests/integration/qdrant-routes.test.ts (#11249/#11213): 20x
   no-explicit-any on route-invocation casts. Fix: typed asNextRequest()
   adapter (Request -> NextRequest) replacing every "as any".

2. tests/unit/effort-tiers-loop-catalog-e2e.test.ts (#11252): unused
   after/beforeEach imports — newly error-level under the no-unused-vars
   ratchet #11247 shipped the same day. Fix: trim the import (the file
   uses test.after/test.beforeEach method forms).

3. EditConnectionModal.tsx (#11251): react-hooks/set-state-in-effect on
   the modal-open setFormData init. The pattern (sync form state with the
   loaded connection when isOpen flips) is the codebase's sanctioned
   exception — same justified eslint-disable-next-line already used in
   FreePoolTab.tsx and BatchConceptCard.tsx; a key-remount of the 30+
   field form would be a behavior-risking restructure for a basereds PR.

4. tests/unit/usage-service-hardening.test.ts (shard 2/4): last stale
   Copilot wire-identity pin — #10952 re-based it on the live-captured CLI
   1.0.81-6 (copilot-developer-cli integration id, API version 2026-08-01).
   Assertions aligned (UA, Editor-Version, Editor-Plugin-Version,
   X-GitHub-Api-Version).

Validation: all four files eslint-clean with the frozen suppressions;
usage-service-hardening 23/23 and effort-tiers 2/2 RED->GREEN
(node --import tsx/esm --test).

Refs #9985
@maxmad64bis
maxmad64bis deleted the feat/ratchet-no-unused-vars branch September 24, 2026 21:11
fouadSalkini added a commit to fouadSalkini/OmniRoute that referenced this pull request Sep 26, 2026
…ed files

Slice 1/3 carried a locally pruned copy of eslint-suppressions.json that
dropped entries for files this PR never touches. The CI lint job runs with
--pass-on-unpruned-suppressions and prunes stale entries at release
reconciliation, so dropping them here is not required. Restore the base
file and keep only the removal for src/lib/usage/apiKeySelfService.ts:
this PR rewrites that file, the no-restricted-syntax violation is gone,
and lint-staged (no pass flag) fails any commit staging a file with an
unused suppression.

Restored entries:
- vertex registry index.ts, executors/vertex.ts, both vscode
  [token]/combos routes, use-stream-metrics and use-tools-builder
  tests (diegosouzapw#11247)
- executors/vertex.ts, ProxyLogDetail.tsx, analytics/charts.tsx (diegosouzapw#6202)
- executor-nlpcloud and qoder-unwrap-error-envelope tests (diegosouzapw#9126)
- use-improve-prompt, use-presets, use-stream-metrics,
  use-structured-output and use-tools-builder tests (diegosouzapw#12144)
- gemini-business-provider test (diegosouzapw#11247; base drops it separately)
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…iegosouzapw#11247)

Validated on the combined 12-PR batch board: typecheck:core clean, file-size/changelog/complexity/cognitive gates within baseline, eslint config smoke-tested. Freeze-then-ratchet for @typescript-eslint/no-unused-vars scoped to src/open-sse/tests (1393 pre-existing frozen, _ escape hatch, args:all), following the diegosouzapw#7879 pattern — plus it untracks the two docs/superpowers planning files that leaked in via diegosouzapw#11213 and were tripping check:tracked-artifacts for everyone. Thank you @maxmad64bis!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants