run prettier + lint over typescript files as well

This commit is contained in:
Maurits Lourens 2022-01-20 09:17:08 +01:00
parent 8fa522cff0
commit 2577a6631a
9 changed files with 38 additions and 27 deletions

View File

@ -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",

View File

@ -9,7 +9,7 @@ module ArangoMock {
this.close = jest.fn()
}
// @ts-ignore
// @ts-ignore
arangodb.aql = (strings, ...args) => {
let str = strings.join("{}")

View File

@ -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
}
}

View File

@ -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,

View File

@ -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
}
}

View File

@ -62,7 +62,8 @@ module FetchMock {
return json({
url,
opts,
value: "<!doctype html><html itemscope=\"\" itemtype=\"http://schema.org/WebPage\" lang=\"en-GB\"></html>",
value:
'<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en-GB"></html>',
})
} else if (url.includes("failonce.com")) {
failCount++

View File

@ -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

View File

@ -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
process.env.PORT = MAIN_PORT

View File

@ -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)
)
}
/**