svelte-eslint-parser
Advanced tools
Comparing version 0.4.4 to 0.4.5
@@ -10,3 +10,3 @@ import type { Comment, Locations, Token } from "../ast"; | ||
private _appendScriptLets; | ||
separateSemiIndex: number; | ||
separateIndexes: number[]; | ||
constructor(script: string, attrs: Record<string, string | undefined>); | ||
@@ -13,0 +13,0 @@ get vcode(): string; |
@@ -15,6 +15,7 @@ "use strict"; | ||
this._appendScriptLets = null; | ||
this.separateIndexes = []; | ||
this.raw = script; | ||
this.trimmedRaw = script.trimEnd(); | ||
this.attrs = attrs; | ||
this.separateSemiIndex = script.length; | ||
this.separateIndexes = [script.length]; | ||
} | ||
@@ -30,4 +31,4 @@ get vcode() { | ||
this._appendScriptLets = ""; | ||
this.separateSemiIndex = this.vcode.length; | ||
this._appendScriptLets += ";"; | ||
this.separateIndexes = [this.vcode.length, this.vcode.length + 1]; | ||
this._appendScriptLets += "\n;"; | ||
const after = this.raw.slice(this.vcode.length); | ||
@@ -34,0 +35,0 @@ this._appendScriptLets += after; |
@@ -289,3 +289,3 @@ "use strict"; | ||
} | ||
const separateSemiIndex = this.script.separateSemiIndex; | ||
const separateIndexes = this.script.separateIndexes; | ||
const tokens = result.ast.tokens; | ||
@@ -298,3 +298,3 @@ const processedTokens = []; | ||
while ((tok = tokens.shift())) { | ||
if (separateSemiIndex === tok.range[0] && tok.value === ";") { | ||
if (separateIndexes.includes(tok.range[0]) && tok.value === ";") { | ||
break; | ||
@@ -320,9 +320,12 @@ } | ||
enterNode: (node) => { | ||
var _a; | ||
if (((_a = node.range) === null || _a === void 0 ? void 0 : _a[1]) === separateSemiIndex + 1) { | ||
while (node.range && | ||
separateIndexes.includes(node.range[1] - 1)) { | ||
node.range[1]--; | ||
node.loc.end.column--; | ||
} | ||
if (node.loc.end.column < 0) { | ||
node.loc.end = this.ctx.getLocFromIndex(node.range[1]); | ||
} | ||
if (node.parent === result.ast && | ||
separateSemiIndex <= node.range[0]) { | ||
separateIndexes[0] <= node.range[0]) { | ||
removeStatements.push(node); | ||
@@ -329,0 +332,0 @@ } |
{ | ||
"name": "svelte-eslint-parser", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "Svelte parser for ESLint", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
146242
3524