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:
@@ -13,6 +13,18 @@
|
||||
],
|
||||
"port": 3520
|
||||
},
|
||||
{
|
||||
"name": "pms-public",
|
||||
"runtimeExecutable": "bun",
|
||||
"runtimeArgs": [
|
||||
"run",
|
||||
"--cwd",
|
||||
"D:/Company/pms/apps/public",
|
||||
"dev",
|
||||
"--port=3610"
|
||||
],
|
||||
"port": 3610
|
||||
},
|
||||
{
|
||||
"name": "component-showcase",
|
||||
"runtimeExecutable": "bun",
|
||||
|
||||
@@ -30,7 +30,6 @@ export function registerOutputHandler<T>(
|
||||
function reportOutputError(host: OutputHost, name: string, error: unknown): void {
|
||||
const code = "WRN-DEV-OUTPUT-HANDLER-ERROR";
|
||||
const message = `The handler bound to output '${name}' threw. The control will appear to do nothing.`;
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(`[${code}] ${message}`, error);
|
||||
try {
|
||||
window.dispatchEvent(
|
||||
|
||||
@@ -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