ember-eslint-parser 0.5.4 → 0.5.6
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 +17 -15
- package/src/parser/transforms.js +22 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-eslint-parser",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {
|
|
@@ -17,6 +17,15 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"src"
|
|
19
19
|
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@babel/eslint-parser": "^7.23.10",
|
|
22
|
+
"@glimmer/syntax": "^0.92.0",
|
|
23
|
+
"content-tag": "^2.0.1",
|
|
24
|
+
"eslint-scope": "^7.2.2",
|
|
25
|
+
"html-tags": "^3.3.1",
|
|
26
|
+
"mathml-tag-names": "^2.1.3",
|
|
27
|
+
"svg-tags": "^1.0.0"
|
|
28
|
+
},
|
|
20
29
|
"devDependencies": {
|
|
21
30
|
"@babel/core": "^7.23.6",
|
|
22
31
|
"@typescript-eslint/parser": "^7.1.0",
|
|
@@ -34,21 +43,11 @@
|
|
|
34
43
|
"fs-extra": "^11.2.0",
|
|
35
44
|
"prettier": "^3.2.5",
|
|
36
45
|
"publint": "^0.2.6",
|
|
37
|
-
"release-plan": "^0.
|
|
46
|
+
"release-plan": "^0.9.0",
|
|
38
47
|
"typescript": "^5.3.3",
|
|
39
48
|
"vite": "^5.0.12",
|
|
40
49
|
"vitest": "^1.2.2"
|
|
41
50
|
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@babel/eslint-parser": "^7.23.10",
|
|
44
|
-
"@glimmer/syntax": "^0.92.0",
|
|
45
|
-
"content-tag": "^2.0.1",
|
|
46
|
-
"eslint-scope": "^7.2.2",
|
|
47
|
-
"html-tags": "^3.3.1"
|
|
48
|
-
},
|
|
49
|
-
"engines": {
|
|
50
|
-
"node": ">=16.0.0"
|
|
51
|
-
},
|
|
52
51
|
"peerDependencies": {
|
|
53
52
|
"@babel/core": "^7.23.6",
|
|
54
53
|
"@typescript-eslint/parser": "*"
|
|
@@ -58,12 +57,15 @@
|
|
|
58
57
|
"optional": true
|
|
59
58
|
}
|
|
60
59
|
},
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=16.0.0"
|
|
62
|
+
},
|
|
61
63
|
"scripts": {
|
|
62
|
-
"test": "vitest run",
|
|
63
64
|
"lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
|
|
65
|
+
"lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
|
|
64
66
|
"lint:js": "eslint . --max-warnings=0",
|
|
67
|
+
"lint:js:fix": "eslint . --fix --max-warnings=0",
|
|
65
68
|
"lint:package": "pnpm publint",
|
|
66
|
-
"
|
|
67
|
-
"lint:js:fix": "eslint . --fix --max-warnings=0"
|
|
69
|
+
"test": "vitest run"
|
|
68
70
|
}
|
|
69
71
|
}
|
package/src/parser/transforms.js
CHANGED
|
@@ -4,6 +4,8 @@ const DocumentLines = require('../utils/document');
|
|
|
4
4
|
const { visitorKeys: glimmerVisitorKeys } = require('@glimmer/syntax');
|
|
5
5
|
const { Reference, Scope, Variable, Definition } = require('eslint-scope');
|
|
6
6
|
const htmlTags = require('html-tags');
|
|
7
|
+
const svgTags = require('svg-tags');
|
|
8
|
+
const mathMLTags = require('mathml-tag-names');
|
|
7
9
|
|
|
8
10
|
let TypescriptScope = null;
|
|
9
11
|
try {
|
|
@@ -476,9 +478,6 @@ module.exports.convertAst = function convertAst(result, preprocessedResult, visi
|
|
|
476
478
|
}
|
|
477
479
|
}
|
|
478
480
|
if (node.type === 'GlimmerElementNode') {
|
|
479
|
-
if (node.tag === 'svg') {
|
|
480
|
-
path.context.inSvg = true;
|
|
481
|
-
}
|
|
482
481
|
// always reference first part of tag name, this also has the advantage
|
|
483
482
|
// that errors regarding this tag will only mark the tag name instead of
|
|
484
483
|
// the whole tag + children
|
|
@@ -491,14 +490,29 @@ module.exports.convertAst = function convertAst(result, preprocessedResult, visi
|
|
|
491
490
|
if we do not find a variable we register it with a missing variable if
|
|
492
491
|
* it starts with upper case, it should be a component with a reference
|
|
493
492
|
* it includes a dot, it's a path which should have a reference
|
|
494
|
-
* it's NOT a standard html tag, it should have a referenced variable
|
|
493
|
+
* it's NOT a standard html, svg or mathml tag, it should have a referenced variable
|
|
495
494
|
*/
|
|
496
495
|
const ignore =
|
|
497
|
-
|
|
496
|
+
// Local instance access
|
|
497
|
+
n.name === 'this' ||
|
|
498
|
+
// named block
|
|
499
|
+
n.name.startsWith(':') ||
|
|
500
|
+
// argument
|
|
501
|
+
n.name.startsWith('@') ||
|
|
502
|
+
// defined locally
|
|
503
|
+
!scope ||
|
|
504
|
+
// custom-elements are allowed to be used even if they don't exist
|
|
505
|
+
// and are undefined
|
|
506
|
+
n.name.includes('-');
|
|
507
|
+
|
|
498
508
|
const registerUndef =
|
|
499
|
-
isUpperCase(n.name[0]) ||
|
|
500
|
-
|
|
501
|
-
|
|
509
|
+
isUpperCase(n.name[0]) ||
|
|
510
|
+
node.name.includes('.') ||
|
|
511
|
+
(!htmlTags.includes(node.name) &&
|
|
512
|
+
!svgTags.includes(node.name) &&
|
|
513
|
+
!mathMLTags.includes(node.name));
|
|
514
|
+
|
|
515
|
+
if (!ignore && (variable || registerUndef)) {
|
|
502
516
|
registerNodeInScope(n, scope, variable);
|
|
503
517
|
}
|
|
504
518
|
}
|