ember-eslint-parser 0.4.1 → 0.4.3
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 +2 -2
- package/src/parser/transforms.js +27 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-eslint-parser",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/eslint-parser": "7.23.10",
|
|
44
|
-
"@glimmer/syntax": "^0.
|
|
44
|
+
"@glimmer/syntax": "^0.92.0",
|
|
45
45
|
"content-tag": "^1.2.2",
|
|
46
46
|
"eslint-scope": "^7.2.2",
|
|
47
47
|
"html-tags": "^3.3.1"
|
package/src/parser/transforms.js
CHANGED
|
@@ -320,7 +320,7 @@ module.exports.preprocessGlimmerTemplates = function preprocessGlimmerTemplates(
|
|
|
320
320
|
|
|
321
321
|
if (n.type === 'ElementNode') {
|
|
322
322
|
n.name = n.tag;
|
|
323
|
-
n.parts = n.
|
|
323
|
+
n.parts = [n.path.head].map((p) => {
|
|
324
324
|
const range = [
|
|
325
325
|
offset + docLines.positionToOffset(p.loc.start),
|
|
326
326
|
offset + docLines.positionToOffset(p.loc.end),
|
|
@@ -331,9 +331,9 @@ module.exports.preprocessGlimmerTemplates = function preprocessGlimmerTemplates(
|
|
|
331
331
|
};
|
|
332
332
|
return {
|
|
333
333
|
...p,
|
|
334
|
+
name: p.original,
|
|
334
335
|
parent: n,
|
|
335
336
|
type: 'GlimmerElementNodePart',
|
|
336
|
-
name: p.value,
|
|
337
337
|
range,
|
|
338
338
|
loc,
|
|
339
339
|
};
|
|
@@ -341,8 +341,7 @@ module.exports.preprocessGlimmerTemplates = function preprocessGlimmerTemplates(
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
if ('blockParams' in n) {
|
|
344
|
-
|
|
345
|
-
n.params = (n.blockParamNodes || []).map((p) => {
|
|
344
|
+
n.params = (n.params || []).map((p) => {
|
|
346
345
|
const range = [
|
|
347
346
|
offset + docLines.positionToOffset(p.loc.start),
|
|
348
347
|
offset + docLines.positionToOffset(p.loc.end),
|
|
@@ -353,8 +352,9 @@ module.exports.preprocessGlimmerTemplates = function preprocessGlimmerTemplates(
|
|
|
353
352
|
};
|
|
354
353
|
return {
|
|
355
354
|
...p,
|
|
355
|
+
type: 'BlockParam',
|
|
356
|
+
name: p.original,
|
|
356
357
|
parent: n,
|
|
357
|
-
name: p.value,
|
|
358
358
|
range,
|
|
359
359
|
loc,
|
|
360
360
|
};
|
|
@@ -508,12 +508,33 @@ module.exports.convertAst = function convertAst(result, preprocessedResult, visi
|
|
|
508
508
|
const scope = result.isTypescript
|
|
509
509
|
? new TypescriptScope.BlockScope(result.scopeManager, upperScope, node)
|
|
510
510
|
: new Scope(result.scopeManager, 'block', upperScope, node);
|
|
511
|
+
const declaredVariables =
|
|
512
|
+
result.scopeManager.declaredVariables || result.scopeManager.__declaredVariables;
|
|
513
|
+
const vars = [];
|
|
514
|
+
declaredVariables.set(node, vars);
|
|
515
|
+
const virtualJSParentNode = {
|
|
516
|
+
type: 'FunctionDeclaration',
|
|
517
|
+
params: node.params,
|
|
518
|
+
range: node.range,
|
|
519
|
+
loc: node.loc,
|
|
520
|
+
parent: path.parent,
|
|
521
|
+
};
|
|
511
522
|
for (const [i, b] of node.params.entries()) {
|
|
512
523
|
const v = new Variable(b.name, scope);
|
|
513
524
|
v.identifiers.push(b);
|
|
514
|
-
v.defs.push(new Definition('Parameter', b, node, node, i, 'Block Param'));
|
|
515
525
|
scope.variables.push(v);
|
|
516
526
|
scope.set.set(b.name, v);
|
|
527
|
+
vars.push(v);
|
|
528
|
+
|
|
529
|
+
const virtualJSNode = {
|
|
530
|
+
type: 'Identifier',
|
|
531
|
+
name: b.name,
|
|
532
|
+
range: b.range,
|
|
533
|
+
loc: b.loc,
|
|
534
|
+
parent: virtualJSParentNode,
|
|
535
|
+
};
|
|
536
|
+
v.defs.push(new Definition('Parameter', virtualJSNode, node, node, i, 'Block Param'));
|
|
537
|
+
v.defs.push(new Definition('Parameter', b, node, node, i, 'Block Param'));
|
|
517
538
|
}
|
|
518
539
|
}
|
|
519
540
|
return null;
|