fix(db): drop dead quote tracking in hasExecutableSql, clear lint
hasExecutableSql returns as soon as it meets a quote character, so the quote variable was assigned and never read: the `if (quote)` branch could never run. eslint reported it as a useless assignment and the error blocks the release gate on main. Removing the variable and the unreachable branch keeps behaviour identical, since encountering a quote already means the SQL is executable. Also drops an eslint-disable directive in csr's output error reporter that suppressed nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -52,7 +52,6 @@ function section(content: string, which: "up" | "down"): string {
|
||||
}
|
||||
|
||||
function hasExecutableSql(sql: string): boolean {
|
||||
let quote = "";
|
||||
let lineComment = false;
|
||||
let blockComment = false;
|
||||
for (let index = 0; index < sql.length; index++) {
|
||||
@@ -69,13 +68,6 @@ function hasExecutableSql(sql: string): boolean {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (quote) {
|
||||
if (char === quote) {
|
||||
if (next === quote) index++;
|
||||
else quote = "";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (char === "-" && next === "-") {
|
||||
lineComment = true;
|
||||
index++;
|
||||
@@ -86,10 +78,9 @@ function hasExecutableSql(sql: string): boolean {
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
if (char === "'" || char === '"' || char === "`") {
|
||||
quote = char;
|
||||
return true;
|
||||
}
|
||||
// A quote opens a literal, which is executable content in itself, so the
|
||||
// scan can stop here without tracking the literal's contents.
|
||||
if (char === "'" || char === '"' || char === "`") return true;
|
||||
if (!/\s|;/.test(char)) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user