astro-eslint-parser 0.13.0 → 0.13.1
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.ts +1 -0
- package/lib/index.js +10 -3
- package/lib/index.mjs +10 -3
- package/package.json +4 -4
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1621,6 +1621,7 @@ ${next}`;
|
|
|
1621
1621
|
}
|
|
1622
1622
|
}
|
|
1623
1623
|
this.lineStartIndices = lineStartIndices;
|
|
1624
|
+
this.code = origCode;
|
|
1624
1625
|
this.normalizedLineFeed = new NormalizedLineFeed(normalizedCode, crs);
|
|
1625
1626
|
}
|
|
1626
1627
|
getLocFromIndex(index) {
|
|
@@ -1634,9 +1635,15 @@ ${next}`;
|
|
|
1634
1635
|
};
|
|
1635
1636
|
}
|
|
1636
1637
|
getIndexFromLoc(loc) {
|
|
1637
|
-
const
|
|
1638
|
-
|
|
1639
|
-
|
|
1638
|
+
const lineIndex = loc.line - 1;
|
|
1639
|
+
if (this.lineStartIndices.length > lineIndex) {
|
|
1640
|
+
const lineStartIndex = this.lineStartIndices[lineIndex];
|
|
1641
|
+
const positionIndex = lineStartIndex + loc.column;
|
|
1642
|
+
return positionIndex;
|
|
1643
|
+
} else if (this.lineStartIndices.length === lineIndex) {
|
|
1644
|
+
return this.code.length + loc.column;
|
|
1645
|
+
}
|
|
1646
|
+
return this.code.length + loc.column;
|
|
1640
1647
|
}
|
|
1641
1648
|
getNormalizedLineFeed() {
|
|
1642
1649
|
return this.normalizedLineFeed;
|
package/lib/index.mjs
CHANGED
|
@@ -1587,6 +1587,7 @@ ${next}`;
|
|
|
1587
1587
|
}
|
|
1588
1588
|
}
|
|
1589
1589
|
this.lineStartIndices = lineStartIndices;
|
|
1590
|
+
this.code = origCode;
|
|
1590
1591
|
this.normalizedLineFeed = new NormalizedLineFeed(normalizedCode, crs);
|
|
1591
1592
|
}
|
|
1592
1593
|
getLocFromIndex(index) {
|
|
@@ -1600,9 +1601,15 @@ ${next}`;
|
|
|
1600
1601
|
};
|
|
1601
1602
|
}
|
|
1602
1603
|
getIndexFromLoc(loc) {
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1605
|
-
|
|
1604
|
+
const lineIndex = loc.line - 1;
|
|
1605
|
+
if (this.lineStartIndices.length > lineIndex) {
|
|
1606
|
+
const lineStartIndex = this.lineStartIndices[lineIndex];
|
|
1607
|
+
const positionIndex = lineStartIndex + loc.column;
|
|
1608
|
+
return positionIndex;
|
|
1609
|
+
} else if (this.lineStartIndices.length === lineIndex) {
|
|
1610
|
+
return this.code.length + loc.column;
|
|
1611
|
+
}
|
|
1612
|
+
return this.code.length + loc.column;
|
|
1606
1613
|
}
|
|
1607
1614
|
getNormalizedLineFeed() {
|
|
1608
1615
|
return this.normalizedLineFeed;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-eslint-parser",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Astro component parser for ESLint",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@types/mocha": "^10.0.0",
|
|
70
70
|
"@types/node": "^18.0.0",
|
|
71
71
|
"@types/semver": "^7.3.9",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "~5.
|
|
73
|
-
"@typescript-eslint/parser": "~5.
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "~5.56.0",
|
|
73
|
+
"@typescript-eslint/parser": "~5.56.0",
|
|
74
74
|
"astro": "^2.0.0",
|
|
75
75
|
"astro-eslint-parser": ">=0.1.0",
|
|
76
76
|
"benchmark": "^2.1.4",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"eslint": "^8.15.0",
|
|
82
82
|
"eslint-config-prettier": "^8.3.0",
|
|
83
83
|
"eslint-formatter-codeframe": "^7.32.1",
|
|
84
|
-
"eslint-plugin-astro": "^0.
|
|
84
|
+
"eslint-plugin-astro": "^0.26.0",
|
|
85
85
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
86
86
|
"eslint-plugin-json-schema-validator": "^4.0.0",
|
|
87
87
|
"eslint-plugin-jsonc": "^2.0.0",
|