Skip to content

chore(web): remove unused exports and orphan files and enforce TS export check - #1278

Merged
kyasbal merged 4 commits into
push-wtxqxzwlokuqfrom
push-zkpyxonwktyw
Nov 18, 2026
Merged

kyasbal merged 4 commits into
push-wtxqxzwlokuqfrom
push-zkpyxonwktyw

Conversation

@kyasbal

@kyasbal kyasbal commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Stacked on #1277

Background

TypeScript's noUnusedLocals compiler option intentionally skips declarations marked with export because another module could import them. Over time, frontend refactors leave behind orphaned .ts files, completely unused export declarations, and helper symbols marked export despite only being referenced within their own declaring file.

Approach

Add web/scripts/check-unused-exports.ts (strictly type-checked via web/tsconfig.scripts.json, linted via ng lint, and unit-tested in web/scripts/check-unused-exports.spec.ts) using the existing web/node_modules/typescript Language Service API (requiring zero external npm dependencies), and wire it into npm run lint:unused, make lint-web, and make test-web:

  • orphan-ts-file: Flags non-generated, non-spec, non-story .ts files under web/src and web/scripts that are neither entrypoints nor imported anywhere across web/src, web/.storybook, and web/scripts.
  • unused-export: Flags exported declarations and re-exports with zero references across both their declaring file and external modules.
  • unnecessary-export: Flags export modifiers on declarations referenced only within their own declaring file.

Delete existing orphaned files, remove dead exports, and drop unnecessary export modifiers from file-local declarations.

@kyasbal
kyasbal requested review from RyuSA and jyane as code owners November 17, 2026 05:56
@kyasbal kyasbal added area:frontend Web frontend application and UI components area:devenv Development environment, Makefile, and build tooling labels Nov 17, 2026
@kyasbal
kyasbal requested a review from kkuchima as a code owner November 17, 2026 05:56
@kyasbal kyasbal added the type:chore Maintenance, dependency updates, and tooling chores label Nov 17, 2026
@kyasbal
kyasbal requested review from K53 and renamoo as code owners November 17, 2026 05:56

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a custom script (check-web-unused-exports.mjs) to detect unused or unnecessarily exported TypeScript symbols and integrates it into the frontend linter pipeline. It also cleans up the codebase by removing unused files and stripping the export modifier from numerous interfaces, functions, and classes that are only used internally. The review feedback is highly constructive, suggesting path normalization to prevent drive-letter casing issues on Windows and recommending caching of script snapshots to optimize disk I/O and improve the script's execution speed.

Comment thread scripts/check-web-unused-exports.mjs Resolved
Comment thread scripts/check-web-unused-exports.mjs Resolved
@kyasbal
kyasbal added this pull request to stack #1280 November 17, 2026 05:59
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

TypeScript Quality Report (origin/push-wtxqxzwlokuq) — ✅ PASS

Metric Result
Changed Scope 60 prod file(s), 0 test file(s), 60 unit(s)
Patch Coverage 100.0% (28/28 lines)
Mutation Score 100.0% (0/0 killed, 0 survived)

Commit: 38543d62b5b2 · Cloud Build Logs

@kyasbal

kyasbal commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a tool to detect unused exports and orphan TypeScript files in the frontend workspace, integrating it into the linting and testing pipelines. It also refactors numerous files across the codebase to remove unnecessary exports and clean up unused types, interfaces, and functions. The review feedback highlights an issue in check-unused-exports.ts where chained re-exports are not fully resolved, potentially failing to flag certain unused exports, and suggests a robust fix to track the original definition file.

Comment thread web/scripts/check-unused-exports.ts Resolved
@kyasbal
kyasbal added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 74bb498 Nov 18, 2026
37 checks passed
@kyasbal
kyasbal deleted the push-zkpyxonwktyw branch November 18, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:devenv Development environment, Makefile, and build tooling area:frontend Web frontend application and UI components type:chore Maintenance, dependency updates, and tooling chores

1 participant