Skip to content

fix(dead-code): re-exports not counted as usage, causing false positives#206

Merged
Wolfvin merged 1 commit into
mainfrom
fix/deadcode-reexport-false-positive
Jul 11, 2026
Merged

fix(dead-code): re-exports not counted as usage, causing false positives#206
Wolfvin merged 1 commit into
mainfrom
fix/deadcode-reexport-false-positive

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Found while validating dead-code breakdown against real codebase (Coretax-Auto-Downloader extension).

export type {X} from './y' (and export {X} from './y') consume X from the source module, but the import-collection regex only matched import {X} from. Any symbol only re-exported (never plain-imported) was flagged unused.

Verified: ProductAccess/AuthUser (auth/google-auth-cache.ts) re-exported via export type {...} from in auth/google-auth.ts — false positive before fix, gone after fix.

Also fixes the re-export regex itself: it required export { and never matched export type { at all, so type-only re-exports weren't even tracked as re_export entries.

Test suite: 1 pre-existing failure (test_dead_code_json_output_has_schema_version) confirmed present on main before this change too — unrelated.

@Wolfvin Wolfvin merged commit 0b2b471 into main Jul 11, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Wolfvin Wolfvin deleted the fix/deadcode-reexport-false-positive branch July 11, 2026 18:23
export type {X} from './y' (and export {X} from './y' without 'type')
consume X from the source module — but the import-collection regex only
matched 'import {X} from', never 'export {X} from'. Any symbol only ever
re-exported (never plain-imported) was incorrectly flagged unused.

Found via real-codebase validation (Coretax-Auto-Downloader extension):
ProductAccess/AuthUser defined in google-auth-cache.ts, re-exported via
'export type {...} from' in google-auth.ts, flagged unused despite being
consumed downstream through the re-export.

Also fixes the re-export regex itself, which required 'export {' and
never matched 'export type {' at all.
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant