@wise/wds-codemods 0.0.1-experimental-731cdc7 → 0.0.1-experimental-cbae00f
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/.changeset/better-impalas-drop.md +5 -0
- package/.changeset/config.json +13 -0
- package/.changeset/quick-mails-joke.md +128 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/actions/bootstrap/action.yml +49 -0
- package/.github/actions/commitlint/action.yml +27 -0
- package/.github/actions/test/action.yml +23 -0
- package/.github/workflows/cd-cd.yml +127 -0
- package/.github/workflows/renovate.yml +16 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/.nvmrc +1 -0
- package/.prettierignore +1 -0
- package/.prettierrc.js +5 -0
- package/DEVELOPER.md +783 -0
- package/babel.config.js +28 -0
- package/commitlint.config.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +135 -133
- package/dist/index.js.map +1 -1
- package/dist/transforms/button.d.ts +16 -0
- package/dist/transforms/button.js +566 -493
- package/dist/transforms/button.js.map +1 -1
- package/eslint.config.js +15 -0
- package/jest.config.js +9 -0
- package/mkdocs.yml +4 -0
- package/package.json +14 -19
- package/renovate.json +9 -0
- package/scripts/build.sh +10 -0
- package/src/__tests__/runCodemod.test.ts +96 -0
- package/src/index.ts +4 -0
- package/src/runCodemod.ts +88 -0
- package/src/transforms/button/__tests__/button.test.tsx +153 -0
- package/src/transforms/button/button.ts +418 -0
- package/src/transforms/helpers/__tests__/createTestTransform.test.ts +27 -0
- package/src/transforms/helpers/__tests__/hasImport.test.ts +52 -0
- package/src/transforms/helpers/__tests__/iconUtils.test.ts +207 -0
- package/src/transforms/helpers/__tests__/jsxElementUtils.test.ts +130 -0
- package/src/transforms/helpers/__tests__/jsxReportingUtils.test.ts +265 -0
- package/src/transforms/helpers/createTestTransform.ts +18 -0
- package/src/transforms/helpers/hasImport.ts +60 -0
- package/src/transforms/helpers/iconUtils.ts +87 -0
- package/src/transforms/helpers/index.ts +5 -0
- package/src/transforms/helpers/jsxElementUtils.ts +67 -0
- package/src/transforms/helpers/jsxReportingUtils.ts +224 -0
- package/src/utils/__tests__/getOptions.test.ts +170 -0
- package/src/utils/__tests__/handleError.test.ts +18 -0
- package/src/utils/__tests__/loadTransformModules.test.ts +51 -0
- package/src/utils/__tests__/reportManualReview.test.ts +42 -0
- package/src/utils/getOptions.ts +63 -0
- package/src/utils/handleError.ts +6 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/loadTransformModules.ts +28 -0
- package/src/utils/reportManualReview.ts +17 -0
- package/test-button.tsx +230 -0
- package/test-file.js +2 -0
- package/tsconfig.json +14 -0
- package/tsup.config.js +13 -0
- package/dist/reportManualReview-DQ00-OKx.js +0 -50
- package/dist/reportManualReview-DQ00-OKx.js.map +0 -1
|
@@ -1,516 +1,589 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// src/utils/reportManualReview.ts
|
|
2
|
+
import fs from "fs/promises";
|
|
3
|
+
import path from "path";
|
|
4
|
+
var REPORT_PATH = path.resolve(process.cwd(), "codemod-report.txt");
|
|
5
|
+
var reportManualReview = async (filePath, message) => {
|
|
6
|
+
const lineMatch = /at line (\d+)/u.exec(message);
|
|
7
|
+
const lineNumber = lineMatch?.[1];
|
|
8
|
+
const cleanMessage = message.replace(/ at line \d+/u, "");
|
|
9
|
+
const lineInfo = lineNumber ? `:${lineNumber}` : "";
|
|
10
|
+
await fs.appendFile(REPORT_PATH, `[${filePath}${lineInfo}] ${cleanMessage}
|
|
11
|
+
`, "utf8");
|
|
12
|
+
};
|
|
13
|
+
var reportManualReview_default = reportManualReview;
|
|
3
14
|
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Checks if a specific import exists in the given root collection and provides
|
|
7
|
-
* a method to remove it if found.
|
|
8
|
-
*/
|
|
15
|
+
// src/transforms/helpers/hasImport.ts
|
|
9
16
|
function hasImport(root, sourceValue, importName, j) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
const importDeclarations = root.find(j.ImportDeclaration, {
|
|
18
|
+
source: { value: sourceValue }
|
|
19
|
+
});
|
|
20
|
+
if (importDeclarations.size() === 0) {
|
|
21
|
+
return {
|
|
22
|
+
exists: false,
|
|
23
|
+
remove: () => {
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const namedImport = importDeclarations.find(j.ImportSpecifier, {
|
|
28
|
+
imported: { name: importName }
|
|
29
|
+
});
|
|
30
|
+
const defaultImport = importDeclarations.find(j.ImportDefaultSpecifier, {
|
|
31
|
+
local: { name: importName }
|
|
32
|
+
});
|
|
33
|
+
const exists = namedImport.size() > 0 || defaultImport.size() > 0;
|
|
34
|
+
const remove = () => {
|
|
35
|
+
importDeclarations.forEach((path2) => {
|
|
36
|
+
const filteredSpecifiers = path2.node.specifiers?.filter((specifier) => {
|
|
37
|
+
if (specifier.type === "ImportSpecifier" && specifier.imported.name === importName) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (specifier.type === "ImportDefaultSpecifier" && specifier.local?.name === importName) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}) ?? [];
|
|
45
|
+
if (filteredSpecifiers.length === 0) {
|
|
46
|
+
path2.prune();
|
|
47
|
+
} else {
|
|
48
|
+
j(path2).replaceWith(
|
|
49
|
+
j.importDeclaration(filteredSpecifiers, path2.node.source, path2.node.importKind)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
return { exists, remove };
|
|
33
55
|
}
|
|
56
|
+
var hasImport_default = hasImport;
|
|
34
57
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
// src/transforms/helpers/iconUtils.ts
|
|
59
|
+
var processIconChildren = (j, children, iconImports, openingElement) => {
|
|
60
|
+
if (!children || !openingElement.attributes) return;
|
|
61
|
+
const unwrapJsxElement = (node) => {
|
|
62
|
+
if (typeof node === "object" && node !== null && "type" in node && node.type === "JSXExpressionContainer" && j.JSXElement.check(node.expression)) {
|
|
63
|
+
return node.expression;
|
|
64
|
+
}
|
|
65
|
+
return node;
|
|
66
|
+
};
|
|
67
|
+
const totalChildren = children.length;
|
|
68
|
+
const iconChildIndex = children.findIndex((child) => {
|
|
69
|
+
const unwrapped = unwrapJsxElement(child);
|
|
70
|
+
return j.JSXElement.check(unwrapped) && unwrapped.openingElement.name.type === "JSXIdentifier" && iconImports.has(unwrapped.openingElement.name.name);
|
|
71
|
+
});
|
|
72
|
+
if (iconChildIndex === -1) return;
|
|
73
|
+
const iconChild = unwrapJsxElement(children[iconChildIndex]);
|
|
74
|
+
if (!iconChild || iconChild.openingElement.name.type !== "JSXIdentifier") return;
|
|
75
|
+
const iconName = iconChild.openingElement.name.name;
|
|
76
|
+
const distanceToStart = iconChildIndex;
|
|
77
|
+
const distanceToEnd = totalChildren - 1 - iconChildIndex;
|
|
78
|
+
const iconPropName = distanceToStart <= distanceToEnd ? "addonStart" : "addonEnd";
|
|
79
|
+
const iconObject = j.objectExpression([
|
|
80
|
+
j.property("init", j.identifier("type"), j.literal("icon")),
|
|
81
|
+
j.property("init", j.identifier("value"), iconChild)
|
|
82
|
+
]);
|
|
83
|
+
const iconProp = j.jsxAttribute(
|
|
84
|
+
j.jsxIdentifier(iconPropName),
|
|
85
|
+
j.jsxExpressionContainer(iconObject)
|
|
86
|
+
);
|
|
87
|
+
openingElement.attributes.push(iconProp);
|
|
88
|
+
children.splice(iconChildIndex, 1);
|
|
89
|
+
const isWhitespaceJsxText = (node) => {
|
|
90
|
+
return typeof node === "object" && node !== null && node.type === "JSXText" && typeof node.value === "string" && node.value.trim() === "";
|
|
91
|
+
};
|
|
92
|
+
if (iconChildIndex - 1 >= 0 && isWhitespaceJsxText(children[iconChildIndex - 1])) {
|
|
93
|
+
children.splice(iconChildIndex - 1, 1);
|
|
94
|
+
} else if (isWhitespaceJsxText(children[iconChildIndex])) {
|
|
95
|
+
children.splice(iconChildIndex, 1);
|
|
96
|
+
}
|
|
68
97
|
};
|
|
98
|
+
var iconUtils_default = processIconChildren;
|
|
69
99
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (elementName && elementName.type === "JSXIdentifier") return {
|
|
77
|
-
...elementName,
|
|
78
|
-
name: newName
|
|
79
|
-
};
|
|
80
|
-
return elementName;
|
|
100
|
+
// src/transforms/helpers/jsxElementUtils.ts
|
|
101
|
+
var setNameIfJSXIdentifier = (elementName, newName) => {
|
|
102
|
+
if (elementName && elementName.type === "JSXIdentifier") {
|
|
103
|
+
return { ...elementName, name: newName };
|
|
104
|
+
}
|
|
105
|
+
return elementName;
|
|
81
106
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return Array.isArray(attributes) && attributes.some((attr) => attr.type === "JSXAttribute" && attr.name.type === "JSXIdentifier" && attr.name.name === attributeName);
|
|
107
|
+
var hasAttribute = (attributes, attributeName) => {
|
|
108
|
+
return Array.isArray(attributes) && attributes.some(
|
|
109
|
+
(attr) => attr.type === "JSXAttribute" && attr.name.type === "JSXIdentifier" && attr.name.name === attributeName
|
|
110
|
+
);
|
|
87
111
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*/
|
|
91
|
-
const hasAttributeOnElement = (element, attributeName) => {
|
|
92
|
-
return hasAttribute(element.attributes, attributeName);
|
|
112
|
+
var hasAttributeOnElement = (element, attributeName) => {
|
|
113
|
+
return hasAttribute(element.attributes, attributeName);
|
|
93
114
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
115
|
+
var addAttributesIfMissing = (j, openingElement, attributesToAdd) => {
|
|
116
|
+
if (!Array.isArray(openingElement.attributes)) return;
|
|
117
|
+
const attrs = openingElement.attributes;
|
|
118
|
+
attributesToAdd.forEach(({ attribute, name }) => {
|
|
119
|
+
if (!hasAttributeOnElement(openingElement, name)) {
|
|
120
|
+
attrs.push(attribute);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
103
123
|
};
|
|
104
124
|
|
|
105
|
-
|
|
106
|
-
//#region src/transforms/helpers/jsxReportingUtils.ts
|
|
107
|
-
/**
|
|
108
|
-
* CodemodReporter is a utility class for reporting issues found during codemod transformations.
|
|
109
|
-
* It provides methods to report issues related to JSX elements, props, and attributes.
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```typescript
|
|
113
|
-
* const issues: string[] = [];
|
|
114
|
-
* const reporter = createReporter(j, issues);
|
|
115
|
-
*
|
|
116
|
-
* // Report a deprecated prop
|
|
117
|
-
* reporter.reportDeprecatedProp(buttonElement, 'flat', 'variant="text"');
|
|
118
|
-
*
|
|
119
|
-
* // Report complex expression that needs review
|
|
120
|
-
* reporter.reportAmbiguousExpression(element, 'size');
|
|
121
|
-
*
|
|
122
|
-
* // Auto-detect common issues
|
|
123
|
-
* reporter.reportAttributeIssues(element);
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
125
|
+
// src/transforms/helpers/jsxReportingUtils.ts
|
|
126
126
|
var CodemodReporter = class {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
127
|
+
j;
|
|
128
|
+
issues;
|
|
129
|
+
constructor(options) {
|
|
130
|
+
this.j = options.jscodeshift;
|
|
131
|
+
this.issues = options.issues;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Reports an issue with a JSX element
|
|
135
|
+
*/
|
|
136
|
+
reportElement(element, reason) {
|
|
137
|
+
const node = this.getNode(element);
|
|
138
|
+
const componentName = this.getComponentName(node);
|
|
139
|
+
const line = this.getLineNumber(node);
|
|
140
|
+
this.addIssue(`Manual review required: <${componentName}> at line ${line} ${reason}.`);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Reports an issue with a specific prop
|
|
144
|
+
*/
|
|
145
|
+
reportProp(element, propName, reason) {
|
|
146
|
+
const node = this.getNode(element);
|
|
147
|
+
const componentName = this.getComponentName(node);
|
|
148
|
+
const line = this.getLineNumber(node);
|
|
149
|
+
this.addIssue(
|
|
150
|
+
`Manual review required: prop "${propName}" on <${componentName}> at line ${line} ${reason}.`
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Reports an issue with a JSX attribute directly
|
|
155
|
+
*/
|
|
156
|
+
reportAttribute(attr, element, reason) {
|
|
157
|
+
const node = this.getNode(element);
|
|
158
|
+
const componentName = this.getComponentName(node);
|
|
159
|
+
const propName = this.getAttributeName(attr);
|
|
160
|
+
const line = this.getLineNumber(attr) || this.getLineNumber(node);
|
|
161
|
+
const defaultReason = this.getAttributeReason(attr);
|
|
162
|
+
const finalReason = reason || defaultReason;
|
|
163
|
+
this.addIssue(
|
|
164
|
+
`Manual review required: prop "${propName}" on <${componentName}> at line ${line} ${finalReason}.`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Reports spread props on an element
|
|
169
|
+
*/
|
|
170
|
+
reportSpreadProps(element) {
|
|
171
|
+
this.reportElement(element, "contains spread props that need manual review");
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Reports conflicting prop and children
|
|
175
|
+
*/
|
|
176
|
+
reportPropWithChildren(element, propName) {
|
|
177
|
+
this.reportProp(
|
|
178
|
+
element,
|
|
179
|
+
propName,
|
|
180
|
+
`conflicts with children - both "${propName}" prop and children are present`
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Reports unsupported prop value
|
|
185
|
+
*/
|
|
186
|
+
reportUnsupportedValue(element, propName, value) {
|
|
187
|
+
this.reportProp(element, propName, `has unsupported value "${value}"`);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Reports ambiguous expression in prop
|
|
191
|
+
*/
|
|
192
|
+
reportAmbiguousExpression(element, propName) {
|
|
193
|
+
this.reportProp(element, propName, "contains a complex expression that needs manual review");
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Reports ambiguous children (like dynamic icons)
|
|
197
|
+
*/
|
|
198
|
+
reportAmbiguousChildren(element, childType = "content") {
|
|
199
|
+
this.reportElement(element, `contains ambiguous ${childType} that needs manual review`);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Reports deprecated prop usage
|
|
203
|
+
*/
|
|
204
|
+
reportDeprecatedProp(element, propName, alternative) {
|
|
205
|
+
const suggestion = alternative ? ` Use ${alternative} instead` : "";
|
|
206
|
+
this.reportProp(element, propName, `is deprecated${suggestion}`);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Reports missing required prop
|
|
210
|
+
*/
|
|
211
|
+
reportMissingRequiredProp(element, propName) {
|
|
212
|
+
this.reportProp(element, propName, "is required but missing");
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Reports conflicting props
|
|
216
|
+
*/
|
|
217
|
+
reportConflictingProps(element, propNames) {
|
|
218
|
+
const propList = propNames.map((name) => `"${name}"`).join(", ");
|
|
219
|
+
this.reportElement(element, `has conflicting props: ${propList} cannot be used together`);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Auto-detects and reports common attribute issues
|
|
223
|
+
*/
|
|
224
|
+
reportAttributeIssues(element) {
|
|
225
|
+
const node = this.getNode(element);
|
|
226
|
+
const { attributes } = node.openingElement;
|
|
227
|
+
if (!attributes) return;
|
|
228
|
+
if (attributes.some((attr) => attr.type === "JSXSpreadAttribute")) {
|
|
229
|
+
this.reportSpreadProps(element);
|
|
230
|
+
}
|
|
231
|
+
attributes.forEach((attr) => {
|
|
232
|
+
if (attr.type === "JSXAttribute" && attr.value?.type === "JSXExpressionContainer") {
|
|
233
|
+
this.reportAttribute(attr, element);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
// Private helper methods
|
|
238
|
+
getNode(element) {
|
|
239
|
+
return "node" in element ? element.node : element;
|
|
240
|
+
}
|
|
241
|
+
getComponentName(node) {
|
|
242
|
+
const { name } = node.openingElement;
|
|
243
|
+
if (name.type === "JSXIdentifier") {
|
|
244
|
+
return name.name;
|
|
245
|
+
}
|
|
246
|
+
return this.j(name).toSource();
|
|
247
|
+
}
|
|
248
|
+
getLineNumber(node) {
|
|
249
|
+
return node.loc?.start.line?.toString() || "unknown";
|
|
250
|
+
}
|
|
251
|
+
getAttributeName(attr) {
|
|
252
|
+
if (attr.name.type === "JSXIdentifier") {
|
|
253
|
+
return attr.name.name;
|
|
254
|
+
}
|
|
255
|
+
return this.j(attr.name).toSource();
|
|
256
|
+
}
|
|
257
|
+
getAttributeReason(attr) {
|
|
258
|
+
if (!attr.value) return "has no value";
|
|
259
|
+
if (attr.value.type === "JSXExpressionContainer") {
|
|
260
|
+
const expr = attr.value.expression;
|
|
261
|
+
const expressionType = expr.type.replace("Expression", "").toLowerCase();
|
|
262
|
+
if (expr.type === "Identifier" || expr.type === "MemberExpression") {
|
|
263
|
+
const valueText = this.j(expr).toSource();
|
|
264
|
+
return `contains a ${expressionType} (${valueText})`;
|
|
265
|
+
}
|
|
266
|
+
return `contains a complex ${expressionType} expression`;
|
|
267
|
+
}
|
|
268
|
+
return "needs manual review";
|
|
269
|
+
}
|
|
270
|
+
addIssue(message) {
|
|
271
|
+
this.issues.push(message);
|
|
272
|
+
}
|
|
256
273
|
};
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
jscodeshift: j,
|
|
260
|
-
issues
|
|
261
|
-
});
|
|
274
|
+
var createReporter = (j, issues) => {
|
|
275
|
+
return new CodemodReporter({ jscodeshift: j, issues });
|
|
262
276
|
};
|
|
263
277
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
278
|
+
// src/transforms/button/button.ts
|
|
279
|
+
var parser = "tsx";
|
|
280
|
+
var priorityMapping = {
|
|
281
|
+
accent: {
|
|
282
|
+
primary: "primary",
|
|
283
|
+
secondary: "secondary-neutral",
|
|
284
|
+
tertiary: "tertiary"
|
|
285
|
+
},
|
|
286
|
+
positive: {
|
|
287
|
+
primary: "primary",
|
|
288
|
+
secondary: "secondary-neutral",
|
|
289
|
+
tertiary: "secondary-neutral"
|
|
290
|
+
},
|
|
291
|
+
negative: {
|
|
292
|
+
primary: "primary",
|
|
293
|
+
secondary: "secondary",
|
|
294
|
+
tertiary: "secondary"
|
|
295
|
+
}
|
|
283
296
|
};
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
297
|
+
var sizeMap = {
|
|
298
|
+
EXTRA_SMALL: "xs",
|
|
299
|
+
SMALL: "sm",
|
|
300
|
+
MEDIUM: "md",
|
|
301
|
+
LARGE: "lg",
|
|
302
|
+
EXTRA_LARGE: "xl",
|
|
303
|
+
xs: "sm",
|
|
304
|
+
sm: "sm",
|
|
305
|
+
md: "md",
|
|
306
|
+
lg: "lg",
|
|
307
|
+
xl: "xl"
|
|
295
308
|
};
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
309
|
+
var resolveSize = (size) => {
|
|
310
|
+
if (!size) return size;
|
|
311
|
+
const match = /^Size\.(EXTRA_SMALL|SMALL|MEDIUM|LARGE|EXTRA_LARGE)$/u.exec(size);
|
|
312
|
+
if (match) {
|
|
313
|
+
return sizeMap[match[1]];
|
|
314
|
+
}
|
|
315
|
+
return sizeMap[size] || size;
|
|
301
316
|
};
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
317
|
+
var resolvePriority = (type, priority) => {
|
|
318
|
+
if (type && priority) {
|
|
319
|
+
return priorityMapping[type]?.[priority] || priority;
|
|
320
|
+
}
|
|
321
|
+
return priority;
|
|
305
322
|
};
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
323
|
+
var resolveType = (type, htmlType) => {
|
|
324
|
+
if (htmlType) {
|
|
325
|
+
return htmlType;
|
|
326
|
+
}
|
|
327
|
+
const legacyButtonTypes = [
|
|
328
|
+
"accent",
|
|
329
|
+
"negative",
|
|
330
|
+
"positive",
|
|
331
|
+
"primary",
|
|
332
|
+
"pay",
|
|
333
|
+
"secondary",
|
|
334
|
+
"danger",
|
|
335
|
+
"link"
|
|
336
|
+
];
|
|
337
|
+
return type && legacyButtonTypes.includes(type) ? type : null;
|
|
319
338
|
};
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
339
|
+
var convertEnumValue = (value) => {
|
|
340
|
+
if (!value) return value;
|
|
341
|
+
const strippedValue = value.replace(/^['"]|['"]$/gu, "");
|
|
342
|
+
const enumMapping = {
|
|
343
|
+
"Priority.SECONDARY": "secondary",
|
|
344
|
+
"Priority.PRIMARY": "primary",
|
|
345
|
+
"Priority.TERTIARY": "tertiary",
|
|
346
|
+
"ControlType.NEGATIVE": "negative",
|
|
347
|
+
"ControlType.POSITIVE": "positive",
|
|
348
|
+
"ControlType.ACCENT": "accent"
|
|
349
|
+
};
|
|
350
|
+
return enumMapping[strippedValue] || strippedValue;
|
|
332
351
|
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
352
|
+
var transformer = (file, api, options) => {
|
|
353
|
+
const j = api.jscodeshift;
|
|
354
|
+
const root = j(file.source);
|
|
355
|
+
const manualReviewIssues = [];
|
|
356
|
+
const reporter = createReporter(j, manualReviewIssues);
|
|
357
|
+
const { exists: hasButtonImport } = hasImport_default(root, "@transferwise/components", "Button", j);
|
|
358
|
+
const { exists: hasActionButtonImport, remove: removeActionButtonImport } = hasImport_default(
|
|
359
|
+
root,
|
|
360
|
+
"@transferwise/components",
|
|
361
|
+
"ActionButton",
|
|
362
|
+
j
|
|
363
|
+
);
|
|
364
|
+
const iconImports = /* @__PURE__ */ new Set();
|
|
365
|
+
root.find(j.ImportDeclaration, { source: { value: "@transferwise/icons" } }).forEach((path2) => {
|
|
366
|
+
path2.node.specifiers?.forEach((specifier) => {
|
|
367
|
+
if ((specifier.type === "ImportDefaultSpecifier" || specifier.type === "ImportSpecifier") && specifier.local) {
|
|
368
|
+
const localName = specifier.local.name;
|
|
369
|
+
iconImports.add(localName);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
if (hasActionButtonImport) {
|
|
374
|
+
root.findJSXElements("ActionButton").forEach((path2) => {
|
|
375
|
+
const { openingElement, closingElement } = path2.node;
|
|
376
|
+
openingElement.name = setNameIfJSXIdentifier(openingElement.name, "Button");
|
|
377
|
+
if (closingElement) {
|
|
378
|
+
closingElement.name = setNameIfJSXIdentifier(closingElement.name, "Button");
|
|
379
|
+
}
|
|
380
|
+
addAttributesIfMissing(j, openingElement, [
|
|
381
|
+
{ attribute: j.jsxAttribute(j.jsxIdentifier("v2")), name: "v2" },
|
|
382
|
+
{ attribute: j.jsxAttribute(j.jsxIdentifier("size"), j.literal("sm")), name: "size" }
|
|
383
|
+
]);
|
|
384
|
+
iconUtils_default(j, path2.node.children, iconImports, openingElement);
|
|
385
|
+
if ((openingElement.attributes ?? []).some((attr) => attr.type === "JSXSpreadAttribute")) {
|
|
386
|
+
reporter.reportSpreadProps(path2);
|
|
387
|
+
}
|
|
388
|
+
const legacyPropNames = ["priority", "text"];
|
|
389
|
+
const legacyProps = {};
|
|
390
|
+
openingElement.attributes?.forEach((attr) => {
|
|
391
|
+
if (attr.type === "JSXAttribute" && attr.name && attr.name.type === "JSXIdentifier") {
|
|
392
|
+
const { name } = attr.name;
|
|
393
|
+
if (legacyPropNames.includes(name)) {
|
|
394
|
+
if (attr.value) {
|
|
395
|
+
if (attr.value.type === "StringLiteral") {
|
|
396
|
+
legacyProps[name] = attr.value.value;
|
|
397
|
+
} else if (attr.value.type === "JSXExpressionContainer") {
|
|
398
|
+
reporter.reportAttribute(attr, path2);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
const hasTextProp = openingElement.attributes?.some(
|
|
405
|
+
(attr) => attr.type === "JSXAttribute" && attr.name.type === "JSXIdentifier" && attr.name.name === "text"
|
|
406
|
+
);
|
|
407
|
+
const hasChildren = path2.node.children?.some(
|
|
408
|
+
(child) => child.type === "JSXText" && child.value.trim() !== "" || child.type === "JSXElement" || child.type === "JSXExpressionContainer"
|
|
409
|
+
);
|
|
410
|
+
if (hasTextProp && hasChildren) {
|
|
411
|
+
reporter.reportPropWithChildren(path2, "text");
|
|
412
|
+
}
|
|
413
|
+
(path2.node.children || []).forEach((child) => {
|
|
414
|
+
if (child.type === "JSXExpressionContainer") {
|
|
415
|
+
const expr = child.expression;
|
|
416
|
+
if (expr.type === "ConditionalExpression" || expr.type === "CallExpression" || expr.type === "Identifier" || expr.type === "MemberExpression") {
|
|
417
|
+
reporter.reportAmbiguousChildren(path2, "icon");
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
removeActionButtonImport();
|
|
423
|
+
}
|
|
424
|
+
if (hasButtonImport) {
|
|
425
|
+
root.findJSXElements("Button").forEach((path2) => {
|
|
426
|
+
const { openingElement } = path2.node;
|
|
427
|
+
if (hasAttributeOnElement(openingElement, "v2")) return;
|
|
428
|
+
addAttributesIfMissing(j, openingElement, [
|
|
429
|
+
{ attribute: j.jsxAttribute(j.jsxIdentifier("v2")), name: "v2" }
|
|
430
|
+
]);
|
|
431
|
+
iconUtils_default(j, path2.node.children, iconImports, openingElement);
|
|
432
|
+
const legacyProps = {};
|
|
433
|
+
const legacyPropNames = ["priority", "size", "type", "htmlType", "sentiment"];
|
|
434
|
+
openingElement.attributes?.forEach((attr) => {
|
|
435
|
+
if (attr.type === "JSXAttribute" && attr.name && attr.name.type === "JSXIdentifier") {
|
|
436
|
+
const { name } = attr.name;
|
|
437
|
+
if (legacyPropNames.includes(name)) {
|
|
438
|
+
if (attr.value) {
|
|
439
|
+
if (attr.value.type === "StringLiteral") {
|
|
440
|
+
legacyProps[name] = attr.value.value;
|
|
441
|
+
} else if (attr.value.type === "JSXExpressionContainer") {
|
|
442
|
+
legacyProps[name] = convertEnumValue(String(j(attr.value.expression).toSource()));
|
|
443
|
+
}
|
|
444
|
+
} else {
|
|
445
|
+
legacyProps[name] = void 0;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
if (openingElement.attributes) {
|
|
451
|
+
openingElement.attributes = openingElement.attributes.filter(
|
|
452
|
+
(attr) => !(attr.type === "JSXAttribute" && attr.name && legacyPropNames.includes(attr.name.name))
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
if ("size" in legacyProps) {
|
|
456
|
+
const rawValue = legacyProps.size;
|
|
457
|
+
const resolved = resolveSize(rawValue);
|
|
458
|
+
const supportedSizes = ["xs", "sm", "md", "lg", "xl"];
|
|
459
|
+
if (typeof rawValue === "string" && typeof resolved === "string" && supportedSizes.includes(resolved)) {
|
|
460
|
+
openingElement.attributes?.push(
|
|
461
|
+
j.jsxAttribute(j.jsxIdentifier("size"), j.literal(resolved))
|
|
462
|
+
);
|
|
463
|
+
} else if (typeof rawValue === "string") {
|
|
464
|
+
reporter.reportUnsupportedValue(path2, "size", rawValue);
|
|
465
|
+
} else if (rawValue !== void 0) {
|
|
466
|
+
reporter.reportAmbiguousExpression(path2, "size");
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
if ("priority" in legacyProps) {
|
|
470
|
+
const rawValue = legacyProps.priority;
|
|
471
|
+
const converted = convertEnumValue(rawValue);
|
|
472
|
+
const mapped = resolvePriority(legacyProps.type, converted);
|
|
473
|
+
const supportedPriorities = ["primary", "secondary", "tertiary", "secondary-neutral"];
|
|
474
|
+
if (typeof rawValue === "string" && typeof mapped === "string" && supportedPriorities.includes(mapped)) {
|
|
475
|
+
openingElement.attributes?.push(
|
|
476
|
+
j.jsxAttribute(j.jsxIdentifier("priority"), j.literal(mapped))
|
|
477
|
+
);
|
|
478
|
+
} else if (typeof rawValue === "string") {
|
|
479
|
+
reporter.reportUnsupportedValue(path2, "priority", rawValue);
|
|
480
|
+
} else if (rawValue !== void 0) {
|
|
481
|
+
reporter.reportAmbiguousExpression(path2, "priority");
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if ("type" in legacyProps || "htmlType" in legacyProps) {
|
|
485
|
+
const rawType = legacyProps.type;
|
|
486
|
+
const rawHtmlType = legacyProps.htmlType;
|
|
487
|
+
const resolvedType = typeof rawType === "string" ? rawType : rawType && typeof rawType === "object" ? convertEnumValue(j(rawType).toSource()) : void 0;
|
|
488
|
+
const resolved = resolveType(resolvedType, rawHtmlType);
|
|
489
|
+
const supportedTypes = [
|
|
490
|
+
"accent",
|
|
491
|
+
"negative",
|
|
492
|
+
"positive",
|
|
493
|
+
"primary",
|
|
494
|
+
"pay",
|
|
495
|
+
"secondary",
|
|
496
|
+
"danger",
|
|
497
|
+
"link",
|
|
498
|
+
"submit",
|
|
499
|
+
"button",
|
|
500
|
+
"reset"
|
|
501
|
+
];
|
|
502
|
+
if (typeof resolved === "string" && supportedTypes.includes(resolved)) {
|
|
503
|
+
openingElement.attributes?.push(
|
|
504
|
+
j.jsxAttribute(j.jsxIdentifier("type"), j.literal(resolved))
|
|
505
|
+
);
|
|
506
|
+
if (resolved === "negative") {
|
|
507
|
+
openingElement.attributes?.push(
|
|
508
|
+
j.jsxAttribute(j.jsxIdentifier("sentiment"), j.literal("negative"))
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
} else if (typeof rawType === "string" || typeof rawHtmlType === "string") {
|
|
512
|
+
reporter.reportUnsupportedValue(path2, "type", rawType ?? rawHtmlType ?? "");
|
|
513
|
+
} else if (rawType !== void 0 || rawHtmlType !== void 0) {
|
|
514
|
+
reporter.reportAmbiguousExpression(path2, "type");
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if ("sentiment" in legacyProps) {
|
|
518
|
+
const rawValue = legacyProps.sentiment;
|
|
519
|
+
if (rawValue === "negative") {
|
|
520
|
+
openingElement.attributes?.push(
|
|
521
|
+
j.jsxAttribute(j.jsxIdentifier("sentiment"), j.literal("negative"))
|
|
522
|
+
);
|
|
523
|
+
} else if (typeof rawValue === "string") {
|
|
524
|
+
reporter.reportUnsupportedValue(path2, "sentiment", rawValue);
|
|
525
|
+
} else if (rawValue !== void 0) {
|
|
526
|
+
reporter.reportAmbiguousExpression(path2, "sentiment");
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
let asIndex = -1;
|
|
530
|
+
let asValue = null;
|
|
531
|
+
let hrefExists = false;
|
|
532
|
+
let asAmbiguous = false;
|
|
533
|
+
let hrefAmbiguous = false;
|
|
534
|
+
openingElement.attributes?.forEach((attr, index) => {
|
|
535
|
+
if (attr.type === "JSXAttribute" && attr.name) {
|
|
536
|
+
if (attr.name.name === "as") {
|
|
537
|
+
if (attr.value) {
|
|
538
|
+
if (attr.value.type === "StringLiteral") {
|
|
539
|
+
asValue = attr.value.value;
|
|
540
|
+
} else if (attr.value.type === "JSXExpressionContainer") {
|
|
541
|
+
asAmbiguous = true;
|
|
542
|
+
reporter.reportAttribute(attr, path2);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
asIndex = index;
|
|
546
|
+
}
|
|
547
|
+
if (attr.name.name === "href") {
|
|
548
|
+
hrefExists = true;
|
|
549
|
+
if (attr.value && attr.value.type !== "StringLiteral") {
|
|
550
|
+
hrefAmbiguous = true;
|
|
551
|
+
reporter.reportAttribute(attr, path2);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
if (asValue && asValue !== "a") {
|
|
557
|
+
reporter.reportUnsupportedValue(path2, "as", asValue);
|
|
558
|
+
}
|
|
559
|
+
if (asValue === "a") {
|
|
560
|
+
if (asIndex !== -1) {
|
|
561
|
+
openingElement.attributes = openingElement.attributes?.filter(
|
|
562
|
+
(_, idx) => idx !== asIndex
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
if (!hrefExists) {
|
|
566
|
+
openingElement.attributes = [
|
|
567
|
+
...openingElement.attributes ?? [],
|
|
568
|
+
j.jsxAttribute(j.jsxIdentifier("href"), j.literal("#"))
|
|
569
|
+
];
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
if ((openingElement.attributes ?? []).some((attr) => attr.type === "JSXSpreadAttribute")) {
|
|
573
|
+
reporter.reportSpreadProps(path2);
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
if (manualReviewIssues.length > 0) {
|
|
578
|
+
manualReviewIssues.forEach(async (issue) => {
|
|
579
|
+
await reportManualReview_default(file.path, issue);
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
return root.toSource();
|
|
583
|
+
};
|
|
584
|
+
var button_default = transformer;
|
|
585
|
+
export {
|
|
586
|
+
button_default as default,
|
|
587
|
+
parser
|
|
511
588
|
};
|
|
512
|
-
|
|
513
|
-
//#endregion
|
|
514
|
-
exports.default = transformer;
|
|
515
|
-
exports.parser = parser;
|
|
516
589
|
//# sourceMappingURL=button.js.map
|