ember-codemod-remove-ember-css-modules 4.1.6 → 4.1.7
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.
|
@@ -53,7 +53,7 @@ function importStylesInClass(file, data) {
|
|
|
53
53
|
if (!lastImportDeclarationPath) {
|
|
54
54
|
lastImportDeclarationPath = path;
|
|
55
55
|
// @ts-expect-error: Incorrect type
|
|
56
|
-
//
|
|
56
|
+
// oxlint-disable-next-line typescript/no-unsafe-member-access
|
|
57
57
|
}
|
|
58
58
|
else if (path.node.start > lastImportDeclarationPath.node.start) {
|
|
59
59
|
lastImportDeclarationPath = path;
|
|
@@ -63,12 +63,12 @@ function importStylesInClass(file, data) {
|
|
|
63
63
|
});
|
|
64
64
|
// Append the styles import
|
|
65
65
|
// @ts-expect-error: Incorrect type
|
|
66
|
-
//
|
|
66
|
+
// oxlint-disable-next-line typescript/no-unsafe-assignment, typescript/no-unsafe-member-access
|
|
67
67
|
const nodes = ast.program.body;
|
|
68
68
|
// @ts-expect-error: Incorrect type
|
|
69
|
-
//
|
|
69
|
+
// oxlint-disable-next-line typescript/no-unsafe-assignment
|
|
70
70
|
const index = lastImportDeclarationPath?.name ?? -1;
|
|
71
|
-
//
|
|
71
|
+
// oxlint-disable-next-line typescript/no-unsafe-call, typescript/no-unsafe-member-access
|
|
72
72
|
nodes.splice(index + 1, 0, AST.builders.importDeclaration([AST.builders.importDefaultSpecifier(AST.builders.identifier('styles'))], AST.builders.literal(`./${data.fileName}.css`)));
|
|
73
73
|
return AST.print(ast);
|
|
74
74
|
}
|
|
@@ -85,22 +85,22 @@ function removeLocalClassHelpers(file) {
|
|
|
85
85
|
*/
|
|
86
86
|
function canRemoveLocalClassHelper(path) {
|
|
87
87
|
// @ts-expect-error: Incorrect type
|
|
88
|
-
//
|
|
88
|
+
// oxlint-disable-next-line typescript/no-unsafe-assignment, typescript/no-unsafe-call, typescript/no-unsafe-member-access
|
|
89
89
|
const hasFromArgument = path.hash.pairs.some((pair) => pair.key === 'from');
|
|
90
90
|
if (hasFromArgument) {
|
|
91
91
|
throw new RangeError(`Unable to handle the {{local-class}} helper's \`from\` key. See lines ${path.loc.start.line}-${path.loc.end.line}.`);
|
|
92
92
|
}
|
|
93
93
|
// @ts-expect-error: Incorrect type
|
|
94
|
-
//
|
|
94
|
+
// oxlint-disable-next-line typescript/no-unsafe-assignment, typescript/no-unsafe-member-access
|
|
95
95
|
const param = path.params[0];
|
|
96
96
|
if (param === undefined) {
|
|
97
97
|
return true;
|
|
98
98
|
}
|
|
99
|
-
//
|
|
99
|
+
// oxlint-disable-next-line typescript/no-unsafe-member-access
|
|
100
100
|
if (param.type !== 'StringLiteral') {
|
|
101
101
|
return false;
|
|
102
102
|
}
|
|
103
|
-
//
|
|
103
|
+
// oxlint-disable-next-line typescript/no-unsafe-assignment, typescript/no-unsafe-call, typescript/no-unsafe-member-access
|
|
104
104
|
const value = param.value.trim();
|
|
105
105
|
return value === '';
|
|
106
106
|
}
|
|
@@ -120,24 +120,24 @@ function removeLocalClassHelpers(file) {
|
|
|
120
120
|
return null;
|
|
121
121
|
}
|
|
122
122
|
// @ts-expect-error: Incorrect type
|
|
123
|
-
//
|
|
123
|
+
// oxlint-disable-next-line typescript/no-unsafe-assignment, typescript/no-unsafe-member-access
|
|
124
124
|
const param = node.value.params[0];
|
|
125
|
-
//
|
|
125
|
+
// oxlint-disable-next-line typescript/no-unsafe-member-access
|
|
126
126
|
if (param.type !== 'StringLiteral') {
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
|
-
//
|
|
129
|
+
// oxlint-disable-next-line typescript/no-unsafe-assignment, typescript/no-unsafe-call, typescript/no-unsafe-member-access
|
|
130
130
|
const localClassNames = param.value.trim().split(/\s+/);
|
|
131
|
-
//
|
|
131
|
+
// oxlint-disable-next-line typescript/no-unsafe-member-access
|
|
132
132
|
if (localClassNames.length === 1) {
|
|
133
133
|
node.value = AST.builders.mustache(
|
|
134
|
-
//
|
|
134
|
+
// oxlint-disable-next-line typescript/no-unsafe-member-access
|
|
135
135
|
AST.builders.path(`this.styles.${localClassNames[0]}`));
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
node.value = AST.builders.mustache(AST.builders.path('local'), [
|
|
139
139
|
AST.builders.path('this.styles'),
|
|
140
|
-
//
|
|
140
|
+
// oxlint-disable-next-line typescript/no-unsafe-assignment, typescript/no-unsafe-call, typescript/no-unsafe-member-access
|
|
141
141
|
...localClassNames.map(AST.builders.string),
|
|
142
142
|
]);
|
|
143
143
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-codemod-remove-ember-css-modules",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.7",
|
|
4
4
|
"description": "Codemod to replace ember-css-modules with embroider-css-modules",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemod",
|
|
@@ -19,28 +19,32 @@
|
|
|
19
19
|
"author": "Isaac J. Lee",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"main": "dist/src/index.js",
|
|
22
|
+
"bin": {
|
|
23
|
+
"ember-codemod-remove-ember-css-modules": "dist/bin/ember-codemod-remove-ember-css-modules.js"
|
|
24
|
+
},
|
|
22
25
|
"files": [
|
|
23
26
|
"dist"
|
|
24
27
|
],
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@codemod-utils/ast-javascript": "^4.3.
|
|
27
|
-
"@codemod-utils/ast-template": "^4.1.
|
|
28
|
-
"@codemod-utils/blueprints": "^3.2.
|
|
29
|
-
"@codemod-utils/ember": "^4.2.
|
|
30
|
-
"@codemod-utils/files": "^4.1.
|
|
31
|
-
"@codemod-utils/package-json": "^4.1.
|
|
29
|
+
"@codemod-utils/ast-javascript": "^4.3.5",
|
|
30
|
+
"@codemod-utils/ast-template": "^4.1.2",
|
|
31
|
+
"@codemod-utils/blueprints": "^3.2.1",
|
|
32
|
+
"@codemod-utils/ember": "^4.2.1",
|
|
33
|
+
"@codemod-utils/files": "^4.1.2",
|
|
34
|
+
"@codemod-utils/package-json": "^4.1.4",
|
|
32
35
|
"yargs": "^18.2.0"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
|
-
"@codemod-utils/tests": "^3.3.
|
|
36
|
-
"@shared-configs/
|
|
38
|
+
"@codemod-utils/tests": "^3.3.1",
|
|
39
|
+
"@shared-configs/oxlint-node": "0.0.0",
|
|
37
40
|
"@shared-configs/prettier": "0.0.0",
|
|
38
41
|
"@shared-configs/typescript": "0.0.0",
|
|
39
|
-
"@types/node": "^22.20.
|
|
42
|
+
"@types/node": "^22.20.5",
|
|
40
43
|
"@types/yargs": "^17.0.35",
|
|
41
|
-
"concurrently": "^10.0.
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
+
"concurrently": "^10.0.6",
|
|
45
|
+
"oxlint": "^1.88.0",
|
|
46
|
+
"oxlint-tsgolint": "^7.0.2004",
|
|
47
|
+
"prettier": "^3.9.10",
|
|
44
48
|
"typescript": "^6.0.3"
|
|
45
49
|
},
|
|
46
50
|
"engines": {
|
|
@@ -52,12 +56,9 @@
|
|
|
52
56
|
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
|
|
53
57
|
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\" && pnpm format",
|
|
54
58
|
"lint:format": "prettier . --cache --check",
|
|
55
|
-
"lint:js": "
|
|
56
|
-
"lint:js:fix": "
|
|
59
|
+
"lint:js": "oxlint",
|
|
60
|
+
"lint:js:fix": "oxlint --fix",
|
|
57
61
|
"lint:types": "tsc --noEmit",
|
|
58
62
|
"test": "sh build.sh --test && mt dist-for-testing --quiet"
|
|
59
|
-
},
|
|
60
|
-
"bin": {
|
|
61
|
-
"ember-codemod-remove-ember-css-modules": "dist/bin/ember-codemod-remove-ember-css-modules.js"
|
|
62
63
|
}
|
|
63
64
|
}
|