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", "dev:server": "lerna run --parallel dev:builder --concurrency 1 --scope @budibase/worker --scope @budibase/server",
"test": "lerna run test", "test": "lerna run test",
"lint:eslint": "eslint packages", "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": "yarn run lint:eslint && yarn run lint:prettier",
"lint:fix:eslint": "eslint --fix packages", "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:ts": "lerna run lint:fix",
"lint:fix": "yarn run lint:fix:ts && yarn run lint:fix:prettier && yarn run lint:fix:eslint", "lint:fix": "yarn run lint:fix:ts && yarn run lint:fix:prettier && yarn run lint:fix:eslint",
"test:e2e": "lerna run cy:test", "test:e2e": "lerna run cy:test",

View File

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

View File

@ -1,7 +1,7 @@
module AwsMock { module AwsMock {
const aws: any = {} const aws: any = {}
const response = (body: any) => () => ({promise: () => body}) const response = (body: any) => () => ({ promise: () => body })
function DocumentClient() { function DocumentClient() {
// @ts-ignore // @ts-ignore
@ -39,9 +39,9 @@ module AwsMock {
) )
} }
aws.DynamoDB = {DocumentClient} aws.DynamoDB = { DocumentClient }
aws.S3 = S3 aws.S3 = S3
aws.config = {update: jest.fn()} aws.config = { update: jest.fn() }
module.exports = aws module.exports = aws
} }

View File

@ -5,15 +5,14 @@ module MongoMock {
this.connect = jest.fn() this.connect = jest.fn()
this.close = jest.fn() this.close = jest.fn()
this.insertOne = jest.fn() this.insertOne = jest.fn()
this.insertMany = jest.fn(() => ({toArray: () => []})) this.insertMany = jest.fn(() => ({ toArray: () => [] }))
this.find = jest.fn(() => ({toArray: () => []})) this.find = jest.fn(() => ({ toArray: () => [] }))
this.findOne = jest.fn() this.findOne = jest.fn()
this.count = jest.fn() this.count = jest.fn()
this.deleteOne = jest.fn() this.deleteOne = jest.fn()
this.deleteMany = jest.fn(() => ({toArray: () => []})) this.deleteMany = jest.fn(() => ({ toArray: () => [] }))
this.updateOne = jest.fn() this.updateOne = jest.fn()
this.updateMany = jest.fn(() => ({toArray: () => []})) this.updateMany = jest.fn(() => ({ toArray: () => [] }))
this.collection = jest.fn(() => ({ this.collection = jest.fn(() => ({
insertOne: this.insertOne, insertOne: this.insertOne,

View File

@ -10,12 +10,12 @@ module MsSqlMock {
], ],
})) }))
// mssql.connect = jest.fn(() => ({ recordset: [] })) // mssql.connect = jest.fn(() => ({ recordset: [] }))
mssql.ConnectionPool = jest.fn(() => ({ mssql.ConnectionPool = jest.fn(() => ({
connect: jest.fn(() => ({ connect: jest.fn(() => ({
request: jest.fn(() => ({ request: jest.fn(() => ({
query: jest.fn(sql => ({ recordset: [ sql ] })), query: jest.fn(sql => ({ recordset: [sql] })),
})), })),
})), })),
})) }))

View File

@ -62,7 +62,8 @@ module FetchMock {
return json({ return json({
url, url,
opts, 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")) { } else if (url.includes("failonce.com")) {
failCount++ failCount++

View File

@ -10,16 +10,14 @@ module PgMock {
], ],
})) }))
// constructor // constructor
function Client() { function Client() {}
}
Client.prototype.query = query Client.prototype.query = query
Client.prototype.connect = jest.fn() Client.prototype.connect = jest.fn()
Client.prototype.release = jest.fn() Client.prototype.release = jest.fn()
function Pool() { function Pool() {}
}
const on = jest.fn() const on = jest.fn()
Pool.prototype.query = query Pool.prototype.query = query

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 column The column to check, to see if it is a valid relationship.
* @param tableIds The IDs of the tables which currently exist. * @param tableIds The IDs of the tables which currently exist.
*/ */
function shouldCopyRelationship(column: { type: string, tableId?: string }, tableIds: [string]) { function shouldCopyRelationship(
return column.type === FieldTypes.LINK && column.tableId && tableIds.includes(column.tableId) 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 column The column to check for options or boolean type.
* @param fetchedColumn The fetched column to check for the type in the external database. * @param fetchedColumn The fetched column to check for the type in the external database.
*/ */
function shouldCopySpecialColumn(column: { type: string }, fetchedColumn: { type: string } | undefined) { function shouldCopySpecialColumn(
return column.type === FieldTypes.OPTIONS || column: { type: string },
((!fetchedColumn || fetchedColumn.type === FieldTypes.NUMBER) && column.type === FieldTypes.BOOLEAN) fetchedColumn: { type: string } | undefined
) {
return (
column.type === FieldTypes.OPTIONS ||
((!fetchedColumn || fetchedColumn.type === FieldTypes.NUMBER) &&
column.type === FieldTypes.BOOLEAN)
)
} }
/** /**