diff --git a/package.json b/package.json index 929576a691..5960d15e75 100644 --- a/package.json +++ b/package.json @@ -36,10 +36,10 @@ "dev:server": "lerna run --parallel dev:builder --concurrency 1 --scope @budibase/worker --scope @budibase/server", "test": "lerna run test", "lint:eslint": "eslint packages", - "lint:prettier": "prettier --check \"packages/**/*.{js,svelte}\"", + "lint:prettier": "prettier --check \"packages/**/*.{js,ts,svelte}\"", "lint": "yarn run lint:eslint && yarn run lint:prettier", "lint:fix:eslint": "eslint --fix packages", - "lint:fix:prettier": "prettier --write \"packages/**/*.{js,svelte}\"", + "lint:fix:prettier": "prettier --write \"packages/**/*.{js,ts,svelte}\"", "lint:fix:ts": "lerna run lint:fix", "lint:fix": "yarn run lint:fix:ts && yarn run lint:fix:prettier && yarn run lint:fix:eslint", "test:e2e": "lerna run cy:test", diff --git a/packages/server/__mocks__/arangojs.ts b/packages/server/__mocks__/arangojs.ts index 2ea9c43967..5f980a7f97 100644 --- a/packages/server/__mocks__/arangojs.ts +++ b/packages/server/__mocks__/arangojs.ts @@ -9,7 +9,7 @@ module ArangoMock { this.close = jest.fn() } -// @ts-ignore + // @ts-ignore arangodb.aql = (strings, ...args) => { let str = strings.join("{}") diff --git a/packages/server/__mocks__/aws-sdk.ts b/packages/server/__mocks__/aws-sdk.ts index 7e1434e05b..75353db7e6 100644 --- a/packages/server/__mocks__/aws-sdk.ts +++ b/packages/server/__mocks__/aws-sdk.ts @@ -1,7 +1,7 @@ module AwsMock { const aws: any = {} - const response = (body: any) => () => ({promise: () => body}) + const response = (body: any) => () => ({ promise: () => body }) function DocumentClient() { // @ts-ignore @@ -39,9 +39,9 @@ module AwsMock { ) } - aws.DynamoDB = {DocumentClient} + aws.DynamoDB = { DocumentClient } aws.S3 = S3 - aws.config = {update: jest.fn()} + aws.config = { update: jest.fn() } module.exports = aws -} \ No newline at end of file +} diff --git a/packages/server/__mocks__/mongodb.ts b/packages/server/__mocks__/mongodb.ts index 06eefefea6..2a03dc7a7b 100644 --- a/packages/server/__mocks__/mongodb.ts +++ b/packages/server/__mocks__/mongodb.ts @@ -5,15 +5,14 @@ module MongoMock { this.connect = jest.fn() this.close = jest.fn() this.insertOne = jest.fn() - this.insertMany = jest.fn(() => ({toArray: () => []})) - this.find = jest.fn(() => ({toArray: () => []})) + this.insertMany = jest.fn(() => ({ toArray: () => [] })) + this.find = jest.fn(() => ({ toArray: () => [] })) this.findOne = jest.fn() this.count = jest.fn() this.deleteOne = jest.fn() - this.deleteMany = jest.fn(() => ({toArray: () => []})) + this.deleteMany = jest.fn(() => ({ toArray: () => [] })) this.updateOne = jest.fn() - this.updateMany = jest.fn(() => ({toArray: () => []})) - + this.updateMany = jest.fn(() => ({ toArray: () => [] })) this.collection = jest.fn(() => ({ insertOne: this.insertOne, diff --git a/packages/server/__mocks__/mssql.ts b/packages/server/__mocks__/mssql.ts index 90185f4eef..cdfb7d520e 100644 --- a/packages/server/__mocks__/mssql.ts +++ b/packages/server/__mocks__/mssql.ts @@ -10,15 +10,15 @@ module MsSqlMock { ], })) -// mssql.connect = jest.fn(() => ({ recordset: [] })) + // mssql.connect = jest.fn(() => ({ recordset: [] })) mssql.ConnectionPool = jest.fn(() => ({ connect: jest.fn(() => ({ request: jest.fn(() => ({ - query: jest.fn(sql => ({ recordset: [ sql ] })), + query: jest.fn(sql => ({ recordset: [sql] })), })), })), })) module.exports = mssql -} \ No newline at end of file +} diff --git a/packages/server/__mocks__/node-fetch.ts b/packages/server/__mocks__/node-fetch.ts index 5f5e53657d..2daa34e36b 100644 --- a/packages/server/__mocks__/node-fetch.ts +++ b/packages/server/__mocks__/node-fetch.ts @@ -62,7 +62,8 @@ module FetchMock { return json({ url, opts, - value: "", + value: + '', }) } else if (url.includes("failonce.com")) { failCount++ diff --git a/packages/server/__mocks__/pg.ts b/packages/server/__mocks__/pg.ts index ba7803f9a8..af2ae24a97 100644 --- a/packages/server/__mocks__/pg.ts +++ b/packages/server/__mocks__/pg.ts @@ -10,16 +10,14 @@ module PgMock { ], })) -// constructor - function Client() { - } + // constructor + function Client() {} Client.prototype.query = query Client.prototype.connect = jest.fn() Client.prototype.release = jest.fn() - function Pool() { - } + function Pool() {} const on = jest.fn() Pool.prototype.query = query diff --git a/packages/server/scripts/likeCypress.ts b/packages/server/scripts/likeCypress.ts index 625b4386e1..834cf32792 100644 --- a/packages/server/scripts/likeCypress.ts +++ b/packages/server/scripts/likeCypress.ts @@ -30,4 +30,4 @@ process.env.ALLOW_DEV_AUTOMATIONS = "1" const server = require("../src/app") process.env.PORT = WORKER_PORT const worker = require("../../worker/src/index") -process.env.PORT = MAIN_PORT \ No newline at end of file +process.env.PORT = MAIN_PORT diff --git a/packages/server/src/integrations/utils.ts b/packages/server/src/integrations/utils.ts index b8c96efffe..b9e643e26a 100644 --- a/packages/server/src/integrations/utils.ts +++ b/packages/server/src/integrations/utils.ts @@ -153,8 +153,15 @@ export function isIsoDateString(str: string) { * @param column The column to check, to see if it is a valid relationship. * @param tableIds The IDs of the tables which currently exist. */ -function shouldCopyRelationship(column: { type: string, tableId?: string }, tableIds: [string]) { - return column.type === FieldTypes.LINK && column.tableId && tableIds.includes(column.tableId) +function shouldCopyRelationship( + column: { type: string; tableId?: string }, + tableIds: [string] +) { + return ( + column.type === FieldTypes.LINK && + column.tableId && + tableIds.includes(column.tableId) + ) } /** @@ -165,9 +172,15 @@ function shouldCopyRelationship(column: { type: string, tableId?: string }, tabl * @param column The column to check for options or boolean type. * @param fetchedColumn The fetched column to check for the type in the external database. */ -function shouldCopySpecialColumn(column: { type: string }, fetchedColumn: { type: string } | undefined) { - return column.type === FieldTypes.OPTIONS || - ((!fetchedColumn || fetchedColumn.type === FieldTypes.NUMBER) && column.type === FieldTypes.BOOLEAN) +function shouldCopySpecialColumn( + column: { type: string }, + fetchedColumn: { type: string } | undefined +) { + return ( + column.type === FieldTypes.OPTIONS || + ((!fetchedColumn || fetchedColumn.type === FieldTypes.NUMBER) && + column.type === FieldTypes.BOOLEAN) + ) } /**