ember-codemod-remove-ember-css-modules 0.2.1 → 0.3.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.
@@ -6,6 +6,7 @@ function analyzeFilePaths(filePaths) {
6
6
  const { dir, ext, name } = parse(filePath);
7
7
  const entityName = join(dir, name);
8
8
  if (entities.has(entityName)) {
9
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9
10
  entities.get(entityName).add(ext);
10
11
  return;
11
12
  }
@@ -310,10 +310,18 @@ function removeLocalClassAttributes(file, data) {
310
310
  return;
311
311
  }
312
312
  node.key = 'class';
313
+ const newValue = transformParam(node.value);
314
+ // @ts-ignore: Assume that types from external packages are correct
315
+ if (newValue.type === 'StringLiteral') {
316
+ node.value = AST.builders.path(
317
+ // @ts-ignore: Assume that types from external packages are correct
318
+ `this.${data.__styles__}.${newValue.value}`);
319
+ return;
320
+ }
313
321
  node.value = AST.builders.sexpr('local-class', [
314
322
  AST.builders.path(`this.${data.__styles__}`),
315
323
  // @ts-ignore: Assume that types from external packages are correct
316
- transformParam(node.value),
324
+ newValue,
317
325
  ]);
318
326
  },
319
327
  });
@@ -25,6 +25,7 @@ export function updateAppAppJs(options) {
25
25
  console.warn('WARNING: updateAppAppJs could not find app.{js,ts} in the app folder. Will skip this step.\n');
26
26
  return;
27
27
  }
28
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
28
29
  const filePath = filePaths[0];
29
30
  const fileExtension = extname(filePath);
30
31
  const data = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-codemod-remove-ember-css-modules",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Codemod to replace ember-css-modules with embroider-css-modules",
5
5
  "keywords": [
6
6
  "codemod",
@@ -41,9 +41,9 @@
41
41
  "eslint": "^8.42.0",
42
42
  "prettier": "^2.8.8",
43
43
  "typescript": "^5.1.3",
44
- "@shared-configs/eslint-config": "0.0.0",
45
- "@shared-configs/typescript": "0.0.0",
46
- "@shared-configs/prettier": "0.0.0"
44
+ "@shared-configs/eslint-config-node": "0.0.0",
45
+ "@shared-configs/prettier": "0.0.0",
46
+ "@shared-configs/typescript": "0.0.0"
47
47
  },
48
48
  "engines": {
49
49
  "node": "16.* || >= 18"