ember-eslint-parser 0.3.5 → 0.3.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 +2 -1
- package/src/parser/transforms.js +31 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-eslint-parser",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@babel/core": "^7.23.6",
|
|
22
22
|
"@typescript-eslint/parser": "^6.21.0",
|
|
23
|
+
"@typescript-eslint/visitor-keys": "^6.21.0",
|
|
23
24
|
"concurrently": "^8.2.2",
|
|
24
25
|
"eslint": "^8.0.1",
|
|
25
26
|
"eslint-config-prettier": "^9.1.0",
|
package/src/parser/transforms.js
CHANGED
|
@@ -312,29 +312,45 @@ module.exports.preprocessGlimmerTemplates = function preprocessGlimmerTemplates(
|
|
|
312
312
|
|
|
313
313
|
if (n.type === 'ElementNode') {
|
|
314
314
|
n.name = n.tag;
|
|
315
|
-
n.parts = n.parts.map((p) =>
|
|
316
|
-
|
|
317
|
-
parent: n,
|
|
318
|
-
type: 'GlimmerElementNodePart',
|
|
319
|
-
name: p.value,
|
|
320
|
-
range: [
|
|
315
|
+
n.parts = n.parts.map((p) => {
|
|
316
|
+
const range = [
|
|
321
317
|
offset + docLines.positionToOffset(p.loc.start),
|
|
322
318
|
offset + docLines.positionToOffset(p.loc.end),
|
|
323
|
-
]
|
|
324
|
-
|
|
319
|
+
];
|
|
320
|
+
const loc = {
|
|
321
|
+
start: codeLines.offsetToPosition(range[0]),
|
|
322
|
+
end: codeLines.offsetToPosition(range[1]),
|
|
323
|
+
};
|
|
324
|
+
return {
|
|
325
|
+
...p,
|
|
326
|
+
parent: n,
|
|
327
|
+
type: 'GlimmerElementNodePart',
|
|
328
|
+
name: p.value,
|
|
329
|
+
range,
|
|
330
|
+
loc,
|
|
331
|
+
};
|
|
332
|
+
});
|
|
325
333
|
}
|
|
326
334
|
|
|
327
335
|
if ('blockParams' in n) {
|
|
328
336
|
// program does have blockParams but not blockParamNodes
|
|
329
|
-
n.params = (n.blockParamNodes || []).map((p) =>
|
|
330
|
-
|
|
331
|
-
parent: n,
|
|
332
|
-
name: p.value,
|
|
333
|
-
range: [
|
|
337
|
+
n.params = (n.blockParamNodes || []).map((p) => {
|
|
338
|
+
const range = [
|
|
334
339
|
offset + docLines.positionToOffset(p.loc.start),
|
|
335
340
|
offset + docLines.positionToOffset(p.loc.end),
|
|
336
|
-
]
|
|
337
|
-
|
|
341
|
+
];
|
|
342
|
+
const loc = {
|
|
343
|
+
start: codeLines.offsetToPosition(range[0]),
|
|
344
|
+
end: codeLines.offsetToPosition(range[1]),
|
|
345
|
+
};
|
|
346
|
+
return {
|
|
347
|
+
...p,
|
|
348
|
+
parent: n,
|
|
349
|
+
name: p.value,
|
|
350
|
+
range,
|
|
351
|
+
loc,
|
|
352
|
+
};
|
|
353
|
+
});
|
|
338
354
|
}
|
|
339
355
|
n.type = `Glimmer${n.type}`;
|
|
340
356
|
allNodeTypes.add(n.type);
|