From c69941609a03edbab00bc26ece0b42bf30b59c47 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 25 Aug 2023 12:45:08 +0800 Subject: [PATCH] chore(nocodb): lint --- packages/nocodb/src/db/sql-mgr/v2/SqlMgrv2Trans.ts | 2 +- packages/nocodb/src/models/Audit.ts | 4 ++-- packages/nocodb/src/models/Base.ts | 2 +- packages/nocodb/src/models/Filter.ts | 4 ++-- packages/nocodb/src/models/Project.ts | 2 +- packages/nocodb/src/models/RollupColumn.ts | 2 +- .../src/modules/event-emitter/nestjs-event-emitter.ts | 2 +- packages/nocodb/src/services/app-hooks/interfaces.ts | 3 +-- packages/nocodb/src/services/bulk-data-alias.service.ts | 2 +- .../src/version-upgrader/ncProjectUpgraderV2_0090000.ts | 2 +- .../src/version-upgrader/v1-legacy/BaseApiBuilder.ts | 4 ++-- .../src/version-upgrader/v1-legacy/NcProjectBuilder.ts | 4 ++-- .../src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts | 8 ++++---- .../src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts | 8 ++++---- 14 files changed, 24 insertions(+), 25 deletions(-) diff --git a/packages/nocodb/src/db/sql-mgr/v2/SqlMgrv2Trans.ts b/packages/nocodb/src/db/sql-mgr/v2/SqlMgrv2Trans.ts index 19f7d6a0ac..1d77065af0 100644 --- a/packages/nocodb/src/db/sql-mgr/v2/SqlMgrv2Trans.ts +++ b/packages/nocodb/src/db/sql-mgr/v2/SqlMgrv2Trans.ts @@ -1,8 +1,8 @@ import KnexMigratorv2Tans from '../../sql-migrator/lib/KnexMigratorv2Tans'; import SqlMgrv2 from './SqlMgrv2'; -import type Base from '~/models/Base'; import type { Knex } from 'knex'; import type { XKnex } from '../../CustomKnex'; +import Base from '~/models/Base'; import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; export default class SqlMgrv2Trans extends SqlMgrv2 { diff --git a/packages/nocodb/src/models/Audit.ts b/packages/nocodb/src/models/Audit.ts index 0397ca5ddc..5ab2b4e2db 100644 --- a/packages/nocodb/src/models/Audit.ts +++ b/packages/nocodb/src/models/Audit.ts @@ -54,8 +54,8 @@ export default class Audit implements AuditType { project_id?: string; fk_model_id?: string; row_id?: string; - op_type?: typeof opTypes[number]; - op_sub_type?: typeof opSubTypes[number]; + op_type?: (typeof opTypes)[number]; + op_sub_type?: (typeof opSubTypes)[number]; status?: string; description?: string; details?: string; diff --git a/packages/nocodb/src/models/Base.ts b/packages/nocodb/src/models/Base.ts index cb61b78dee..6ef1dceab1 100644 --- a/packages/nocodb/src/models/Base.ts +++ b/packages/nocodb/src/models/Base.ts @@ -23,7 +23,7 @@ export default class Base implements BaseType { id?: string; project_id?: string; alias?: string; - type?: typeof DB_TYPES[number]; + type?: (typeof DB_TYPES)[number]; is_meta?: BoolType; config?: string; inflection_column?: string; diff --git a/packages/nocodb/src/models/Filter.ts b/packages/nocodb/src/models/Filter.ts index 3ac5654e80..2c5fbb7339 100644 --- a/packages/nocodb/src/models/Filter.ts +++ b/packages/nocodb/src/models/Filter.ts @@ -25,8 +25,8 @@ export default class Filter implements FilterType { fk_column_id?: string; fk_parent_id?: string; - comparison_op?: typeof COMPARISON_OPS[number]; - comparison_sub_op?: typeof COMPARISON_SUB_OPS[number]; + comparison_op?: (typeof COMPARISON_OPS)[number]; + comparison_sub_op?: (typeof COMPARISON_SUB_OPS)[number]; value?: string; diff --git a/packages/nocodb/src/models/Project.ts b/packages/nocodb/src/models/Project.ts index 804ae2c26a..0a3280e27f 100644 --- a/packages/nocodb/src/models/Project.ts +++ b/packages/nocodb/src/models/Project.ts @@ -72,7 +72,7 @@ export default class Project implements ProjectType { for (const base of project.bases) { await Base.createBase( { - type: base.config?.client as typeof DB_TYPES[number], + type: base.config?.client as (typeof DB_TYPES)[number], ...base, projectId, }, diff --git a/packages/nocodb/src/models/RollupColumn.ts b/packages/nocodb/src/models/RollupColumn.ts index c5c487adb2..1002938936 100644 --- a/packages/nocodb/src/models/RollupColumn.ts +++ b/packages/nocodb/src/models/RollupColumn.ts @@ -20,7 +20,7 @@ export default class RollupColumn implements RollupType { fk_column_id; fk_relation_column_id; fk_rollup_column_id; - rollup_function: typeof ROLLUP_FUNCTIONS[number]; + rollup_function: (typeof ROLLUP_FUNCTIONS)[number]; constructor(data: Partial) { Object.assign(this, data); diff --git a/packages/nocodb/src/modules/event-emitter/nestjs-event-emitter.ts b/packages/nocodb/src/modules/event-emitter/nestjs-event-emitter.ts index dedf7e9fb8..d975fbfbb9 100644 --- a/packages/nocodb/src/modules/event-emitter/nestjs-event-emitter.ts +++ b/packages/nocodb/src/modules/event-emitter/nestjs-event-emitter.ts @@ -1,4 +1,4 @@ -import type { EventEmitter2 } from '@nestjs/event-emitter'; +import { EventEmitter2 } from '@nestjs/event-emitter'; import type { IEventEmitter } from './event-emitter.interface'; export class NestjsEventEmitter implements IEventEmitter { diff --git a/packages/nocodb/src/services/app-hooks/interfaces.ts b/packages/nocodb/src/services/app-hooks/interfaces.ts index ab58667757..16a094c3a9 100644 --- a/packages/nocodb/src/services/app-hooks/interfaces.ts +++ b/packages/nocodb/src/services/app-hooks/interfaces.ts @@ -179,9 +179,8 @@ export interface AttachmentEvent { type: 'url' | 'file'; } -// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface FormColumnEvent {} -// eslint-disable-next-line @typescript-eslint/no-empty-interface + export interface GridColumnEvent {} export interface MetaDiffEvent { diff --git a/packages/nocodb/src/services/bulk-data-alias.service.ts b/packages/nocodb/src/services/bulk-data-alias.service.ts index 6ad732a5be..e35e719f7a 100644 --- a/packages/nocodb/src/services/bulk-data-alias.service.ts +++ b/packages/nocodb/src/services/bulk-data-alias.service.ts @@ -24,7 +24,7 @@ export class BulkDataAliasService { async executeBulkOperation( param: PathParams & { operation: T; - options: Parameters; + options: Parameters<(typeof BaseModelSqlv2.prototype)[T]>; }, ) { const { model, view, base } = await this.getModelViewBase(param); diff --git a/packages/nocodb/src/version-upgrader/ncProjectUpgraderV2_0090000.ts b/packages/nocodb/src/version-upgrader/ncProjectUpgraderV2_0090000.ts index 7a8517df47..567b709d1d 100644 --- a/packages/nocodb/src/version-upgrader/ncProjectUpgraderV2_0090000.ts +++ b/packages/nocodb/src/version-upgrader/ncProjectUpgraderV2_0090000.ts @@ -605,7 +605,7 @@ async function migrateProjectModels( const colBody: Partial = { title: columnMeta._cn, rollup_function: columnMeta.rl - .fn as typeof ROLLUP_FUNCTIONS[number], + .fn as (typeof ROLLUP_FUNCTIONS)[number], }; colBody.fk_rollup_column_id = diff --git a/packages/nocodb/src/version-upgrader/v1-legacy/BaseApiBuilder.ts b/packages/nocodb/src/version-upgrader/v1-legacy/BaseApiBuilder.ts index 8d511723d4..6281456269 100644 --- a/packages/nocodb/src/version-upgrader/v1-legacy/BaseApiBuilder.ts +++ b/packages/nocodb/src/version-upgrader/v1-legacy/BaseApiBuilder.ts @@ -4,13 +4,13 @@ import inflection from 'inflection'; import ncModelsOrderUpgrader from './jobs/ncModelsOrderUpgrader'; import ncParentModelTitleUpgrader from './jobs/ncParentModelTitleUpgrader'; import ncRemoveDuplicatedRelationRows from './jobs/ncRemoveDuplicatedRelationRows'; -import type { DbConfig, NcConfig } from '~/interface/config'; +import NcProjectBuilder from './NcProjectBuilder'; import type { XKnex } from '~/db/CustomKnex'; import type { BaseModelSql } from '~/db/BaseModelSql'; import type { MetaService } from '~/meta/meta.service'; import type Noco from '~/Noco'; -import type NcProjectBuilder from './NcProjectBuilder'; import type { MysqlClient, PgClient, SqlClient } from 'nc-help'; +import { DbConfig, NcConfig } from '~/interface/config'; import ModelXcMetaFactory from '~/db/sql-mgr/code/models/xc/ModelXcMetaFactory'; import NcConnectionMgr from '~/utils/common/NcConnectionMgr'; diff --git a/packages/nocodb/src/version-upgrader/v1-legacy/NcProjectBuilder.ts b/packages/nocodb/src/version-upgrader/v1-legacy/NcProjectBuilder.ts index dcf98c0398..fca7e0ba88 100644 --- a/packages/nocodb/src/version-upgrader/v1-legacy/NcProjectBuilder.ts +++ b/packages/nocodb/src/version-upgrader/v1-legacy/NcProjectBuilder.ts @@ -1,8 +1,8 @@ import { Router } from 'express'; import { GqlApiBuilder } from './gql/GqlApiBuilder'; import { RestApiBuilder } from './rest/RestApiBuilder'; -import type Noco from '~/Noco'; -import type { NcConfig } from '~/interface/config'; +import Noco from '~/Noco'; +import { NcConfig } from '~/interface/config'; import { SqlClientFactory } from '~/db/sql-client/lib/SqlClientFactory'; export default class NcProjectBuilder { diff --git a/packages/nocodb/src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts b/packages/nocodb/src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts index c5f73c19b1..22f8744ab9 100644 --- a/packages/nocodb/src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts +++ b/packages/nocodb/src/version-upgrader/v1-legacy/gql/GqlApiBuilder.ts @@ -1,10 +1,10 @@ import { Router } from 'express'; import BaseApiBuilder from '../BaseApiBuilder'; -import type NcProjectBuilder from '../NcProjectBuilder'; -import type { DbConfig, NcConfig } from '~/interface/config'; +import NcProjectBuilder from '../NcProjectBuilder'; import type XcMetaMgr from '~/interface/XcMetaMgr'; -import type { MetaService } from '~/meta/meta.service'; -import type Noco from '~/Noco'; +import { DbConfig, NcConfig } from '~/interface/config'; +import { MetaService } from '~/meta/meta.service'; +import Noco from '~/Noco'; import GqlXcSchemaFactory from '~/db/sql-mgr/code/gql-schema/xc-ts/GqlXcSchemaFactory'; export class GqlApiBuilder extends BaseApiBuilder implements XcMetaMgr { diff --git a/packages/nocodb/src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts b/packages/nocodb/src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts index 77248f56d3..d5d9b0b897 100644 --- a/packages/nocodb/src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts +++ b/packages/nocodb/src/version-upgrader/v1-legacy/rest/RestApiBuilder.ts @@ -1,10 +1,10 @@ import autoBind from 'auto-bind'; import BaseApiBuilder from '../BaseApiBuilder'; +import NcProjectBuilder from '../NcProjectBuilder'; import type { Router } from 'express'; -import type { DbConfig, NcConfig } from '~/interface/config'; -import type NcProjectBuilder from '../NcProjectBuilder'; -import type { MetaService } from '~/meta/meta.service'; -import type Noco from '~/Noco'; +import { DbConfig, NcConfig } from '~/interface/config'; +import { MetaService } from '~/meta/meta.service'; +import Noco from '~/Noco'; import NcHelp from '~/utils/NcHelp'; import ExpressXcTsRoutes from '~/db/sql-mgr/code/routes/xc-ts/ExpressXcTsRoutes'; import SwaggerXc from '~/db/sql-mgr/code/routers/xc-ts/SwaggerXc';