From 94be14d38647e4a122e409c10c384675e916a333 Mon Sep 17 00:00:00 2001 From: tharvik Date: Mon, 18 Mar 2024 18:20:46 +0100 Subject: [PATCH] TMP eslint 2022 --- .eslintrc.js | 14 - cli/.eslintrc.json | 5 - cli/package.json | 2 +- discojs/discojs-core/package.json | 2 +- discojs/discojs-core/src/models/gpt/index.ts | 4 +- discojs/discojs-core/src/models/gpt/train.ts | 2 +- discojs/discojs-core/src/models/tfjs.ts | 12 +- .../discojs-core/src/serialization/model.ts | 9 +- .../discojs-core/src/serialization/weights.ts | 3 +- discojs/discojs-core/src/task/digest.ts | 2 +- .../src/task/training_information.ts | 4 +- .../training/trainer/distributed_trainer.ts | 4 +- .../src/training/trainer/local_trainer.ts | 6 +- .../src/training/trainer/trainer.ts | 9 +- .../discojs-core/src/validation/validator.ts | 4 +- .../src/weights/aggregation.spec.ts | 6 +- discojs/discojs-node/.eslintrc.json | 5 - discojs/discojs-node/package.json | 2 +- discojs/discojs-web/.eslintrc.json | 5 - discojs/discojs-web/package.json | 2 +- docs/examples/.eslintrc.js | 18 - docs/examples/custom_task.ts | 4 +- .../examples/eslint.config.js | 5 +- docs/examples/package.json | 10 +- docs/examples/training.ts | 2 +- docs/examples/tsconfig.eslint.json | 4 - eslint.config.mjs | 35 ++ package-lock.json | 329 ++++++++++++++++-- package.json | 8 +- server/.eslintrc.json | 5 - server/package.json | 2 +- tsconfig.eslint.json | 2 +- 32 files changed, 386 insertions(+), 140 deletions(-) delete mode 100644 .eslintrc.js delete mode 100644 cli/.eslintrc.json delete mode 100644 discojs/discojs-node/.eslintrc.json delete mode 100644 discojs/discojs-web/.eslintrc.json delete mode 100644 docs/examples/.eslintrc.js rename eslint.config.js => docs/examples/eslint.config.js (77%) delete mode 100644 docs/examples/tsconfig.eslint.json create mode 100644 eslint.config.mjs delete mode 100644 server/.eslintrc.json diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index f268058c0..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,14 +0,0 @@ -// @ts-check - -module.exports = { - root: true, - extends: "standard-with-typescript", - parserOptions: { - project: "./tsconfig.eslint.json", - tsconfigRootDir: __dirname, - }, - ignorePatterns: ["**/dist/", "*.d.ts"], - env: { - mocha: true, - }, -}; diff --git a/cli/.eslintrc.json b/cli/.eslintrc.json deleted file mode 100644 index 10d223883..000000000 --- a/cli/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "env": { - "node": true - } -} diff --git a/cli/package.json b/cli/package.json index d8f3f9079..09052f1ab 100644 --- a/cli/package.json +++ b/cli/package.json @@ -7,7 +7,7 @@ "watch": "nodemon --ext ts --ignore dist --watch ../discojs/discojs-node/dist --watch ../server/dist --watch . --exec npm run", "start": "npm run build && node dist/cli.js", "build": "tsc", - "lint": "npx eslint --ext ts --max-warnings 0 .", + "lint": "npx eslint .", "test": ": nothing" }, "author": "", diff --git a/discojs/discojs-core/package.json b/discojs/discojs-core/package.json index 66475feda..4d922988e 100644 --- a/discojs/discojs-core/package.json +++ b/discojs/discojs-core/package.json @@ -7,7 +7,7 @@ "scripts": { "watch": "nodemon --ext ts --ignore dist --exec npm run", "build": "tsc", - "lint": "npx eslint --ext ts --max-warnings 0 .", + "lint": "npx eslint .", "test": "mocha", "docs": "typedoc ./src/index.ts --theme oxide" }, diff --git a/discojs/discojs-core/src/models/gpt/index.ts b/discojs/discojs-core/src/models/gpt/index.ts index 9314c6f20..19876869b 100644 --- a/discojs/discojs-core/src/models/gpt/index.ts +++ b/discojs/discojs-core/src/models/gpt/index.ts @@ -123,13 +123,13 @@ export class GPT extends Model { } } - override async predict (input: Sample): Promise { + override predict (input: Sample): Promise { const ret = this.model.predict(input) if (Array.isArray(ret)) { throw new Error('prediction yield many Tensors but should have only returned one') } - return ret + return Promise.resolve(ret) } static deserialize (weights: WeightsContainer): Model { diff --git a/discojs/discojs-core/src/models/gpt/train.ts b/discojs/discojs-core/src/models/gpt/train.ts index ade8a0318..13d6d51a7 100644 --- a/discojs/discojs-core/src/models/gpt/train.ts +++ b/discojs/discojs-core/src/models/gpt/train.ts @@ -18,7 +18,7 @@ function getCustomAdam (model: tf.LayersModel, c: Required): tf.Optim const excludeFromWeightDecay: string[] = [] // TODO unsafe cast - const namedWeights = (model as unknown as any).getNamedWeights() as Array<{ name: string, tensor: tf.Tensor }> + const namedWeights = (model as unknown as Record<'getNamedWeights', () => Array<{ name: string, tensor: tf.Tensor }>>).getNamedWeights() namedWeights.forEach((v) => { if ( diff --git a/discojs/discojs-core/src/models/tfjs.ts b/discojs/discojs-core/src/models/tfjs.ts index b9596f95e..403fb0bff 100644 --- a/discojs/discojs-core/src/models/tfjs.ts +++ b/discojs/discojs-core/src/models/tfjs.ts @@ -51,18 +51,18 @@ export class TFJS extends Model { } } - override async predict (input: Sample): Promise { + override predict (input: Sample): Promise { const ret = this.model.predict(input) if (Array.isArray(ret)) { throw new Error('prediction yield many Tensors but should have only returned one') } - return ret + return Promise.resolve(ret) } static async deserialize (raw: tf.io.ModelArtifacts): Promise { return new this(await tf.loadLayersModel({ - load: async () => raw + load: () => Promise.resolve(raw) })) } @@ -71,14 +71,14 @@ export class TFJS extends Model { const ret = new Promise((resolve) => { resolveArtifacts = resolve }) await this.model.save({ - save: async (artifacts) => { + save: (artifacts) => { resolveArtifacts(artifacts) - return { + return Promise.resolve({ modelArtifactsInfo: { dateSaved: new Date(), modelTopologyType: 'JSON' } - } + }) } }, { includeOptimizer: true // keep model compiled diff --git a/discojs/discojs-core/src/serialization/model.ts b/discojs/discojs-core/src/serialization/model.ts index 4d70584b8..e2baa18f6 100644 --- a/discojs/discojs-core/src/serialization/model.ts +++ b/discojs/discojs-core/src/serialization/model.ts @@ -4,7 +4,10 @@ import type tf from '@tensorflow/tfjs' import type { Model } from '../index.js' import { models, serialization } from '../index.js' -const enum Type { TFJS, GPT } +const Type = { + TFJS: 0, + GPT: 1 +} as const export type Encoded = Uint8Array @@ -37,7 +40,7 @@ export async function decode (encoded: unknown): Promise { } const [type, rawModel] = raw as [unknown, unknown] - if (typeof type !== 'number' || (type !== Type.TFJS && type !== Type.GPT)) { + if (typeof type !== 'number') { throw new Error('invalid encoding') } switch (type) { @@ -57,5 +60,7 @@ export async function decode (encoded: unknown): Promise { const serialized = serialization.weights.decode(nums) return models.GPT.deserialize(serialized) } + default: + throw new Error('invalid encoding') } } diff --git a/discojs/discojs-core/src/serialization/weights.ts b/discojs/discojs-core/src/serialization/weights.ts index 910264ad0..0672488db 100644 --- a/discojs/discojs-core/src/serialization/weights.ts +++ b/discojs/discojs-core/src/serialization/weights.ts @@ -24,7 +24,6 @@ function isSerialized (raw: unknown): raw is Serialized { return false } - // eslint-disable-next-line const _: Serialized = {shape, data} return true @@ -48,7 +47,7 @@ export async function encode (weights: WeightsContainer): Promise { } export function decode (encoded: Encoded): WeightsContainer { - const raw = msgpack.decode(encoded) + const raw: unknown = msgpack.decode(encoded) if (!(Array.isArray(raw) && raw.every(isSerialized))) { throw new Error('expected to decode an array of serialized weights') diff --git a/discojs/discojs-core/src/task/digest.ts b/discojs/discojs-core/src/task/digest.ts index c6174cd3a..ebb3559cb 100644 --- a/discojs/discojs-core/src/task/digest.ts +++ b/discojs/discojs-core/src/task/digest.ts @@ -8,7 +8,7 @@ export function isDigest (raw: unknown): raw is Digest { return false } - const { algorithm, value }: Partial> = raw + const { algorithm, value }: Partial> = raw if (!( typeof algorithm === 'string' && diff --git a/discojs/discojs-core/src/task/training_information.ts b/discojs/discojs-core/src/task/training_information.ts index 8b7012122..47f1d9925 100644 --- a/discojs/discojs-core/src/task/training_information.ts +++ b/discojs/discojs-core/src/task/training_information.ts @@ -1,5 +1,5 @@ -import { type AggregatorChoice } from '../aggregator/get.js' -import { type Preprocessing } from '../dataset/data/preprocessing/index.js' +import type { AggregatorChoice } from '../aggregator/get.js' +import type { Preprocessing } from '../dataset/data/preprocessing/index.js' export interface TrainingInformation { // modelID: unique ID for the model diff --git a/discojs/discojs-core/src/training/trainer/distributed_trainer.ts b/discojs/discojs-core/src/training/trainer/distributed_trainer.ts index 90caa8ec5..68c6e0772 100644 --- a/discojs/discojs-core/src/training/trainer/distributed_trainer.ts +++ b/discojs/discojs-core/src/training/trainer/distributed_trainer.ts @@ -31,14 +31,14 @@ export class DistributedTrainer extends Trainer { await this.client.onTrainBeginCommunication(this.model.weights, this.trainingInformant) } - async onRoundBegin (accuracy: number): Promise { + async onRoundBegin (): Promise { await this.client.onRoundBeginCommunication(this.model.weights, this.roundTracker.round, this.trainingInformant) } /** * Callback called every time a round is over */ - async onRoundEnd (accuracy: number): Promise { + async onRoundEnd (): Promise { await this.client.onRoundEndCommunication(this.model.weights, this.roundTracker.round, this.trainingInformant) if (this.aggregator.model !== undefined) { // The aggregator's own aggregation is async. The trainer updates its model to match the aggregator's diff --git a/discojs/discojs-core/src/training/trainer/local_trainer.ts b/discojs/discojs-core/src/training/trainer/local_trainer.ts index b774a33a8..73d7ada80 100644 --- a/discojs/discojs-core/src/training/trainer/local_trainer.ts +++ b/discojs/discojs-core/src/training/trainer/local_trainer.ts @@ -6,9 +6,11 @@ import { Trainer } from './trainer.js' * without any collaborators. */ export class LocalTrainer extends Trainer { - async onRoundBegin (accuracy: number): Promise {} + async onRoundBegin (): Promise { + return await Promise.resolve() + } - async onRoundEnd (accuracy: number): Promise { + async onRoundEnd (): Promise { console.log('on round end') await this.memory.updateWorkingModel( { taskID: this.task.id, name: this.task.trainingInformation.modelID }, diff --git a/discojs/discojs-core/src/training/trainer/trainer.ts b/discojs/discojs-core/src/training/trainer/trainer.ts index e9da7102b..3a8aad1ce 100644 --- a/discojs/discojs-core/src/training/trainer/trainer.ts +++ b/discojs/discojs-core/src/training/trainer/trainer.ts @@ -69,7 +69,8 @@ export abstract class Trainer { } } - protected onEpochBegin (epoch: number, logs?: tf.Logs): void {} + // TODO never used + protected onEpochBegin (_epoch: number, _logs?: tf.Logs): void {} /** * We update the training graph, this needs to be done on epoch end as there is no validation accuracy onBatchEnd. @@ -88,15 +89,17 @@ export abstract class Trainer { } } - protected async onTrainBegin (logs?: tf.Logs): Promise { + protected async onTrainBegin (_logs?: tf.Logs): Promise { this.trainingInformant.addMessage('Training started.') + return await Promise.resolve() } /** * When the training ends this function will be call */ - protected async onTrainEnd (logs?: tf.Logs): Promise { + protected async onTrainEnd (_logs?: tf.Logs): Promise { this.trainingInformant.addMessage('Training finished.') + return await Promise.resolve() } /** diff --git a/discojs/discojs-core/src/validation/validator.ts b/discojs/discojs-core/src/validation/validator.ts index d7969971d..64ce0f174 100644 --- a/discojs/discojs-core/src/validation/validator.ts +++ b/discojs/discojs-core/src/validation/validator.ts @@ -81,8 +81,8 @@ export class Validator { [], 0 ).arraySync() - } catch (e: any) { - console.error(e instanceof Error ? e.message : e.toString()) + } catch (e) { + console.error(e instanceof Error ? e.message : e) throw new Error('Failed to compute the confusion matrix') } } diff --git a/discojs/discojs-core/src/weights/aggregation.spec.ts b/discojs/discojs-core/src/weights/aggregation.spec.ts index 157619f33..6b507ad68 100644 --- a/discojs/discojs-core/src/weights/aggregation.spec.ts +++ b/discojs/discojs-core/src/weights/aggregation.spec.ts @@ -3,7 +3,7 @@ import { assert } from 'chai' import { WeightsContainer, aggregation } from './index.js' describe('weights aggregation', () => { - it('avg of weights with two operands', async () => { + it('avg of weights with two operands', () => { const actual = aggregation.avg([ WeightsContainer.of([1, 2, 3, -1], [-5, 6]), WeightsContainer.of([2, 3, 7, 1], [-10, 5]), @@ -14,7 +14,7 @@ describe('weights aggregation', () => { assert.isTrue(actual.equals(expected)) }) - it('sum of weights with two operands', async () => { + it('sum of weights with two operands', () => { const actual = aggregation.sum([ [[3, -4], [9]], [[2, 13], [0]] @@ -24,7 +24,7 @@ describe('weights aggregation', () => { assert.isTrue(actual.equals(expected)) }) - it('diff of weights with two operands', async () => { + it('diff of weights with two operands', () => { const actual = aggregation.diff([ [[3, -4, 5], [9, 1]], [[2, 13, 4], [0, 1]] diff --git a/discojs/discojs-node/.eslintrc.json b/discojs/discojs-node/.eslintrc.json deleted file mode 100644 index 10d223883..000000000 --- a/discojs/discojs-node/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "env": { - "node": true - } -} diff --git a/discojs/discojs-node/package.json b/discojs/discojs-node/package.json index 62a3ccfb7..9be81206b 100644 --- a/discojs/discojs-node/package.json +++ b/discojs/discojs-node/package.json @@ -7,7 +7,7 @@ "scripts": { "watch": "nodemon --ext ts --ignore dist --watch ../discojs-core/dist --watch . --exec npm run", "build": "tsc", - "lint": "npx eslint --ext ts --max-warnings 0 .", + "lint": "npx eslint .", "test": "mocha", "docs": "typedoc ./src/imports.ts --theme oxide" }, diff --git a/discojs/discojs-web/.eslintrc.json b/discojs/discojs-web/.eslintrc.json deleted file mode 100644 index e5a34aec6..000000000 --- a/discojs/discojs-web/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "env": { - "browser": true - } -} diff --git a/discojs/discojs-web/package.json b/discojs/discojs-web/package.json index b4ce26846..a34a77748 100644 --- a/discojs/discojs-web/package.json +++ b/discojs/discojs-web/package.json @@ -7,7 +7,7 @@ "scripts": { "watch": "nodemon --ext ts --ignore dist --watch ../discojs-core/dist --watch . --exec npm run", "build": "tsc", - "lint": "npx eslint --ext ts --max-warnings 0 .", + "lint": "npx eslint .", "test": ": nothing", "docs": "typedoc ./src/index.ts --theme oxide" }, diff --git a/docs/examples/.eslintrc.js b/docs/examples/.eslintrc.js deleted file mode 100644 index 011f7af10..000000000 --- a/docs/examples/.eslintrc.js +++ /dev/null @@ -1,18 +0,0 @@ -// @ts-check - -module.exports = { - root: true, - extends: 'standard-with-typescript', - parserOptions: { - project: './tsconfig.eslint.json', - tsconfigRootDir: __dirname - }, - ignorePatterns: ['**/dist/'], - env: { node: true }, - overrides: [ - { - extends: ['plugin:@typescript-eslint/disable-type-checked'], - files: ['*.js'] - } - ] -} diff --git a/docs/examples/custom_task.ts b/docs/examples/custom_task.ts index 48abf0b10..da122a7b8 100644 --- a/docs/examples/custom_task.ts +++ b/docs/examples/custom_task.ts @@ -32,7 +32,7 @@ const customTask: TaskProvider = { } }, - async getModel () { + getModel () { const model = tf.sequential() model.add( @@ -52,7 +52,7 @@ const customTask: TaskProvider = { metrics: ['accuracy'] }) - return new models.TFJS(model) + return Promise.resolve(new models.TFJS(model)) } } diff --git a/eslint.config.js b/docs/examples/eslint.config.js similarity index 77% rename from eslint.config.js rename to docs/examples/eslint.config.js index 46ceb8e6a..e68682197 100644 --- a/eslint.config.js +++ b/docs/examples/eslint.config.js @@ -7,12 +7,13 @@ export default tseslint.config( eslint.configs.recommended, ...tseslint.configs.recommendedTypeChecked, { + files: ['*.ts'], languageOptions: { parserOptions: { - project: './tsconfig.eslint.json', + project: true, tsconfigRootDir: import.meta.dirname } } }, - { ignores: ['**/dist/*'] } + { ignores: ['eslint.config.js', 'dist/*'] } ) diff --git a/docs/examples/package.json b/docs/examples/package.json index 86d192a26..8f303549a 100644 --- a/docs/examples/package.json +++ b/docs/examples/package.json @@ -7,7 +7,7 @@ "train": "npm run build && node dist/training.js", "custom_task": "npm run build && node dist/custom_task.js", "build": "tsc", - "lint": "npx eslint --ext ts --max-warnings 0 .", + "lint": "npx eslint .", "test": "npm run train" }, "license": "ISC", @@ -17,12 +17,8 @@ "@epfml/discojs-node": "*" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "6", "eslint": "8", - "eslint-config-standard-with-typescript": "43", - "eslint-plugin-import": "2", - "eslint-plugin-n": "15", - "eslint-plugin-promise": "6", - "typescript": "4" + "typescript": "4", + "typescript-eslint": "7" } } diff --git a/docs/examples/training.ts b/docs/examples/training.ts index a415a3ef6..2be30d5a1 100644 --- a/docs/examples/training.ts +++ b/docs/examples/training.ts @@ -78,7 +78,7 @@ async function loadSimpleFaceData (task: Task): Promise { const filesPerFolder = [youngFiles, oldFiles] - const labels = filesPerFolder.flatMap((files, index) => Array(files.length).fill(index)) + const labels = filesPerFolder.flatMap((files, index) => Array(files.length).fill(`${index}`)) const files = filesPerFolder.flat() return await new NodeImageLoader(task).loadAll(files, { labels }) diff --git a/docs/examples/tsconfig.eslint.json b/docs/examples/tsconfig.eslint.json deleted file mode 100644 index a8d4317b4..000000000 --- a/docs/examples/tsconfig.eslint.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig.json", - "exclude": [] -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..489260d87 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,35 @@ +// @ts-check + +import eslint from '@eslint/js' +import tseslint from 'typescript-eslint' + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + { + languageOptions: { + parserOptions: { + project: './tsconfig.eslint.json', + tsconfigRootDir: import.meta.dirname + } + } + }, + { + rules: { + // taken from https://typescript-eslint.io/rules/no-unused-vars/ + '@typescript-eslint/no-unused-vars': [ + 'error', + { + args: 'all', + argsIgnorePattern: '^_', + caughtErrors: 'all', + caughtErrorsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + varsIgnorePattern: '^_', + ignoreRestSiblings: true + } + ] + } + }, + { ignores: ['**/dist/*'] } +) diff --git a/package-lock.json b/package-lock.json index 126b05d80..eed4cea8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,13 +15,9 @@ "isomorphic-wrtc" ], "devDependencies": { - "@typescript-eslint/eslint-plugin": "6", "eslint": "8", - "eslint-config-standard-with-typescript": "43", - "eslint-plugin-import": "2", - "eslint-plugin-n": "15", - "eslint-plugin-promise": "6", - "typescript": "4" + "typescript": "4", + "typescript-eslint": "7" } }, "cli": { @@ -2191,9 +2187,10 @@ } }, "node_modules/@eslint/js": { - "version": "8.56.0", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, - "license": "MIT", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -3319,7 +3316,8 @@ "node_modules/@types/json5": { "version": "0.0.29", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@types/lodash": { "version": "4.14.202", @@ -5129,6 +5127,7 @@ "version": "1.0.1", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.5", "is-array-buffer": "^3.0.4" @@ -5148,6 +5147,7 @@ "version": "3.1.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -5178,6 +5178,7 @@ "version": "1.0.3", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -5196,6 +5197,7 @@ "version": "1.2.4", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.5", "define-properties": "^1.2.1", @@ -5214,6 +5216,7 @@ "version": "1.3.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -5231,6 +5234,7 @@ "version": "1.3.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -5248,6 +5252,7 @@ "version": "1.0.3", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "array-buffer-byte-length": "^1.0.1", "call-bind": "^1.0.5", @@ -5865,6 +5870,7 @@ "version": "5.0.1", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "semver": "^7.0.0" } @@ -8314,6 +8320,7 @@ "version": "1.22.4", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "array-buffer-byte-length": "^1.0.1", "arraybuffer.prototype.slice": "^1.0.3", @@ -8367,7 +8374,8 @@ "node_modules/es-array-method-boxes-properly": { "version": "1.0.0", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/es-define-property": { "version": "1.0.0", @@ -8395,6 +8403,7 @@ "version": "2.0.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "get-intrinsic": "^1.2.2", "has-tostringtag": "^1.0.0", @@ -8408,6 +8417,7 @@ "version": "1.0.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "hasown": "^2.0.0" } @@ -8416,6 +8426,7 @@ "version": "1.2.1", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -8482,15 +8493,16 @@ } }, "node_modules/eslint": { - "version": "8.56.0", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, - "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.56.0", - "@humanwhocodes/config-array": "^0.11.13", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", @@ -8577,27 +8589,11 @@ "eslint-plugin-promise": "^6.0.0" } }, - "node_modules/eslint-config-standard-with-typescript": { - "version": "43.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/parser": "^6.4.0", - "eslint-config-standard": "17.1.0" - }, - "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^6.4.0", - "eslint": "^8.0.1", - "eslint-plugin-import": "^2.25.2", - "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", - "eslint-plugin-promise": "^6.0.0", - "typescript": "*" - } - }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "debug": "^3.2.7", "is-core-module": "^2.13.0", @@ -8608,6 +8604,7 @@ "version": "3.2.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ms": "^2.1.1" } @@ -8616,6 +8613,7 @@ "version": "2.8.0", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "debug": "^3.2.7" }, @@ -8632,6 +8630,7 @@ "version": "3.2.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ms": "^2.1.1" } @@ -8652,6 +8651,7 @@ "version": "4.1.0", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "eslint-utils": "^2.0.0", "regexpp": "^3.0.0" @@ -8670,6 +8670,7 @@ "version": "2.1.0", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "eslint-visitor-keys": "^1.1.0" }, @@ -8684,6 +8685,7 @@ "version": "1.3.0", "dev": true, "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=4" } @@ -8692,6 +8694,7 @@ "version": "2.29.1", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "array-includes": "^3.1.7", "array.prototype.findlastindex": "^1.2.3", @@ -8722,6 +8725,7 @@ "version": "1.1.11", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -8731,6 +8735,7 @@ "version": "3.2.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ms": "^2.1.1" } @@ -8739,6 +8744,7 @@ "version": "2.1.0", "dev": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "esutils": "^2.0.2" }, @@ -8750,6 +8756,7 @@ "version": "3.1.2", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -8761,6 +8768,7 @@ "version": "6.3.1", "dev": true, "license": "ISC", + "peer": true, "bin": { "semver": "bin/semver.js" } @@ -8769,6 +8777,7 @@ "version": "15.7.0", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "builtins": "^5.0.1", "eslint-plugin-es": "^4.1.0", @@ -8793,6 +8802,7 @@ "version": "1.1.11", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -8802,6 +8812,7 @@ "version": "3.1.2", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -8920,6 +8931,7 @@ "version": "6.1.1", "dev": true, "license": "ISC", + "peer": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -8966,6 +8978,7 @@ "version": "3.0.0", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "eslint-visitor-keys": "^2.0.0" }, @@ -8983,6 +8996,7 @@ "version": "2.1.0", "dev": true, "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=10" } @@ -9872,6 +9886,7 @@ "version": "1.1.6", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -9889,6 +9904,7 @@ "version": "1.2.3", "dev": true, "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -9978,6 +9994,7 @@ "version": "1.0.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.5", "es-errors": "^1.3.0", @@ -10086,6 +10103,7 @@ "version": "1.0.3", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "define-properties": "^1.1.3" }, @@ -10179,6 +10197,7 @@ "version": "1.0.2", "dev": true, "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -10681,6 +10700,7 @@ "version": "1.0.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "es-errors": "^1.3.0", "hasown": "^2.0.0", @@ -10737,6 +10757,7 @@ "version": "3.0.4", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.2.1" @@ -10756,6 +10777,7 @@ "version": "1.0.4", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "has-bigints": "^1.0.1" }, @@ -10777,6 +10799,7 @@ "version": "1.1.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -10822,6 +10845,7 @@ "version": "1.0.5", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -10917,6 +10941,7 @@ "version": "2.0.2", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">= 0.4" }, @@ -10935,6 +10960,7 @@ "version": "1.0.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -10980,6 +11006,7 @@ "version": "1.1.4", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -10995,6 +11022,7 @@ "version": "1.0.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2" }, @@ -11014,6 +11042,7 @@ "version": "1.0.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -11028,6 +11057,7 @@ "version": "1.0.4", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "has-symbols": "^1.0.2" }, @@ -11073,6 +11103,7 @@ "version": "1.0.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2" }, @@ -11094,7 +11125,8 @@ "node_modules/isarray": { "version": "2.0.5", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/isexe": { "version": "2.0.0", @@ -13263,6 +13295,7 @@ "version": "2.0.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -13279,6 +13312,7 @@ "version": "1.0.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "array.prototype.filter": "^1.0.3", "call-bind": "^1.0.5", @@ -13291,6 +13325,7 @@ "version": "1.1.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -15059,6 +15094,7 @@ "version": "1.5.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.6", "define-properties": "^1.2.1", @@ -15287,6 +15323,7 @@ "version": "1.1.0", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.5", "get-intrinsic": "^1.2.2", @@ -15322,6 +15359,7 @@ "version": "1.0.3", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.6", "es-errors": "^1.3.0", @@ -15555,6 +15593,7 @@ "version": "2.0.1", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "define-data-property": "^1.0.1", "functions-have-names": "^1.2.3", @@ -15968,6 +16007,7 @@ "version": "1.2.8", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -15984,6 +16024,7 @@ "version": "1.0.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -15997,6 +16038,7 @@ "version": "1.0.7", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -16031,6 +16073,7 @@ "version": "3.0.0", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=4" } @@ -16845,6 +16888,7 @@ "version": "3.15.0", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/json5": "^0.0.29", "json5": "^1.0.2", @@ -16915,6 +16959,7 @@ "version": "1.0.1", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.6", "es-errors": "^1.3.0", @@ -16928,6 +16973,7 @@ "version": "1.0.0", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "for-each": "^0.3.3", @@ -16945,6 +16991,7 @@ "version": "1.0.0", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", @@ -16963,6 +17010,7 @@ "version": "1.0.4", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "for-each": "^0.3.3", @@ -17044,6 +17092,221 @@ "node": ">=4.2.0" } }, + "node_modules/typescript-eslint": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-7.3.1.tgz", + "integrity": "sha512-psqcnHPRCdVIDbgj6RvfpwUKqMcNxIw7eizgxYi46X2BmXK6LxYqPD+SbDfPuA9JW+yPItY6aKJLRNbW7lZ4rA==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "7.3.1", + "@typescript-eslint/parser": "7.3.1" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/eslint-plugin": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.3.1.tgz", + "integrity": "sha512-STEDMVQGww5lhCuNXVSQfbfuNII5E08QWkvAw5Qwf+bj2WT+JkG1uc+5/vXA3AOYMDHVOSpL+9rcbEUiHIm2dw==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "7.3.1", + "@typescript-eslint/type-utils": "7.3.1", + "@typescript-eslint/utils": "7.3.1", + "@typescript-eslint/visitor-keys": "7.3.1", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/parser": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.3.1.tgz", + "integrity": "sha512-Rq49+pq7viTRCH48XAbTA+wdLRrB/3sRq4Lpk0oGDm0VmnjBrAOVXH/Laalmwsv2VpekiEfVFwJYVk6/e8uvQw==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "7.3.1", + "@typescript-eslint/types": "7.3.1", + "@typescript-eslint/typescript-estree": "7.3.1", + "@typescript-eslint/visitor-keys": "7.3.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/scope-manager": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.3.1.tgz", + "integrity": "sha512-fVS6fPxldsKY2nFvyT7IP78UO1/I2huG+AYu5AMjCT9wtl6JFiDnsv4uad4jQ0GTFzcUV5HShVeN96/17bTBag==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.3.1", + "@typescript-eslint/visitor-keys": "7.3.1" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/type-utils": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.3.1.tgz", + "integrity": "sha512-iFhaysxFsMDQlzJn+vr3OrxN8NmdQkHks4WaqD4QBnt5hsq234wcYdyQ9uquzJJIDAj5W4wQne3yEsYA6OmXGw==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "7.3.1", + "@typescript-eslint/utils": "7.3.1", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/types": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.3.1.tgz", + "integrity": "sha512-2tUf3uWggBDl4S4183nivWQ2HqceOZh1U4hhu4p1tPiIJoRRXrab7Y+Y0p+dozYwZVvLPRI6r5wKe9kToF9FIw==", + "dev": true, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.3.1.tgz", + "integrity": "sha512-tLpuqM46LVkduWP7JO7yVoWshpJuJzxDOPYIVWUUZbW+4dBpgGeUdl/fQkhuV0A8eGnphYw3pp8d2EnvPOfxmQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.3.1", + "@typescript-eslint/visitor-keys": "7.3.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/utils": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.3.1.tgz", + "integrity": "sha512-jIERm/6bYQ9HkynYlNZvXpzmXWZGhMbrOvq3jJzOSOlKXsVjrrolzWBjDW6/TvT5Q3WqaN4EkmcfdQwi9tDjBQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "7.3.1", + "@typescript-eslint/types": "7.3.1", + "@typescript-eslint/typescript-estree": "7.3.1", + "semver": "^7.5.4" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.3.1.tgz", + "integrity": "sha512-9RMXwQF8knsZvfv9tdi+4D/j7dMG28X/wMJ8Jj6eOHyHWwDW4ngQJcqEczSsqIKKjFiLFr40Mnr7a5ulDD3vmw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.3.1", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/typical": { "version": "4.0.0", "dev": true, @@ -17056,6 +17319,7 @@ "version": "1.0.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "has-bigints": "^1.0.2", @@ -18016,6 +18280,7 @@ "version": "1.0.2", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "is-bigint": "^1.0.1", "is-boolean-object": "^1.1.0", diff --git a/package.json b/package.json index 5b208cb47..cab42c432 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,8 @@ "isomorphic-wrtc" ], "devDependencies": { - "@typescript-eslint/eslint-plugin": "6", "eslint": "8", - "eslint-config-standard-with-typescript": "43", - "eslint-plugin-import": "2", - "eslint-plugin-n": "15", - "eslint-plugin-promise": "6", - "typescript": "4" + "typescript": "4", + "typescript-eslint": "7" } } diff --git a/server/.eslintrc.json b/server/.eslintrc.json deleted file mode 100644 index 10d223883..000000000 --- a/server/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "env": { - "node": true - } -} diff --git a/server/package.json b/server/package.json index c816d814f..b4e79e5b9 100644 --- a/server/package.json +++ b/server/package.json @@ -10,7 +10,7 @@ "watch": "nodemon --ext ts --ignore dist --watch ../discojs/discojs-node/dist --watch . --exec npm run", "start": "npm run build && node dist/run_server.js", "build": "tsc", - "lint": "npx eslint --ext ts --max-warnings 0 .", + "lint": "npx eslint .", "test": "mocha" }, "author": "", diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 63b6999b0..30bdea20f 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -1,4 +1,4 @@ { "extends": "./tsconfig.base.json", - "include": ["**/src", "**/tests"], + "include": ["./eslint.config.js", "**/src", "**/tests"], }