@codegraft/rules 0.1.0-beta.1 → 0.1.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ transform.transform("import { Foo } from 'm'\nlet v: Foo", {})
|
|
|
33
33
|
// → "import type { Foo } from 'm'\nlet v: Foo"
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
It works on every JS-family grammar (JS / JSX / TS / TSX) and, through a `ZoneSplitter`, the `<script>`
|
|
36
|
+
It works on every JS-family grammar (JS / JSX / TS / TSX) and, through a `ZoneSplitter`, a Vue SFC — pruning the `<script>` while keeping a binding used only from a sibling zone: a component `<Tag>`, a custom `v-directive`, an interpolation/binding expression, a `<style> v-bind()`, or a second `<script>`.
|
|
37
37
|
|
|
38
38
|
The rule module is also a ready codemod (default export + `targets: ['javascript', 'typescript', 'tsx']`), so the CLI runs it directly — `.vue` `<script>` included, via the cli's built-in splitter:
|
|
39
39
|
|
|
@@ -6,7 +6,9 @@ import type { GrammarId } from '@codegraft/core';
|
|
|
6
6
|
* import whose use isn't decidable is kept. The scope resolver's rename-safety abstentions (a TS
|
|
7
7
|
* namespace, `declare module`) don't block pruning — a syntactic use-scan covers them; only `with`
|
|
8
8
|
* and `eval`, which can reach a name invisibly, force a no-op. Runs on every JS-family grammar and,
|
|
9
|
-
* through a `ZoneSplitter`,
|
|
9
|
+
* through a `ZoneSplitter`, a Vue SFC: a binding used only from a sibling zone — the template's
|
|
10
|
+
* expression zones, a component `<Tag>`, a custom `v-directive`, a `<style> v-bind()`, or a second
|
|
11
|
+
* `<script>` — is kept, not pruned.
|
|
10
12
|
*/
|
|
11
13
|
export declare const removeUnusedImports: import("@codegraft/codemod").Codemod<Record<string, unknown>, GrammarId>;
|
|
12
14
|
export default removeUnusedImports;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-unused-imports.d.ts","sourceRoot":"","sources":["../src/remove-unused-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,SAAS,EAAY,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"remove-unused-imports.d.ts","sourceRoot":"","sources":["../src/remove-unused-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,SAAS,EAAY,MAAM,iBAAiB,CAAA;AAgDtE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,0EAyI9B,CAAA;AAEF,eAAe,mBAAmB,CAAA;AAIlC,eAAO,MAAM,OAAO,EAAE,SAAS,EAAwC,CAAA"}
|
|
@@ -1,4 +1,47 @@
|
|
|
1
1
|
import { defineCodemod } from '@codegraft/codemod';
|
|
2
|
+
// `my-widget` / `MyWidget` / `myWidget` → `MyWidget`; each hyphen drops and caps the next letter.
|
|
3
|
+
const pascalCase = (name) => name.replace(/(^|-)([a-z])/g, (_m, _sep, c) => c.toUpperCase());
|
|
4
|
+
const camelCase = (name) => {
|
|
5
|
+
const pascal = pascalCase(name);
|
|
6
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
7
|
+
};
|
|
8
|
+
// Vue's built-in directives bind no import, unlike a custom `v-my-dir` (which maps to a `vMyDir` local).
|
|
9
|
+
const BUILTIN_DIRECTIVES = new Set([
|
|
10
|
+
'v-if', 'v-else', 'v-else-if', 'v-for', 'v-show', 'v-bind', 'v-on',
|
|
11
|
+
'v-model', 'v-slot', 'v-html', 'v-text', 'v-pre', 'v-once', 'v-cloak', 'v-memo',
|
|
12
|
+
]);
|
|
13
|
+
/**
|
|
14
|
+
* Binding names a Vue template references *outside* a JS expression — component tags (`<MyWidget>` /
|
|
15
|
+
* `<my-widget>` → `MyWidget`/`myWidget`) and custom directives (`v-my-dir` → `vMyDir`), which live in
|
|
16
|
+
* vue `tag_name` / `directive_name` nodes. Native elements (`<div>`) and built-in directives are
|
|
17
|
+
* excluded — never an imported binding. These are always value uses; empty for a non-SFC file.
|
|
18
|
+
*/
|
|
19
|
+
function vueTemplateBindings(root) {
|
|
20
|
+
const names = new Set();
|
|
21
|
+
root.find('tag_name').forEach((tag) => {
|
|
22
|
+
const name = tag.text;
|
|
23
|
+
if (/^[A-Z]/.test(name) || name.includes('-'))
|
|
24
|
+
names.add(pascalCase(name)).add(camelCase(name));
|
|
25
|
+
});
|
|
26
|
+
root.find('directive_name').forEach((dir) => {
|
|
27
|
+
const name = dir.text;
|
|
28
|
+
if (name.startsWith('v-') && !BUILTIN_DIRECTIVES.has(name))
|
|
29
|
+
names.add('v' + pascalCase(name.slice(2)));
|
|
30
|
+
});
|
|
31
|
+
return names;
|
|
32
|
+
}
|
|
33
|
+
/** The tree (zone) root a node belongs to — for telling a binding's own zone from its siblings. */
|
|
34
|
+
const treeRootOf = (node) => {
|
|
35
|
+
let cur = node;
|
|
36
|
+
while (cur.parent)
|
|
37
|
+
cur = cur.parent;
|
|
38
|
+
return cur;
|
|
39
|
+
};
|
|
40
|
+
/** A value identifier that is not the head of a qualified type (`NS.Thing`, which is a type use). */
|
|
41
|
+
const isValueRef = (ref) => {
|
|
42
|
+
const parent = ref.parent;
|
|
43
|
+
return !(parent?.type === 'nested_type_identifier' && parent.child('module') === ref);
|
|
44
|
+
};
|
|
2
45
|
/**
|
|
3
46
|
* Remove imports with no reference, and rewrite a value import used only in type positions into a
|
|
4
47
|
* type import — the analogue of `eslint-plugin-unused-imports` plus the import half of
|
|
@@ -6,9 +49,14 @@ import { defineCodemod } from '@codegraft/codemod';
|
|
|
6
49
|
* import whose use isn't decidable is kept. The scope resolver's rename-safety abstentions (a TS
|
|
7
50
|
* namespace, `declare module`) don't block pruning — a syntactic use-scan covers them; only `with`
|
|
8
51
|
* and `eval`, which can reach a name invisibly, force a no-op. Runs on every JS-family grammar and,
|
|
9
|
-
* through a `ZoneSplitter`,
|
|
52
|
+
* through a `ZoneSplitter`, a Vue SFC: a binding used only from a sibling zone — the template's
|
|
53
|
+
* expression zones, a component `<Tag>`, a custom `v-directive`, a `<style> v-bind()`, or a second
|
|
54
|
+
* `<script>` — is kept, not pruned.
|
|
10
55
|
*/
|
|
11
56
|
export const removeUnusedImports = defineCodemod((root) => {
|
|
57
|
+
// True only when there is more than one parsed zone (a Vue SFC). A plain single-grammar file has no
|
|
58
|
+
// sibling zone to consult, so it skips the cross-zone work below — the sibling scan and template names.
|
|
59
|
+
const multiZone = root.nodes().length > 1;
|
|
12
60
|
// The resolver reports only value (`identifier`) references, so type-position uses are gathered
|
|
13
61
|
// separately: every `type_identifier`, plus the `identifier` head of a qualified type (`NS.x`).
|
|
14
62
|
const typeRefs = new Set();
|
|
@@ -18,6 +66,13 @@ export const removeUnusedImports = defineCodemod((root) => {
|
|
|
18
66
|
if (head.type === 'identifier')
|
|
19
67
|
typeRefs.add(head.text);
|
|
20
68
|
});
|
|
69
|
+
// A `typeof X` type query holds its operand as a value `identifier` (the head of any member or
|
|
70
|
+
// instantiation chain — `typeof a.b`, `typeof g<T>`), so it never lexes as a `type_identifier`.
|
|
71
|
+
// Without this, a type-only import used solely through `typeof` reads as unreferenced — its
|
|
72
|
+
// `isType` binding scores `valueUsed === false` — and is wrongly pruned.
|
|
73
|
+
root.find('type_query').forEach((query) => query.find('identifier').forEach((id) => typeRefs.add(id.text)));
|
|
74
|
+
// Component tags / custom directives a Vue template references — a value use the JS scans can't see.
|
|
75
|
+
const templateNames = multiZone ? vueTemplateBindings(root) : new Set();
|
|
21
76
|
// The resolver abstains on the whole file at a construct it can't rename through — a TS namespace,
|
|
22
77
|
// `declare module`/`declare global`. Use-detection still holds (an import is used iff its name
|
|
23
78
|
// appears as a value identifier), so scan — unless `with`/`eval` can reach a name invisibly (null).
|
|
@@ -78,12 +133,23 @@ export const removeUnusedImports = defineCodemod((root) => {
|
|
|
78
133
|
if (!refNodes)
|
|
79
134
|
return; // resolver abstained and `with`/`eval` make use-detection unsound — skip
|
|
80
135
|
const declaration = binding.local.node;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
136
|
+
// The resolver (and the syntactic fallback's own-tree refs) only sees the binding's own zone
|
|
137
|
+
// tree. In a multi-zone file — a Vue SFC's template-expression zones, a second `<script>` — the
|
|
138
|
+
// same binding is reachable from a sibling zone, where the use lexes as a plain value identifier
|
|
139
|
+
// and is always a value use (a template / `v-bind` runs at runtime). Consult that even when the
|
|
140
|
+
// resolver succeeded — skipping it is exactly what hid template usage. An unsound scan
|
|
141
|
+
// (`with`/`eval`) with sibling zones present can't rule a use out, so abstain.
|
|
142
|
+
let usedInSibling = false;
|
|
143
|
+
if (multiZone) {
|
|
144
|
+
const occurrences = syntacticRefs(binding.local.text);
|
|
145
|
+
if (!occurrences)
|
|
146
|
+
return;
|
|
147
|
+
const ownTree = treeRootOf(declaration);
|
|
148
|
+
usedInSibling = occurrences.some((ref) => treeRootOf(ref) !== ownTree && isValueRef(ref));
|
|
149
|
+
}
|
|
150
|
+
const valueUsed = templateNames.has(binding.local.text) || // a component tag / custom directive (a value use)
|
|
151
|
+
usedInSibling ||
|
|
152
|
+
(!binding.isType && refNodes.some((ref) => ref !== declaration && isValueRef(ref)));
|
|
87
153
|
if (!valueUsed && !typeRefs.has(binding.local.text))
|
|
88
154
|
continue; // unreferenced
|
|
89
155
|
kept.push({ ...binding, typeOnly: !valueUsed });
|
|
@@ -109,7 +175,10 @@ export const removeUnusedImports = defineCodemod((root) => {
|
|
|
109
175
|
}
|
|
110
176
|
if (specifiers.length)
|
|
111
177
|
leading.push(`{ ${specifiers.join(', ')} }`);
|
|
112
|
-
|
|
178
|
+
// The `;` is part of the import_statement node, so the rewrite must carry it back — preserve the
|
|
179
|
+
// original's terminator (present, or omitted under ASI) rather than dropping it.
|
|
180
|
+
const semi = stmt.node.text.endsWith(';') ? ';' : '';
|
|
181
|
+
stmt.replaceWith(`${asTypeStatement ? 'import type' : 'import'} ${leading.join(', ')} from ${stmt.field('source').text}${semi}`);
|
|
113
182
|
});
|
|
114
183
|
});
|
|
115
184
|
export default removeUnusedImports;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-unused-imports.js","sourceRoot":"","sources":["../src/remove-unused-imports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD
|
|
1
|
+
{"version":3,"file":"remove-unused-imports.js","sourceRoot":"","sources":["../src/remove-unused-imports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,kGAAkG;AAClG,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAA;AACpH,MAAM,SAAS,GAAG,CAAC,IAAY,EAAU,EAAE;IACzC,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACzD,CAAC,CAAA;AAED,yGAAyG;AACzG,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM;IAClE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;CAChF,CAAC,CAAA;AAEF;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,IAAgB;IAC3C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACpC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,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uGAAuG;AACvG,qGAAqG;AACrG,MAAM,CAAC,MAAM,OAAO,GAAgB,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codegraft/rules",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.10",
|
|
4
4
|
"description": "Ready-made Codegraft codemods — ESLint-rule-style transforms (e.g. removeUnusedImports), one rule per module, tree-shakeable.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"node": ">=22.13"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@codegraft/codemod": "0.1.0-beta.
|
|
33
|
-
"@codegraft/core": "0.1.0-beta.
|
|
32
|
+
"@codegraft/codemod": "0.1.0-beta.10",
|
|
33
|
+
"@codegraft/core": "0.1.0-beta.10"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@codegraft/vue": "0.1.0-beta.
|
|
36
|
+
"@codegraft/vue": "0.1.0-beta.10"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -b"
|