Repository navigation
Commit 272bfa8
cowork: namespace & side-effect imports consume a module's whole export surface (#49)
* cowork-bot: standardize copyright holder to 2025 Coding-Dev-Tools (was Revenue Holdings / stale 2026 year); W-directed fleet-wide pass
* chore: standardize license and package metadata; scanner/test fixes
* cowork-bot: treat type-only named imports as used in dead-code scan
* cowork-bot: treat re-exports (barrel/index forwarding) as used in dead-code scan
Named (`export { X } from './mod'`), renamed (`export { X as Y }`),
type (`export { type X }`), and star (`export * from './mod'`) re-exports
now mark the forwarded symbols as used, so barrel/index files no longer
produce false-positive 'unused_export' findings flagged removable=True
(which could delete live public API). Resolves `export *` specifiers to
scanned files (incl. directory index.*). Adds TestReexportForwarding
(8 cases) + removes a pre-existing F841 unused var. 113 tests pass, ruff clean.
* cowork-bot: fix import parsing in scanner — handle import type {Foo}, mixed default+named imports, and correct group-index reversal
- Rewrote _IMPORT_PATTERN regex to handle: import type {Foo}, import Default, {Named},
import {type Foo}, and import Foo as Bar forms
- Fixed _parse_imports group-number reversal (group 1 = named imports block, group 2 = default)
- Strips 'type ' prefix from named import entries in both named-block positions
- All 113 existing tests pass; ruff clean
* cowork-bot: treat namespace imports (import * as NS) and bare side-effect imports as whole-module consumption
A namespace binding (import * as Utils from './utils') or a bare side-effect
import (import './polyfill') consumes the target module's entire export
surface. The scanner previously ignored both forms entirely, so exports used
ONLY through them were falsely reported as unused with removable=True — live
code queued for deletion by 'deadcode remove'. Both now resolve like barrel
star-reexports: the resolved module's exports are treated as used. Bare
package specifiers stay unresolvable and keep flagging.
+5 regression tests (namespace, export * as ns, side-effect, bare-specifier,
no-consumer control). Full suite: 121 passed, ruff clean.
* cowork-bot: restore working tree dropped by malformed previous commit
The previous commit (2ef1848) was built from a stale temp index and
accidentally recorded deletions of 34 unrelated tracked files. This commit
restores the full tree of 30e09bb while keeping the intended scanner fix
(namespace/side-effect imports as whole-module consumption) and its 5
regression tests. No force-push used.
* cowork-bot: re-add namespace/side-effect import consumption lost by checkout-index
efa7ce2 restored the tree but its checkout-index step reverted
src/deadcode/scanner.py to the pre-fix version. This commit re-applies the
scanner fix from 2ef1848: import * as NS / bare side-effect imports consume
the target module's whole export surface (resolves like barrel star-reexports).
Final tree vs master-base 30e09bb = exactly scanner.py fix + 5-test file.
* cowork-bot: dynamic import() and require() now consume target module's whole export surface (previously invisible -> exports used only via lazy loading flagged removable=True); +3 regression tests
---------
Co-authored-by: DevForge Engineer <engineer@devforge.dev>
Co-authored-by: cowork-bot <bot@coding-dev-tools.local>1 parent aa1810a commit 272bfa8
0 file changed
0 commit comments