astro-eslint-parser 0.7.0 → 0.7.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.js +5 -3
- package/lib/index.mjs +5 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1209,9 +1209,11 @@ function sortedLastIndex(array, value) {
|
|
|
1209
1209
|
var service = __toESM(require("astrojs-compiler-sync"));
|
|
1210
1210
|
function parse2(code, ctx) {
|
|
1211
1211
|
const result = service.parse(code, { position: true });
|
|
1212
|
-
for (const { code: code2, text, location } of result.diagnostics || []) {
|
|
1213
|
-
|
|
1214
|
-
|
|
1212
|
+
for (const { code: code2, text, location, severity } of result.diagnostics || []) {
|
|
1213
|
+
if (severity === 1) {
|
|
1214
|
+
ctx.originalAST = result.ast;
|
|
1215
|
+
throw new ParseError(`${text} [${code2}]`, location.length, ctx);
|
|
1216
|
+
}
|
|
1215
1217
|
}
|
|
1216
1218
|
if (!result.ast.children) {
|
|
1217
1219
|
result.ast.children = [];
|
package/lib/index.mjs
CHANGED
|
@@ -1180,9 +1180,11 @@ function sortedLastIndex(array, value) {
|
|
|
1180
1180
|
import * as service from "astrojs-compiler-sync";
|
|
1181
1181
|
function parse2(code, ctx) {
|
|
1182
1182
|
const result = service.parse(code, { position: true });
|
|
1183
|
-
for (const { code: code2, text, location } of result.diagnostics || []) {
|
|
1184
|
-
|
|
1185
|
-
|
|
1183
|
+
for (const { code: code2, text, location, severity } of result.diagnostics || []) {
|
|
1184
|
+
if (severity === 1) {
|
|
1185
|
+
ctx.originalAST = result.ast;
|
|
1186
|
+
throw new ParseError(`${text} [${code2}]`, location.length, ctx);
|
|
1187
|
+
}
|
|
1186
1188
|
}
|
|
1187
1189
|
if (!result.ast.children) {
|
|
1188
1190
|
result.ast.children = [];
|