Browse Source

chore(nocodb): lint

pull/5261/head
Wing-Kam Wong 2 years ago
parent
commit
f55e904382
  1. 5
      packages/nocodb/src/lib/controllers/dbData/dataAliasExport.ctl.ts
  2. 2
      packages/nocodb/src/lib/controllers/viewColumn.ctl.ts
  3. 6
      packages/nocodb/src/lib/db/sql-client/lib/sqlite/SqliteClient.ts
  4. 2
      packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts
  5. 2
      packages/nocodb/src/lib/plugins/gcs/Gcs.ts
  6. 2
      packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts
  7. 2
      packages/nocodb/src/lib/plugins/mino/Minio.ts
  8. 2
      packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts
  9. 2
      packages/nocodb/src/lib/plugins/s3/S3.ts
  10. 2
      packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts
  11. 2
      packages/nocodb/src/lib/plugins/spaces/Spaces.ts
  12. 2
      packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts
  13. 2
      packages/nocodb/src/lib/plugins/vultr/Vultr.ts
  14. 3
      packages/nocodb/src/lib/services/projectUser.svs.ts
  15. 2
      packages/nocodb/src/lib/services/sync/helpers/EntityMap.ts
  16. 2
      packages/nocodb/src/lib/version-upgrader/ncAttachmentUpgrader_0104002.ts
  17. 18
      packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0104004.ts
  18. 6
      packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0105003.ts
  19. 2
      packages/nocodb/src/schema/swagger.json

5
packages/nocodb/src/lib/controllers/dbData/dataAliasExport.ctl.ts

