astro-eslint-parser 0.0.11 → 0.0.12
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.
|
@@ -159,8 +159,34 @@ function fixLocations(node, ctx) {
|
|
|
159
159
|
node.value = ctx.code.slice(node.position.start.offset, start);
|
|
160
160
|
}
|
|
161
161
|
else {
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
const index = tokenIndexSafe(ctx.code, node.value, start);
|
|
163
|
+
if (index != null) {
|
|
164
|
+
start = node.position.start.offset = index;
|
|
165
|
+
start += node.value.length;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
// Workaround for escape bugs
|
|
169
|
+
node.position.start.offset = start;
|
|
170
|
+
for (const token of node.value.split(/\s+/u)) {
|
|
171
|
+
const index = tokenIndexSafe(ctx.code, token, start);
|
|
172
|
+
if (index != null) {
|
|
173
|
+
start = index + token.length;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
start = (0, astro_1.skipSpaces)(ctx.code, start);
|
|
177
|
+
let t = token;
|
|
178
|
+
if (ctx.code.startsWith("\\", start)) {
|
|
179
|
+
const char = JSON.parse(`"\\${ctx.code[start + 1]}"`);
|
|
180
|
+
if (char.trim()) {
|
|
181
|
+
t = t.slice(1);
|
|
182
|
+
}
|
|
183
|
+
start += 2;
|
|
184
|
+
}
|
|
185
|
+
start = tokenIndex(ctx, t, start) + t.length;
|
|
186
|
+
}
|
|
187
|
+
start = (0, astro_1.skipSpaces)(ctx.code, start);
|
|
188
|
+
node.value = ctx.code.slice(node.position.start.offset, start);
|
|
189
|
+
}
|
|
164
190
|
}
|
|
165
191
|
}
|
|
166
192
|
else if (node.type === "expression") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-eslint-parser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Astro parser for ESLint",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"debug": "mocha --require ts-node/register/transpile-only \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
|
|
21
21
|
"preversion": "npm run lint && npm test",
|
|
22
22
|
"update-fixtures": "ts-node --transpile-only ./tools/update-fixtures.ts",
|
|
23
|
+
"debug-parser": "ts-node --transpile-only ./tools/parser-test.ts",
|
|
23
24
|
"eslint-playground": "eslint tests/fixtures --ext .astro --config .eslintrc-for-playground.js --format codeframe",
|
|
24
25
|
"benchmark": "ts-node --transpile-only benchmark/index.ts"
|
|
25
26
|
},
|