ember-codemod-remove-ember-css-modules 0.2.1 → 0.3.1

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
@@ -4,6 +4,17 @@
4
4
 
5
5
  _Codemod to replace `ember-css-modules` with `embroider-css-modules`_
6
6
 
7
+ 1. [Features](#features)
8
+ 1. [Usage](#usage)
9
+ - [Arguments](#arguments)
10
+ - [Limitations](#limitations)
11
+ 1. [How to refactor code](#how-to-refactor-code)
12
+ - [Remove code inheritance](#remove-code-inheritance)
13
+ - [Remove complex string concatenations](#remove-complex-string-concatenations)
14
+ 1. [Compatibility](#compatibility)
15
+ 1. [Contributing](#contributing)
16
+ 1. [License](#license)
17
+
7
18
 
8
19
  ## Features
9
20
 
@@ -217,7 +228,7 @@ The codemod may fail to update complex expressions. Refactor templates to provid
217
228
 
218
229
  ## Compatibility
219
230
 
220
- * Node.js v16 or above
231
+ - Node.js v16 or above
221
232
 
222
233
 
223
234
  ## Contributing
@@ -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.1",
4
4
  "description": "Codemod to replace ember-css-modules with embroider-css-modules",
5
5
  "keywords": [
6
6
  "codemod",
@@ -38,12 +38,12 @@
38
38
  "@types/node": "^16.11.7",
39
39
  "@types/yargs": "^17.0.24",
40
40
  "concurrently": "^8.2.0",
41
- "eslint": "^8.42.0",
41
+ "eslint": "^8.43.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/prettier": "0.0.0",
45
+ "@shared-configs/eslint-config-node": "0.0.0",
46
+ "@shared-configs/typescript": "0.0.0"
47
47
  },
48
48
  "engines": {
49
49
  "node": "16.* || >= 18"