Skip to content

build: enable noUnusedLocals and remove stale unused imports#413

Merged
askpt merged 2 commits into
mainfrom
repo-assist/eng-noUnusedLocals-20260624-b459feb4957d2182
Jun 25, 2026
Merged

build: enable noUnusedLocals and remove stale unused imports#413
askpt merged 2 commits into
mainfrom
repo-assist/eng-noUnusedLocals-20260624-b459feb4957d2182

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Enable noUnusedLocals: true in tsconfig.json to catch unused local variables at compile time, and clean up the four pre-existing violations it surfaces in test files.

Why

strict: true (already enabled) does not include noUnusedLocals. Adding it catches a real class of bugs — importing a symbol or declaring a variable and then not using it is almost always a mistake or dead code. The repo already has noImplicitReturns (added in #408) and noFallthroughCasesInSwitch; this is the natural next step.

tsconfig.json change

     "noImplicitReturns": true,
+    "noUnusedLocals": true,
     // "noUnusedParameters": true,

Pre-existing violations fixed in test files

File Violation Fix
configuration.test.ts CodeMetricsConfig imported but never used Remove from import
configuration.test.ts changeEventFired declared and set but never read Remove variable; simplify watcher callback to no-op
metricsAnalyzerFactory.test.ts UnifiedFunctionMetrics imported but never used Remove from import
suite/index.ts path imported but never used Remove import

All are in test/infrastructure files; no production logic changes.

Test Status

npm run compile  ✅  (0 errors)
npm run lint     ✅  (0 warnings)
npm run test:unit  ✅  149 passing, 0 failing

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • releaseassets.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "releaseassets.githubusercontent.com"

See Network Configuration for more information.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@d63b34de41bc0dc052096e094c732cf28eafc659

Add noUnusedLocals: true to tsconfig.json to catch unused local
variables at compile time, complementing the existing noImplicitReturns
and strict checks.

Fix the four pre-existing violations this surfaced in test files:
- configuration.test.ts: remove unused CodeMetricsConfig import and
  simplify the watcher test (drop the never-read changeEventFired flag)
- metricsAnalyzerFactory.test.ts: remove unused UnifiedFunctionMetrics import
- suite/index.ts: remove unused path import

No production source changes; all 149 unit tests continue to pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@askpt askpt changed the title [repo-assist] build: enable noUnusedLocals and remove stale unused imports build: enable noUnusedLocals and remove stale unused imports Jun 25, 2026
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.15%. Comparing base (0aef168) to head (e4386cd).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #413   +/-   ##
=======================================
  Coverage   78.15%   78.15%           
=======================================
  Files          13       13           
  Lines        4161     4161           
  Branches      469      469           
=======================================
  Hits         3252     3252           
  Misses        906      906           
  Partials        3        3           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@askpt askpt marked this pull request as ready for review June 25, 2026 07:44
@askpt askpt self-requested a review as a code owner June 25, 2026 07:44
Copilot AI review requested due to automatic review settings June 25, 2026 07:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request tightens TypeScript compile-time checks by enabling noUnusedLocals, and updates a few test files to remove unused imports/locals so the project continues to compile cleanly under the stricter setting.

Changes:

  • Enabled compilerOptions.noUnusedLocals in tsconfig.json.
  • Removed unused imports in test/infrastructure files surfaced by the new compiler option.
  • Removed an unused local variable in a configuration watcher test by simplifying the callback to a no-op.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
tsconfig.json Enables noUnusedLocals (and adds the needed comma after noImplicitReturns) to enforce unused-local checks at compile time.
src/test/suite/index.ts Removes an unused path import in the test suite entrypoint.
src/test/metricsAnalyzer/metricsAnalyzerFactory.test.ts Removes an unused type import (UnifiedFunctionMetrics) from the factory tests.
src/test/configuration.test.ts Removes an unused import and eliminates an unused local in the configuration watcher test.

@askpt askpt merged commit 3f9b193 into main Jun 25, 2026
10 checks passed
@askpt askpt deleted the repo-assist/eng-noUnusedLocals-20260624-b459feb4957d2182 branch June 25, 2026 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants