astro-eslint-parser 0.16.2 → 0.16.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/lib/index.d.mts CHANGED
@@ -314,7 +314,7 @@ declare class ParseError extends SyntaxError {
314
314
  }
315
315
 
316
316
  var name = "astro-eslint-parser";
317
- var version = "0.16.2";
317
+ var version = "0.16.3";
318
318
 
319
319
  declare const meta_name: typeof name;
320
320
  declare const meta_version: typeof version;
package/lib/index.d.ts CHANGED
@@ -314,7 +314,7 @@ declare class ParseError extends SyntaxError {
314
314
  }
315
315
 
316
316
  var name = "astro-eslint-parser";
317
- var version = "0.16.2";
317
+ var version = "0.16.3";
318
318
 
319
319
  declare const meta_name: typeof name;
320
320
  declare const meta_version: typeof version;
package/lib/index.js CHANGED
@@ -1237,10 +1237,13 @@ function processTemplate(ctx, resultTemplate) {
1237
1237
  ]);
1238
1238
  } else if (isTag(node)) {
1239
1239
  if (parent.type === "expression") {
1240
- const index = parent.children.indexOf(node);
1241
- const before = parent.children[index - 1];
1240
+ const siblings = parent.children.filter(
1241
+ (n) => n.type !== "text" || n.value.trim()
1242
+ );
1243
+ const index = siblings.indexOf(node);
1244
+ const before = siblings[index - 1];
1242
1245
  if (!before || !isTag(before)) {
1243
- const after = parent.children[index + 1];
1246
+ const after = siblings[index + 1];
1244
1247
  if (after && (isTag(after) || after.type === "comment")) {
1245
1248
  const start2 = node.position.start.offset;
1246
1249
  script.appendOriginal(start2);
@@ -1472,10 +1475,13 @@ function processTemplate(ctx, resultTemplate) {
1472
1475
  }
1473
1476
  }
1474
1477
  if ((isTag(node) || node.type === "comment") && parent.type === "expression") {
1475
- const index = parent.children.indexOf(node);
1476
- const after = parent.children[index + 1];
1478
+ const siblings = parent.children.filter(
1479
+ (n) => n.type !== "text" || n.value.trim()
1480
+ );
1481
+ const index = siblings.indexOf(node);
1482
+ const after = siblings[index + 1];
1477
1483
  if (!after || !isTag(after) && after.type !== "comment") {
1478
- const before = parent.children[index - 1];
1484
+ const before = siblings[index - 1];
1479
1485
  if (before && (isTag(before) || before.type === "comment")) {
1480
1486
  const end = getEndOffset(node, ctx);
1481
1487
  script.appendOriginal(end);
@@ -2649,7 +2655,7 @@ __export(meta_exports, {
2649
2655
 
2650
2656
  // package.json
2651
2657
  var name = "astro-eslint-parser";
2652
- var version = "0.16.2";
2658
+ var version = "0.16.3";
2653
2659
 
2654
2660
  // src/index.ts
2655
2661
  function parseForESLint2(code, options) {
package/lib/index.mjs CHANGED
@@ -1211,10 +1211,13 @@ function processTemplate(ctx, resultTemplate) {
1211
1211
  ]);
1212
1212
  } else if (isTag(node)) {
1213
1213
  if (parent.type === "expression") {
1214
- const index = parent.children.indexOf(node);
1215
- const before = parent.children[index - 1];
1214
+ const siblings = parent.children.filter(
1215
+ (n) => n.type !== "text" || n.value.trim()
1216
+ );
1217
+ const index = siblings.indexOf(node);
1218
+ const before = siblings[index - 1];
1216
1219
  if (!before || !isTag(before)) {
1217
- const after = parent.children[index + 1];
1220
+ const after = siblings[index + 1];
1218
1221
  if (after && (isTag(after) || after.type === "comment")) {
1219
1222
  const start2 = node.position.start.offset;
1220
1223
  script.appendOriginal(start2);
@@ -1446,10 +1449,13 @@ function processTemplate(ctx, resultTemplate) {
1446
1449
  }
1447
1450
  }
1448
1451
  if ((isTag(node) || node.type === "comment") && parent.type === "expression") {
1449
- const index = parent.children.indexOf(node);
1450
- const after = parent.children[index + 1];
1452
+ const siblings = parent.children.filter(
1453
+ (n) => n.type !== "text" || n.value.trim()
1454
+ );
1455
+ const index = siblings.indexOf(node);
1456
+ const after = siblings[index + 1];
1451
1457
  if (!after || !isTag(after) && after.type !== "comment") {
1452
- const before = parent.children[index - 1];
1458
+ const before = siblings[index - 1];
1453
1459
  if (before && (isTag(before) || before.type === "comment")) {
1454
1460
  const end = getEndOffset(node, ctx);
1455
1461
  script.appendOriginal(end);
@@ -2626,7 +2632,7 @@ __export(meta_exports, {
2626
2632
 
2627
2633
  // package.json
2628
2634
  var name = "astro-eslint-parser";
2629
- var version = "0.16.2";
2635
+ var version = "0.16.3";
2630
2636
 
2631
2637
  // src/index.ts
2632
2638
  function parseForESLint2(code, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-eslint-parser",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
4
4
  "description": "Astro component parser for ESLint",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
@@ -71,14 +71,14 @@
71
71
  "@types/mocha": "^10.0.0",
72
72
  "@types/node": "^20.0.0",
73
73
  "@types/semver": "^7.3.9",
74
- "@typescript-eslint/eslint-plugin": "~6.19.0",
75
- "@typescript-eslint/parser": "~6.19.0",
74
+ "@typescript-eslint/eslint-plugin": "~6.20.0",
75
+ "@typescript-eslint/parser": "~6.20.0",
76
76
  "astro": "^4.0.0",
77
77
  "astro-eslint-parser": ">=0.1.0",
78
78
  "benchmark": "^2.1.4",
79
79
  "chai": "^5.0.0",
80
80
  "env-cmd": "^10.1.0",
81
- "esbuild": "^0.19.0",
81
+ "esbuild": "^0.20.0",
82
82
  "esbuild-register": "^3.3.3",
83
83
  "eslint": "^8.15.0",
84
84
  "eslint-config-prettier": "^9.0.0",
@@ -103,7 +103,7 @@
103
103
  "mocha-chai-jest-snapshot": "^1.1.3",
104
104
  "nyc": "^15.1.0",
105
105
  "prettier": "^3.0.0",
106
- "prettier-plugin-astro": "^0.12.0",
106
+ "prettier-plugin-astro": "^0.13.0",
107
107
  "prettier-plugin-svelte": "^3.0.0",
108
108
  "string-replace-loader": "^3.0.3",
109
109
  "svelte": "^4.0.0",