@ -3,10 +3,7 @@ import * as XLSX from 'xlsx';
import apiMetrics from '../../meta/helpers/apiMetrics';
import ncMetaAclMw from '../../meta/helpers/ncMetaAclMw';
import { View } from '../../models';
import {
extractCsvData,
extractXlsxData,
} from '../../services/dbData/helpers';
import { extractCsvData, extractXlsxData } from '../../services/dbData/helpers';
import { getViewAndModelFromRequestByAliasOrId } from './helpers';
async function excelDataExport(req: Request, res: Response) {

2
packages/nocodb/src/lib/controllers/viewColumn.ctl.ts

@ -44,4 +44,4 @@ router.patch(
metaApiMetrics,
ncMetaAclMw(columnUpdate, 'viewColumnUpdate')
);
export default router;
export default router;

6
packages/nocodb/src/lib/db/sql-client/lib/sqlite/SqliteClient.ts

@ -2006,7 +2006,7 @@ class SqliteClient extends KnexClient {
if (change === 2) {
const suffix = nanoid();
let backupOldColumnQuery = this.genQuery(
const backupOldColumnQuery = this.genQuery(
`ALTER TABLE ?? RENAME COLUMN ?? TO ??;`,
[t, o.cn, `${o.cno}_nc_${suffix}`],
shouldSanitize
@ -2031,13 +2031,13 @@ class SqliteClient extends KnexClient {
shouldSanitize
);
let updateNewColumnQuery = this.genQuery(
const updateNewColumnQuery = this.genQuery(
`UPDATE ?? SET ?? = ??;`,
[t, n.cn, `${o.cno}_nc_${suffix}`],
shouldSanitize
);
let dropOldColumnQuery = this.genQuery(
const dropOldColumnQuery = this.genQuery(
`ALTER TABLE ?? DROP COLUMN ??;`,
[t, `${o.cno}_nc_${suffix}`],
shouldSanitize

2
packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts

@ -4,8 +4,8 @@ import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
import {
waitForStreamClose,
generateTempFilePath,
waitForStreamClose,
} from '../../utils/pluginUtils';
export default class Backblaze implements IStorageAdapterV2 {

2
packages/nocodb/src/lib/plugins/gcs/Gcs.ts

@ -4,8 +4,8 @@ import { Storage, StorageOptions } from '@google-cloud/storage';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
import {
waitForStreamClose,
generateTempFilePath,
waitForStreamClose,
} from '../../utils/pluginUtils';
export default class Gcs implements IStorageAdapterV2 {

2
packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts

@ -4,8 +4,8 @@ import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
import {
waitForStreamClose,
generateTempFilePath,
waitForStreamClose,
} from '../../utils/pluginUtils';
export default class LinodeObjectStorage implements IStorageAdapterV2 {

2
packages/nocodb/src/lib/plugins/mino/Minio.ts

@ -4,8 +4,8 @@ import { Client as MinioClient } from 'minio';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
import {
waitForStreamClose,
generateTempFilePath,
waitForStreamClose,
} from '../../utils/pluginUtils';
export default class Minio implements IStorageAdapterV2 {

2
packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts

@ -4,8 +4,8 @@ import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
import {
waitForStreamClose,
generateTempFilePath,
waitForStreamClose,
} from '../../utils/pluginUtils';
export default class OvhCloud implements IStorageAdapterV2 {

2
packages/nocodb/src/lib/plugins/s3/S3.ts

@ -4,8 +4,8 @@ import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
import {
waitForStreamClose,
generateTempFilePath,
waitForStreamClose,
} from '../../utils/pluginUtils';
export default class S3 implements IStorageAdapterV2 {

2
packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts

@ -4,8 +4,8 @@ import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import AWS from 'aws-sdk';
import request from 'request';
import {
waitForStreamClose,
generateTempFilePath,
waitForStreamClose,
} from '../../utils/pluginUtils';
export default class ScalewayObjectStorage implements IStorageAdapterV2 {

2
packages/nocodb/src/lib/plugins/spaces/Spaces.ts

@ -4,8 +4,8 @@ import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
import {
waitForStreamClose,
generateTempFilePath,
waitForStreamClose,
} from '../../utils/pluginUtils';
export default class Spaces implements IStorageAdapterV2 {

2
packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts

@ -4,8 +4,8 @@ import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
import {
waitForStreamClose,
generateTempFilePath,
waitForStreamClose,
} from '../../utils/pluginUtils';
export default class UpoCloud implements IStorageAdapterV2 {

2
packages/nocodb/src/lib/plugins/vultr/Vultr.ts

@ -4,8 +4,8 @@ import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
import {
waitForStreamClose,
generateTempFilePath,
waitForStreamClose,
} from '../../utils/pluginUtils';
export default class Vultr implements IStorageAdapterV2 {

3
packages/nocodb/src/lib/services/projectUser.svs.ts

@ -291,8 +291,7 @@ export async function sendInviteEmail(
req: any
): Promise<any> {
try {
const template = (await import('./user/ui/emailTemplates/invite'))
.default;
const template = (await import('./user/ui/emailTemplates/invite')).default;
const emailAdapter = await NcPluginMgrv2.emailAdapter();

2
packages/nocodb/src/lib/services/sync/helpers/EntityMap.ts

@ -180,7 +180,7 @@ class DBStream extends Readable {
}
_read() {
let stream = this;
const stream = this;
this.stmt.get(function (err, result) {
if (err) {
stream.emit('error', err);

2
packages/nocodb/src/lib/version-upgrader/ncAttachmentUpgrader_0104002.ts

@ -135,7 +135,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
corruptedAttachment.length - 1
)}]`
);
let newAttachmentMeta = [];
const newAttachmentMeta = [];
for (const attachment of corruptedAttachment) {
newAttachmentMeta.push(JSON.parse(attachment));
}

18
packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0104004.ts

@ -4,7 +4,7 @@ import NcMetaIO from '../meta/NcMetaIO';
import Column from '../models/Column';
import Filter from '../models/Filter';
import Project from '../models/Project';
import { UITypes, SelectOptionsType } from 'nocodb-sdk';
import { SelectOptionsType, UITypes } from 'nocodb-sdk';
// as of 0.104.3, almost all filter operators are available to all column types
// while some of them aren't supposed to be shown
@ -35,7 +35,7 @@ import { UITypes, SelectOptionsType } from 'nocodb-sdk';
// - migrate `empty`, `null` to `blank`
const removeEqualFilters = (filter, ncMeta) => {
let actions = [];
const actions = [];
// remove `is equal`, `is not equal`
if (['eq', 'neq'].includes(filter.comparison_op)) {
actions.push(Filter.delete(filter.id, ncMeta));
@ -44,7 +44,7 @@ const removeEqualFilters = (filter, ncMeta) => {
};
const removeArithmeticFilters = (filter, ncMeta) => {
let actions = [];
const actions = [];
// remove `>`, `<`, `>=`, `<=`
if (['gt', 'lt', 'gte', 'lte'].includes(filter.comparison_op)) {
actions.push(Filter.delete(filter.id, ncMeta));
@ -53,7 +53,7 @@ const removeArithmeticFilters = (filter, ncMeta) => {
};
const removeLikeFilters = (filter, ncMeta) => {
let actions = [];
const actions = [];
// remove `is like`, `is not like`
if (['like', 'nlike'].includes(filter.comparison_op)) {
actions.push(Filter.delete(filter.id, ncMeta));
@ -62,7 +62,7 @@ const removeLikeFilters = (filter, ncMeta) => {
};
const migrateNullAndEmptyToBlankFilters = (filter, ncMeta) => {
let actions = [];
const actions = [];
if (['empty', 'null'].includes(filter.comparison_op)) {
// migrate to blank
actions.push(
@ -101,7 +101,7 @@ const migrateMultiSelectEq = async (filter, col: Column, ncMeta) => {
// retrieve the possible col options
const colOptions = (await col.getColOptions()) as SelectOptionsType;
// only include valid options as the input value becomes dropdown type now
let validOptions = [];
const validOptions = [];
for (const option of options) {
if (colOptions.options.includes(option)) {
validOptions.push(option);
@ -112,7 +112,7 @@ const migrateMultiSelectEq = async (filter, col: Column, ncMeta) => {
if (!newFilterValue) {
return await Filter.delete(filter.id, ncMeta);
}
let actions = [];
const actions = [];
if (filter.comparison_op === 'eq') {
// migrate to `contains all of`
actions.push(
@ -142,7 +142,7 @@ const migrateMultiSelectEq = async (filter, col: Column, ncMeta) => {
};
const migrateToCheckboxFilter = (filter, ncMeta) => {
let actions = [];
const actions = [];
const possibleTrueValues = ['true', 'True', '1', 'T', 'Y'];
const possibleFalseValues = ['false', 'False', '0', 'F', 'N'];
if (['empty', 'null'].includes(filter.comparison_op)) {
@ -302,7 +302,7 @@ async function updateProjectMeta(ncMeta: NcMetaIO) {
const filters = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP);
let actions = [];
const actions = [];
for (const filter of filters) {
if (

6
packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0105003.ts

@ -21,7 +21,7 @@ import { UITypes } from 'nocodb-sdk';
// - add `exact date` in comparison_sub_op for existing filters `eq` and `neq`
function removeLikeAndNlikeFilters(filter: Filter, ncMeta: NcMetaIO) {
let actions = [];
const actions = [];
// remove `is like` and `is not like`
if (['like', 'nlike'].includes(filter.comparison_op)) {
actions.push(Filter.delete(filter.id, ncMeta));
@ -30,7 +30,7 @@ function removeLikeAndNlikeFilters(filter: Filter, ncMeta: NcMetaIO) {
}
function migrateEqAndNeqFilters(filter: Filter, ncMeta: NcMetaIO) {
let actions = [];
const actions = [];
// remove `is like` and `is not like`
if (['eq', 'neq'].includes(filter.comparison_op)) {
actions.push(
@ -47,7 +47,7 @@ function migrateEqAndNeqFilters(filter: Filter, ncMeta: NcMetaIO) {
}
function migrateEmptyAndNullFilters(filter: Filter, ncMeta: NcMetaIO) {
let actions = [];
const actions = [];
// remove `is like` and `is not like`
if (['empty', 'null'].includes(filter.comparison_op)) {
// migrate to blank

2
packages/nocodb/src/schema/swagger.json

@ -8146,7 +8146,7 @@
},
"userCount": {
"type": "integer",
"description": "Total user Count"
"description": "Total user Count"
},
"sharedBaseCount": {
"type": "integer",

Loading…
Cancel
Save