@comet/upgrade 1.75.0 → 1.76.0
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.
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stage = void 0;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
exports.stage = "never";
|
|
6
|
+
async function ignoreRestrictedImportsAdmin() {
|
|
7
|
+
const project = new ts_morph_1.Project({ tsConfigFilePath: "./admin/tsconfig.json" });
|
|
8
|
+
const sourceFiles = project.getSourceFiles("admin/src/**/*.tsx");
|
|
9
|
+
for (const sourceFile of sourceFiles) {
|
|
10
|
+
const imports = sourceFile.getImportDeclarations();
|
|
11
|
+
for (const imp of imports) {
|
|
12
|
+
const module = imp.getModuleSpecifierValue();
|
|
13
|
+
if (module === "@mui/material") {
|
|
14
|
+
const namedImports = imp.getNamedImports().map((ni) => ni.getName());
|
|
15
|
+
if (namedImports.includes("Button") || namedImports.includes("Dialog")) {
|
|
16
|
+
// Check for existing comments above
|
|
17
|
+
const statements = imp.getLeadingCommentRanges().map((r) => r.getText());
|
|
18
|
+
const hasEslintComment = statements.some((s) => s.includes("eslint-disable-next-line no-restricted-imports"));
|
|
19
|
+
if (!hasEslintComment) {
|
|
20
|
+
imp.replaceWithText(`// TODO v8: remove eslint-disable-next-line\n// eslint-disable-next-line no-restricted-imports\n${imp.getText()}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
await project.save();
|
|
27
|
+
}
|
|
28
|
+
exports.default = ignoreRestrictedImportsAdmin;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stage = void 0;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
exports.stage = "never";
|
|
6
|
+
async function removeV8EslintDisableCommentsAdmin() {
|
|
7
|
+
const project = new ts_morph_1.Project({ tsConfigFilePath: "./admin/tsconfig.json" });
|
|
8
|
+
const sourceFiles = project.getSourceFiles("admin/src/**/*.tsx");
|
|
9
|
+
for (const sourceFile of sourceFiles) {
|
|
10
|
+
const imports = sourceFile.getImportDeclarations();
|
|
11
|
+
// Store comments to remove as [start, end] tuples
|
|
12
|
+
const commentRangesToRemove = [];
|
|
13
|
+
for (const imp of imports) {
|
|
14
|
+
const leadingComments = imp.getLeadingCommentRanges();
|
|
15
|
+
for (let i = 0; i < leadingComments.length - 1; i++) {
|
|
16
|
+
const first = leadingComments[i];
|
|
17
|
+
const second = leadingComments[i + 1];
|
|
18
|
+
const firstText = first.getText();
|
|
19
|
+
const secondText = second.getText();
|
|
20
|
+
if (firstText.includes("TODO v8: remove eslint-disable-next-line") &&
|
|
21
|
+
secondText.includes("eslint-disable-next-line no-restricted-imports")) {
|
|
22
|
+
// Mark both comments for removal
|
|
23
|
+
commentRangesToRemove.push([second.getPos(), second.getEnd()]);
|
|
24
|
+
commentRangesToRemove.push([first.getPos(), first.getEnd()]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Remove all comments from the file, in reverse order
|
|
29
|
+
commentRangesToRemove
|
|
30
|
+
.sort((a, b) => b[0] - a[0]) // Sort descending by start index
|
|
31
|
+
.forEach(([start, end]) => {
|
|
32
|
+
sourceFile.removeText(start, end);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
await project.save();
|
|
36
|
+
}
|
|
37
|
+
exports.default = removeV8EslintDisableCommentsAdmin;
|