ember-eslint-parser 0.3.7 → 0.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-eslint-parser",
3
- "version": "0.3.7",
3
+ "version": "0.4.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "devDependencies": {
21
21
  "@babel/core": "^7.23.6",
22
- "@typescript-eslint/parser": "^6.21.0",
23
- "@typescript-eslint/visitor-keys": "^6.21.0",
22
+ "@typescript-eslint/parser": "^7.1.0",
23
+ "@typescript-eslint/visitor-keys": "^7.1.0",
24
24
  "concurrently": "^8.2.2",
25
25
  "eslint": "^8.0.1",
26
26
  "eslint-config-prettier": "^9.1.0",
@@ -33,7 +33,7 @@
33
33
  "fs-extra": "^11.2.0",
34
34
  "prettier": "^3.2.5",
35
35
  "publint": "^0.2.6",
36
- "release-plan": "^0.7.0",
36
+ "release-plan": "^0.8.0",
37
37
  "typescript": "^5.3.3",
38
38
  "vite": "^5.0.12",
39
39
  "vitest": "^1.2.2"
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@babel/eslint-parser": "7.23.10",
43
43
  "@glimmer/syntax": "^0.88.0",
44
- "@typescript-eslint/scope-manager": "^6.21.0",
44
+ "@typescript-eslint/scope-manager": "^7.1.0",
45
45
  "content-tag": "^1.2.2",
46
46
  "eslint-scope": "^7.2.2",
47
47
  "html-tags": "^3.3.1"
@@ -51,15 +51,15 @@
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@babel/core": "^7.23.6",
54
- "@typescript-eslint/parser": "^6.15.0",
54
+ "@typescript-eslint/parser": "^7.1.0",
55
55
  "typescript": "^5.3.3"
56
56
  },
57
57
  "scripts": {
58
58
  "test": "vitest run",
59
59
  "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
60
- "lint:js": "eslint .",
60
+ "lint:js": "eslint . --max-warnings=0",
61
61
  "lint:package": "pnpm publint",
62
62
  "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
63
- "lint:js:fix": "eslint . --fix"
63
+ "lint:js:fix": "eslint . --fix --max-warnings=0"
64
64
  }
65
65
  }
@@ -566,20 +566,16 @@ module.exports.transformForLint = function transformForLint(code) {
566
566
  */
567
567
  const result = processor.parse(code);
568
568
  for (const tplInfo of result.reverse()) {
569
- const backticks = [...tplInfo.contents].reduce(
570
- (prev, curr) => (prev + (curr.codePointAt(0) === '`') ? 1 : 0),
571
- 0
572
- );
573
- const content = tplInfo.contents.replace(/`/g, '\\`');
569
+ const content = tplInfo.contents.replace(/`/g, '\\`').replace(/\$/g, '\\$');
574
570
  if (tplInfo.type === 'class-member') {
575
571
  const tplLength = tplInfo.range.end - tplInfo.range.start;
576
- const spaces = tplLength - byteLength(content) - 'static{`'.length - '`}'.length - backticks;
572
+ const spaces = tplLength - byteLength(content) - 'static{`'.length - '`}'.length;
577
573
  const total = content + ' '.repeat(spaces);
578
574
  const replacementCode = `static{\`${total}\`}`;
579
575
  jsCode = replaceRange(jsCode, tplInfo.range.start, tplInfo.range.end, replacementCode);
580
576
  } else {
581
577
  const tplLength = tplInfo.range.end - tplInfo.range.start;
582
- const spaces = tplLength - byteLength(content) - '`'.length - '`'.length - backticks;
578
+ const spaces = tplLength - byteLength(content) - '`'.length - '`'.length;
583
579
  const total = content + ' '.repeat(spaces);
584
580
  const replacementCode = `\`${total}\``;
585
581
  jsCode = replaceRange(jsCode, tplInfo.range.start, tplInfo.range.end, replacementCode);
@@ -23,15 +23,19 @@ try {
23
23
  ];
24
24
  },
25
25
  fileExists(fileName) {
26
- return fs.existsSync(fileName.replace(/\.mts$/, '.gts')) || fs.existsSync(fileName);
26
+ return fs.existsSync(fileName.replace(/\.m?ts$/, '.gts')) || fs.existsSync(fileName);
27
27
  },
28
28
  readFile(fname) {
29
29
  let fileName = fname;
30
30
  let content = '';
31
+ if (fileName.endsWith('tsconfig.tsbuildinfo')) {
32
+ return content;
33
+ }
34
+
31
35
  try {
32
36
  content = fs.readFileSync(fileName).toString();
33
37
  } catch {
34
- fileName = fileName.replace(/\.mts$/, '.gts');
38
+ fileName = fileName.replace(/\.m?ts$/, '.gts');
35
39
  content = fs.readFileSync(fileName).toString();
36
40
  }
37
41
  if (fileName.endsWith('.gts')) {
@@ -83,8 +87,8 @@ try {
83
87
  const sourceFiles = program.getSourceFiles();
84
88
  for (const sourceFile of sourceFiles) {
85
89
  // check for deleted gts files, need to remove mts as well
86
- if (sourceFile.path.endsWith('.mts') && sourceFile.isVirtualGts) {
87
- const gtsFile = program.getSourceFile(sourceFile.path.replace(/\.mts$/, '.gts'));
90
+ if (sourceFile.path.match(/\.m?ts$/) && sourceFile.isVirtualGts) {
91
+ const gtsFile = program.getSourceFile(sourceFile.path.replace(/\.m?ts$/, '.gts'));
88
92
  if (!gtsFile) {
89
93
  sourceFile.version = null;
90
94
  }
@@ -93,7 +97,10 @@ try {
93
97
  /**
94
98
  * @type {ts.SourceFile}
95
99
  */
96
- const mtsSourceFile = program.getSourceFile(sourceFile.path.replace(/\.gts$/, '.mts'));
100
+ let mtsSourceFile = program.getSourceFile(sourceFile.path.replace(/\.gts$/, '.mts'));
101
+ if (!mtsSourceFile) {
102
+ mtsSourceFile = program.getSourceFile(sourceFile.path.replace(/\.gts$/, '.ts'));
103
+ }
97
104
  if (mtsSourceFile) {
98
105
  const keep = {
99
106
  fileName: mtsSourceFile.fileName,