diff --git a/.github/workflows/test_database.yml b/.github/workflows/test_database.yml index ac313ff34..a234c7eec 100644 --- a/.github/workflows/test_database.yml +++ b/.github/workflows/test_database.yml @@ -42,6 +42,11 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + - name: Set Node.js version + uses: actions/setup-node@v4 + with: + node-version: '18.20.7' + - name: Database | docker-compose run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach mariadb diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 0f1fe278c..50de7090b 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -9,6 +9,11 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + + - name: Set Node.js version + uses: actions/setup-node@v4 + with: + node-version: '18.20.7' - name: install bun uses: oven-sh/setup-bun@v2 diff --git a/backend/@types/random-bigint/index.d.ts b/backend/@types/random-bigint/index.d.ts index 0f685e722..9692fcbf7 100644 --- a/backend/@types/random-bigint/index.d.ts +++ b/backend/@types/random-bigint/index.d.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/ban-types */ + declare module 'random-bigint' { function random(bits: number, cb?: (err: Error, num: BigInt) => void): BigInt export = random diff --git a/backend/@types/sodium-native/index.d.ts b/backend/@types/sodium-native/index.d.ts index 773d85ee5..ec6ebc07b 100644 --- a/backend/@types/sodium-native/index.d.ts +++ b/backend/@types/sodium-native/index.d.ts @@ -1,4 +1,4 @@ -// eslint-disable-next-line import/no-unresolved + export * from '@/node_modules/@types/sodium-native' declare module 'sodium-native' { diff --git a/backend/jest.config.js b/backend/jest.config.js index 1de74762b..1236e7297 100644 --- a/backend/jest.config.js +++ b/backend/jest.config.js @@ -1,5 +1,4 @@ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ -// eslint-disable-next-line import/no-commonjs, import/unambiguous module.exports = { verbose: true, preset: 'ts-jest', @@ -25,22 +24,18 @@ module.exports = { '@typeorm/(.*)': '/src/typeorm/$1', '@test/(.*)': '/test/$1', '@entity/(.*)': - // eslint-disable-next-line n/no-process-env process.env.NODE_ENV === 'development' ? '/../database/entity/$1' : '/../database/build/entity/$1', '@logging/(.*)': - // eslint-disable-next-line n/no-process-env process.env.NODE_ENV === 'development' ? '/../database/logging/$1' : '/../database/build/logging/$1', '@dbTools/(.*)': - // eslint-disable-next-line n/no-process-env process.env.NODE_ENV === 'development' ? '/../database/src/$1' : '/../database/build/src/$1', '@config/(.*)': - // eslint-disable-next-line n/no-process-env process.env.NODE_ENV === 'development' ? '/../config/src/$1' : '/../config/build/$1', diff --git a/backend/src/apis/humhub/model/Account.ts b/backend/src/apis/humhub/model/Account.ts index 636ae36c5..2aeacc612 100644 --- a/backend/src/apis/humhub/model/Account.ts +++ b/backend/src/apis/humhub/model/Account.ts @@ -1,4 +1,3 @@ -/* eslint-disable camelcase */ import { User } from 'database' import { convertGradidoLanguageToHumhub } from '@/apis/humhub/convertLanguage' diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 10688a236..8115fafd8 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -1,6 +1,5 @@ // ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env) -// eslint-disable-next-line import/no-unresolved import { validate } from 'config-schema' import { latestDbVersion } from 'database' import { Decimal } from 'decimal.js-light' diff --git a/backend/src/server/LogError.test.ts b/backend/src/server/LogError.test.ts index 88c342709..431b60e6e 100644 --- a/backend/src/server/LogError.test.ts +++ b/backend/src/server/LogError.test.ts @@ -4,13 +4,11 @@ import { LogError } from './LogError' describe('LogError', () => { it('logs an Error when created', () => { - /* eslint-disable-next-line no-new */ new LogError('new LogError') expect(logger.error).toBeCalledWith('new LogError') }) it('logs an Error including additional data when created', () => { - /* eslint-disable-next-line no-new */ new LogError('new LogError', { some: 'data' }) expect(logger.error).toBeCalledWith('new LogError', { some: 'data' }) }) @@ -18,7 +16,6 @@ describe('LogError', () => { it('does not contain additional data in Error object when thrown', () => { try { throw new LogError('new LogError', { someWeirdValue123: 'arbitraryData456' }) - /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ } catch (e: any) { expect(e.stack).not.toMatch(/(someWeirdValue123|arbitraryData456)/i) } diff --git a/backend/test/extensions.ts b/backend/test/extensions.ts index 262a9bcdb..cf334c87c 100644 --- a/backend/test/extensions.ts +++ b/backend/test/extensions.ts @@ -1,9 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable @typescript-eslint/no-empty-interface */ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ - import { Decimal } from 'decimal.js-light' expect.extend({ @@ -28,7 +22,6 @@ interface CustomMatchers { } declare global { - // eslint-disable-next-line @typescript-eslint/no-namespace namespace jest { interface Expect extends CustomMatchers {} interface Matchers extends CustomMatchers {} diff --git a/backend/test/helpers.ts b/backend/test/helpers.ts index 0c8d7a7a5..6d567f029 100644 --- a/backend/test/helpers.ts +++ b/backend/test/helpers.ts @@ -1,10 +1,3 @@ -/* eslint-disable @typescript-eslint/unbound-method */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ - import { createTestClient } from 'apollo-server-testing' import { entities } from 'database' diff --git a/backend/test/testSetup.ts b/backend/test/testSetup.ts index 74021f0a3..02c325794 100644 --- a/backend/test/testSetup.ts +++ b/backend/test/testSetup.ts @@ -1,4 +1,3 @@ -// eslint-disable-next-line import/no-unassigned-import import 'openai/shims/node' import { CONFIG } from '@/config' import { i18n } from '@/server/localization' diff --git a/database/package.json b/database/package.json index c4b9b5fca..94018860f 100644 --- a/database/package.json +++ b/database/package.json @@ -17,12 +17,12 @@ "scripts": { "build": "tsx ./esbuild.config.ts", "typecheck": "tsc --noEmit", + "lint": "biome check --error-on-warnings .", + "lint:fix": "biome check --error-on-warnings . --write", + "clear": "cross-env TZ=UTC tsx src/index.ts clear", "up": "cross-env TZ=UTC tsx src/index.ts up", "down": "cross-env TZ=UTC tsx src/index.ts down", "reset": "cross-env TZ=UTC tsx src/index.ts reset", - "clear": "cross-env TZ=UTC tsx src/index.ts clear", - "lint": "biome check --error-on-warnings .", - "lint:fix": "biome check --error-on-warnings . --write", "up:backend_test": "cross-env TZ=UTC DB_DATABASE=gradido_test_backend tsx src/index.ts up", "up:federation_test": "cross-env TZ=UTC DB_DATABASE=gradido_test_federation tsx src/index.ts up", "up:dht_test": "cross-env TZ=UTC DB_DATABASE=gradido_test_dht tsx src/index.ts up" diff --git a/database/src/prepare.ts b/database/src/prepare.ts index fc359c226..e910d5620 100644 --- a/database/src/prepare.ts +++ b/database/src/prepare.ts @@ -41,6 +41,16 @@ async function convertJsToTsInMigrations(connection: Connection): Promise { + const [result] = await connection.query(` + UPDATE ${CONFIG.MIGRATIONS_TABLE} + SET fileName = REPLACE(fileName, '.js', '.ts') + WHERE fileName LIKE '%.js' + `) + + return result.affectedRows +} + export const getDatabaseState = async (): Promise => { const connection = await connectToDatabaseServer() if (!connection) { diff --git a/database/turbo.json b/database/turbo.json index ef38daaeb..8339cc11f 100644 --- a/database/turbo.json +++ b/database/turbo.json @@ -14,13 +14,16 @@ "cache": false }, "up": { - "cache": false + "cache": false, + "dependsOn": ["build"] }, "down": { - "cache": false + "cache": false, + "dependsOn": ["build"] }, "reset": { - "cache": false + "cache": false, + "dependsOn": ["build"] } } } \ No newline at end of file diff --git a/dht-node/jest.config.js b/dht-node/jest.config.js index b0842b949..18170ac48 100644 --- a/dht-node/jest.config.js +++ b/dht-node/jest.config.js @@ -1,5 +1,4 @@ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ -// eslint-disable-next-line import/no-commonjs, import/unambiguous module.exports = { verbose: true, preset: 'ts-jest', diff --git a/dht-node/src/config/index.ts b/dht-node/src/config/index.ts index 60a6d3b90..3c041e2ac 100644 --- a/dht-node/src/config/index.ts +++ b/dht-node/src/config/index.ts @@ -1,4 +1,3 @@ -/* eslint-disable n/no-process-env */ import { validate } from 'config-schema' import { latestDbVersion } from 'database' import dotenv from 'dotenv' diff --git a/dht-node/src/dht_node/index.test.ts b/dht-node/src/dht_node/index.test.ts index 381a17f74..5ffc3cb5f 100644 --- a/dht-node/src/dht_node/index.test.ts +++ b/dht-node/src/dht_node/index.test.ts @@ -1,6 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ - import DHT from '@hyperswarm/dht' import { Community as DbCommunity, FederatedCommunity as DbFederatedCommunity } from 'database' import { validate as validateUUID, version as versionUUID } from 'uuid' diff --git a/dht-node/src/dht_node/index.ts b/dht-node/src/dht_node/index.ts index fe13353e0..69cf86681 100644 --- a/dht-node/src/dht_node/index.ts +++ b/dht-node/src/dht_node/index.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import DHT from '@hyperswarm/dht' import { CommunityLoggingView, diff --git a/federation/jest.config.js b/federation/jest.config.js index 17386f225..44ddf9bf5 100644 --- a/federation/jest.config.js +++ b/federation/jest.config.js @@ -25,7 +25,6 @@ module.exports = { ? '/../database/entity/$1' : '/../database/build/entity/$1', '@logging/(.*)': - // eslint-disable-next-line n/no-process-env process.env.NODE_ENV === 'development' ? '/../database/logging/$1' : '/../database/build/logging/$1', @@ -34,7 +33,6 @@ module.exports = { ? '/../database/src/$1' : '/../database/build/src/$1', '@config/(.*)': - // eslint-disable-next-line n/no-process-env process.env.NODE_ENV === 'development' ? '/../config/src/$1' : '/../config/build/$1',