Skip to content

Commit f96f1bc

Browse files
committed
linter errors
1 parent cd0f6b3 commit f96f1bc

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

src/parser/visitor.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ class QuestDBVisitor extends BaseVisitor {
838838
insertStatement(ctx: InsertStatementCstChildren): AST.InsertStatement {
839839
const result: AST.InsertStatement = {
840840
type: "insert",
841-
table: this.visit(ctx.stringOrQualifiedName!) as AST.QualifiedName,
841+
table: this.visit(ctx.stringOrQualifiedName) as AST.QualifiedName,
842842
}
843843

844844
if (ctx.withClause) {
@@ -2911,19 +2911,15 @@ class QuestDBVisitor extends BaseVisitor {
29112911
}
29122912

29132913
concatExpression(ctx: ConcatExpressionCstChildren): AST.Expression {
2914-
let result = this.visit(
2915-
ctx.ipv4ContainmentExpression[0],
2916-
) as AST.Expression
2914+
let result = this.visit(ctx.ipv4ContainmentExpression[0]) as AST.Expression
29172915

29182916
if (ctx.ipv4ContainmentExpression.length > 1) {
29192917
for (let i = 1; i < ctx.ipv4ContainmentExpression.length; i++) {
29202918
result = {
29212919
type: "binary",
29222920
operator: "||",
29232921
left: result,
2924-
right: this.visit(
2925-
ctx.ipv4ContainmentExpression[i],
2926-
) as AST.Expression,
2922+
right: this.visit(ctx.ipv4ContainmentExpression[i]) as AST.Expression,
29272923
}
29282924
}
29292925
}

tests/lexer.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ describe("QuestDB Lexer", () => {
136136
// has the dot consumed into the number.
137137
it("should consume trailing dot into NumberLiteral", () => {
138138
const result = tokenize("1.")
139-
const tokens = result.tokens.filter((t) => t.tokenType.name !== "WhiteSpace")
139+
const tokens = result.tokens.filter(
140+
(t) => t.tokenType.name !== "WhiteSpace",
141+
)
140142
expect(tokens).toHaveLength(1)
141143
expect(tokens[0].tokenType.name).toBe("NumberLiteral")
142144
expect(tokens[0].image).toBe("1.")

tests/parser.test.ts

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,7 @@ describe("QuestDB Parser", () => {
231231
})
232232

233233
it("should parse INSERT INTO with quoted table name", () => {
234-
const result = parseToAst(
235-
"INSERT INTO 'my_table' VALUES (1, 2, 3)",
236-
)
234+
const result = parseToAst("INSERT INTO 'my_table' VALUES (1, 2, 3)")
237235

238236
expect(result.errors).toHaveLength(0)
239237
expect(result.ast[0].type).toBe("insert")
@@ -401,8 +399,12 @@ describe("QuestDB Parser", () => {
401399
)
402400
expect(result.errors).toHaveLength(0)
403401
const select = result.ast[0] as AST.SelectStatement
404-
expect((select as unknown as Record<string, unknown>).window).toBeUndefined()
405-
expect((select as unknown as Record<string, unknown>).windowDefinitions).toBeUndefined()
402+
expect(
403+
(select as unknown as Record<string, unknown>).window,
404+
).toBeUndefined()
405+
expect(
406+
(select as unknown as Record<string, unknown>).windowDefinitions,
407+
).toBeUndefined()
406408

407409
const col = select.columns[0] as AST.ExpressionSelectItem
408410
const fn = col.expression as AST.FunctionCall
@@ -462,9 +464,7 @@ describe("QuestDB Parser", () => {
462464
})
463465

464466
it("should serialize INSERT with quoted table name", () => {
465-
const result = parseToAst(
466-
"INSERT INTO 'my_table' VALUES (1, 2, 3)",
467-
)
467+
const result = parseToAst("INSERT INTO 'my_table' VALUES (1, 2, 3)")
468468
const sql = toSql(result.ast[0])
469469

470470
expect(sql).toContain("INSERT INTO my_table")
@@ -585,7 +585,10 @@ describe("QuestDB Parser", () => {
585585
{ type: "columnDefinition", name: "name", dataType: "STRING" },
586586
],
587587
indexes: [
588-
{ type: "indexDefinition", column: { type: "qualifiedName", parts: ["name"] } },
588+
{
589+
type: "indexDefinition",
590+
column: { type: "qualifiedName", parts: ["name"] },
591+
},
589592
],
590593
}
591594
const sql = toSql(stmt)
@@ -609,10 +612,19 @@ describe("QuestDB Parser", () => {
609612
left: {
610613
type: "binary",
611614
operator: "+",
612-
left: { type: "column", name: { type: "qualifiedName", parts: ["a"] } },
613-
right: { type: "column", name: { type: "qualifiedName", parts: ["b"] } },
615+
left: {
616+
type: "column",
617+
name: { type: "qualifiedName", parts: ["a"] },
618+
},
619+
right: {
620+
type: "column",
621+
name: { type: "qualifiedName", parts: ["b"] },
622+
},
614623
} as AST.BinaryExpression,
615-
right: { type: "column", name: { type: "qualifiedName", parts: ["c"] } },
624+
right: {
625+
type: "column",
626+
name: { type: "qualifiedName", parts: ["c"] },
627+
},
616628
} as AST.BinaryExpression,
617629
} as AST.ExpressionSelectItem,
618630
],
@@ -1057,9 +1069,7 @@ describe("QuestDB Parser", () => {
10571069
})
10581070

10591071
it("should parse CREATE TABLE with quoted name and LIKE", () => {
1060-
const result = parseToAst(
1061-
"CREATE TABLE 'my_table' (LIKE other_table)",
1062-
)
1072+
const result = parseToAst("CREATE TABLE 'my_table' (LIKE other_table)")
10631073
expect(result.errors).toHaveLength(0)
10641074
if (result.ast[0].type === "createTable") {
10651075
expect(result.ast[0].table.parts).toEqual(["my_table"])
@@ -3327,9 +3337,7 @@ orders PIVOT (sum(amount) FOR status IN ('open'))`
33273337
})
33283338

33293339
it("should parse SELECT with star in middle of select list", () => {
3330-
const result = parseToAst(
3331-
"SELECT symbol, *, price FROM btc_trades",
3332-
)
3340+
const result = parseToAst("SELECT symbol, *, price FROM btc_trades")
33333341
expect(result.errors).toHaveLength(0)
33343342
if (result.ast[0].type === "select") {
33353343
expect(result.ast[0].columns).toHaveLength(3)
@@ -3340,9 +3348,7 @@ orders PIVOT (sum(amount) FOR status IN ('open'))`
33403348
})
33413349

33423350
it("should parse SELECT with multiple expressions before star", () => {
3343-
const result = parseToAst(
3344-
"SELECT a, b, c, * FROM t",
3345-
)
3351+
const result = parseToAst("SELECT a, b, c, * FROM t")
33463352
expect(result.errors).toHaveLength(0)
33473353
if (result.ast[0].type === "select") {
33483354
expect(result.ast[0].columns).toHaveLength(4)

0 commit comments

Comments
 (0)