fix(scripts): resolve noAssignInExpressions lint error in schema generator
This commit is contained in:
1 parent
c601ffbb76
commit
8275842e78
1 file changed
+5
-3
@@ -42,14 +42,16 @@ function parseDrizzleTables(source) {
|
|||||||
const re2 =
|
const re2 =
|
||||||
/^export const (\w+) = mysqlTable\(\s*"([^"]+)"\s*,\s*\{([\s\S]*?)\n\}(?:,\s*\(t\)\s*=>\s*\[([\s\S]*?)\])?\s*\);/gm;
|
/^export const (\w+) = mysqlTable\(\s*"([^"]+)"\s*,\s*\{([\s\S]*?)\n\}(?:,\s*\(t\)\s*=>\s*\[([\s\S]*?)\])?\s*\);/gm;
|
||||||
|
|
||||||
let match;
|
let match = re2.exec(source);
|
||||||
const seen = new Set();
|
const seen = new Set();
|
||||||
while ((match = re2.exec(source)) !== null) {
|
while (match !== null) {
|
||||||
const [, name, table, body, extras] = match;
|
const [, name, table, body, extras] = match;
|
||||||
if (seen.has(name)) continue;
|
if (!seen.has(name)) {
|
||||||
seen.add(name);
|
seen.add(name);
|
||||||
models.push(parseTableBody(name, table, body, extras ?? ""));
|
models.push(parseTableBody(name, table, body, extras ?? ""));
|
||||||
}
|
}
|
||||||
|
match = re2.exec(source);
|
||||||
|
}
|
||||||
|
|
||||||
if (models.length === 0) {
|
if (models.length === 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
Reference in new issue
Block a user