feat: warn about non-import references to moved files
The import graph only rewrites import/export-from/require. Files are also named from markdown links, package.json fields, jest.mock strings and tsconfig file lists, and a move that dangles those must not pass silently. mv now scans text formats plus source strings for the moved paths, module names and old specifier forms (word-boundary matched, lockfiles/hidden dirs skipped) and reports each occurrence once per line on stderr and as non_import_refs[] in --json (dry-run included). References are never edited; exit codes are unchanged. Also moves normalize_scope into Index (its only consumer) and the Change/ChangedFile JSON structs into output where they are built, to stay inside the 250-line-per-file budget.
This commit is contained in:
parent
b1af375763
commit
1ddf79b508
21 changed files with 557 additions and 81 deletions
1
tests/typescript/refs/.notes/refs.md
Normal file
1
tests/typescript/refs/.notes/refs.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
stale ref: ./lib/sum
|
||||
3
tests/typescript/refs/README.md
Normal file
3
tests/typescript/refs/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Use [sum](./lib/sum.ts) via `lib/sum`.
|
||||
See also lib/summary for text.
|
||||
Layout note: lib/ holds helpers.
|
||||
1
tests/typescript/refs/__tests__/sum.test.ts
Normal file
1
tests/typescript/refs/__tests__/sum.test.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
jest.mock('../lib/sum');
|
||||
2
tests/typescript/refs/app.ts
Normal file
2
tests/typescript/refs/app.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import { sum } from './lib/sum';
|
||||
export const x = sum(1, 2);
|
||||
1
tests/typescript/refs/lib/sum.ts
Normal file
1
tests/typescript/refs/lib/sum.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export const sum = (a: number, b: number): number => a + b;
|
||||
1
tests/typescript/refs/lib/summary.ts
Normal file
1
tests/typescript/refs/lib/summary.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export const summary = 'text';
|
||||
1
tests/typescript/refs/package-lock.json
generated
Normal file
1
tests/typescript/refs/package-lock.json
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ "packages": { "x": "./lib/sum" } }
|
||||
1
tests/typescript/refs/package.json
Normal file
1
tests/typescript/refs/package.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ "name": "refs-fixture", "main": "./lib/sum.ts" }
|
||||
Loading…
Add table
Add a link
Reference in a new issue