diff --git a/.eslintrc.json b/.eslintrc.json index ca9f0d0c57..4b2b523137 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -41,7 +41,6 @@ "no-unused-vars": "off", "no-inner-declarations": "off", "no-case-declarations": "off", - "no-useless-escape": "off", "no-undef": "off", "no-prototype-builtins": "off", "local-rules/no-budibase-imports": "error" @@ -60,7 +59,6 @@ "no-unused-vars": "off", "no-inner-declarations": "off", "no-case-declarations": "off", - "no-useless-escape": "off", "no-undef": "off", "no-prototype-builtins": "off", "local-rules/no-test-com": "error", diff --git a/packages/backend-core/src/db/lucene.ts b/packages/backend-core/src/db/lucene.ts index f982ee67d0..7055ec8031 100644 --- a/packages/backend-core/src/db/lucene.ts +++ b/packages/backend-core/src/db/lucene.ts @@ -247,7 +247,7 @@ export class QueryBuilder { } // Escape characters if (!this.#noEscaping && escape && originalType === "string") { - value = `${value}`.replace(/[ \/#+\-&|!(){}\]^"~*?:\\]/g, "\\$&") + value = `${value}`.replace(/[ /#+\-&|!(){}\]^"~*?:\\]/g, "\\$&") } // Wrap in quotes diff --git a/packages/backend-core/src/redis/tests/redlockImpl.spec.ts b/packages/backend-core/src/redis/tests/redlockImpl.spec.ts index 2bab3e168e..e647b63bf5 100644 --- a/packages/backend-core/src/redis/tests/redlockImpl.spec.ts +++ b/packages/backend-core/src/redis/tests/redlockImpl.spec.ts @@ -97,7 +97,7 @@ describe("redlockImpl", () => { executionTimeMs: lockTtl * 2, }) ).rejects.toThrow( - `Unable to fully release the lock on resource \"lock:${config.tenantId}_persist_writethrough\".` + `Unable to fully release the lock on resource "lock:${config.tenantId}_persist_writethrough".` ) } ) diff --git a/packages/server/src/integrations/oracle.ts b/packages/server/src/integrations/oracle.ts index 08f3058d63..83803906be 100644 --- a/packages/server/src/integrations/oracle.ts +++ b/packages/server/src/integrations/oracle.ts @@ -455,7 +455,7 @@ class OracleIntegration extends Sql implements DatasourcePlus { operation !== Operation.DELETE ) { const lastRow = await this.internalQuery({ - sql: `SELECT * FROM \"${json.endpoint.entityId}\" WHERE ROWID = '${response.lastRowid}'`, + sql: `SELECT * FROM "${json.endpoint.entityId}" WHERE ROWID = '${response.lastRowid}'`, }) return lastRow.rows as Row[] } else { diff --git a/packages/server/src/integrations/tests/sql.spec.ts b/packages/server/src/integrations/tests/sql.spec.ts index e9e2b1fbb8..c0b92b3849 100644 --- a/packages/server/src/integrations/tests/sql.spec.ts +++ b/packages/server/src/integrations/tests/sql.spec.ts @@ -389,7 +389,7 @@ describe("SQL query builder", () => { ) expect(query).toEqual({ bindings: [10], - sql: `select * from (select * from \"${TABLE_NAME}\" where \"${TABLE_NAME}\".\"age\"::jsonb @> '[20]' and \"${TABLE_NAME}\".\"name\"::jsonb @> '["John"]' limit $1) as \"${TABLE_NAME}\"`, + sql: `select * from (select * from "${TABLE_NAME}" where "${TABLE_NAME}"."age"::jsonb @> '[20]' and "${TABLE_NAME}"."name"::jsonb @> '["John"]' limit $1) as "${TABLE_NAME}"`, }) }) @@ -440,7 +440,7 @@ describe("SQL query builder", () => { ) expect(query).toEqual({ bindings: [10], - sql: `select * from (select * from \"${TABLE_NAME}\" where NOT \"${TABLE_NAME}\".\"age\"::jsonb @> '[20]' and NOT \"${TABLE_NAME}\".\"name\"::jsonb @> '["John"]' limit $1) as \"${TABLE_NAME}\"`, + sql: `select * from (select * from "${TABLE_NAME}" where NOT "${TABLE_NAME}"."age"::jsonb @> '[20]' and NOT "${TABLE_NAME}"."name"::jsonb @> '["John"]' limit $1) as "${TABLE_NAME}"`, }) }) @@ -491,7 +491,7 @@ describe("SQL query builder", () => { ) expect(query).toEqual({ bindings: [10], - sql: `select * from (select * from \"${TABLE_NAME}\" where \"${TABLE_NAME}\".\"age\"::jsonb ?| array [20,25] and \"${TABLE_NAME}\".\"name\"::jsonb ?| array ['John','Mary'] limit $1) as \"${TABLE_NAME}\"`, + sql: `select * from (select * from "${TABLE_NAME}" where "${TABLE_NAME}"."age"::jsonb ?| array [20,25] and "${TABLE_NAME}"."name"::jsonb ?| array ['John','Mary'] limit $1) as "${TABLE_NAME}"`, }) }) @@ -572,7 +572,7 @@ describe("SQL query builder", () => { ) expect(query).toEqual({ bindings: ["2000-01-01 00:00:00", 500], - sql: `select * from (select * from \"${TABLE_NAME}\" where \"${TABLE_NAME}\".\"dob\" > $1 limit $2) as \"${TABLE_NAME}\"`, + sql: `select * from (select * from "${TABLE_NAME}" where "${TABLE_NAME}"."dob" > $1 limit $2) as "${TABLE_NAME}"`, }) }) @@ -591,7 +591,7 @@ describe("SQL query builder", () => { ) expect(query).toEqual({ bindings: ["2010-01-01 00:00:00", 500], - sql: `select * from (select * from \"${TABLE_NAME}\" where \"${TABLE_NAME}\".\"dob\" < $1 limit $2) as \"${TABLE_NAME}\"`, + sql: `select * from (select * from "${TABLE_NAME}" where "${TABLE_NAME}"."dob" < $1 limit $2) as "${TABLE_NAME}"`, }) }) @@ -607,7 +607,7 @@ describe("SQL query builder", () => { ) expect(query).toEqual({ bindings: ["john%", limit], - sql: `select * from (select * from (select * from \"test\" where LOWER(\"test\".\"name\") LIKE :1) where rownum <= :2) \"test\"`, + sql: `select * from (select * from (select * from "test" where LOWER("test"."name") LIKE :1) where rownum <= :2) "test"`, }) query = new Sql(SqlClient.ORACLE, limit)._query( @@ -622,7 +622,7 @@ describe("SQL query builder", () => { ) expect(query).toEqual({ bindings: ["%20%", "%25%", `%"john"%`, `%"mary"%`, limit], - sql: `select * from (select * from (select * from \"test\" where (LOWER(\"test\".\"age\") LIKE :1 AND LOWER(\"test\".\"age\") LIKE :2) and (LOWER(\"test\".\"name\") LIKE :3 AND LOWER(\"test\".\"name\") LIKE :4)) where rownum <= :5) \"test\"`, + sql: `select * from (select * from (select * from "test" where (LOWER("test"."age") LIKE :1 AND LOWER("test"."age") LIKE :2) and (LOWER("test"."name") LIKE :3 AND LOWER("test"."name") LIKE :4)) where rownum <= :5) "test"`, }) query = new Sql(SqlClient.ORACLE, limit)._query( @@ -636,7 +636,7 @@ describe("SQL query builder", () => { ) expect(query).toEqual({ bindings: [`%jo%`, limit], - sql: `select * from (select * from (select * from \"test\" where LOWER(\"test\".\"name\") LIKE :1) where rownum <= :2) \"test\"`, + sql: `select * from (select * from (select * from "test" where LOWER("test"."name") LIKE :1) where rownum <= :2) "test"`, }) }) @@ -663,7 +663,7 @@ describe("SQL query builder", () => { ) expect(query).toEqual({ bindings: ['{ "created_at":"2023-09-09T03:21:06.024Z" }'], - sql: `insert into \"test\" (\"name\") values ($1) returning *`, + sql: `insert into "test" ("name") values ($1) returning *`, }) }) @@ -676,7 +676,7 @@ describe("SQL query builder", () => { ) expect(query).toEqual({ bindings: [dateObj], - sql: `insert into \"test\" (\"name\") values ($1) returning *`, + sql: `insert into "test" ("name") values ($1) returning *`, }) }) diff --git a/packages/string-templates/test/manifest.spec.ts b/packages/string-templates/test/manifest.spec.ts index d8fee0fb1a..de0e3355fd 100644 --- a/packages/string-templates/test/manifest.spec.ts +++ b/packages/string-templates/test/manifest.spec.ts @@ -48,7 +48,7 @@ describe("manifest", () => { const arrays = hbs.match(/\[[^/\]]+\]/) arrays?.forEach((arrayString, i) => { hbs = hbs.replace(new RegExp(escapeRegExp(arrayString)), `array${i}`) - context[`array${i}`] = JSON.parse(arrayString.replace(/\'/g, '"')) + context[`array${i}`] = JSON.parse(arrayString.replace(/'/g, '"')) }) let result = await processString(hbs, context)