From 080d8b05297f3f5afcf33354a40a5201697b1df5 Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Sun, 30 Jul 2023 10:55:59 -0600 Subject: refactor: more lint improvements - set parserOptions.ecmaVersion to latest and env to es2024 in eslint config - install missing types libraries - install eslint-plugin-sonar - enable eslint-plugin-sonar recommended rules and declare jsx-runtime for react in eslint config - clean up disabled lint rules which don't inflict problems anymore - disable various lint issues and fix others --- src/internal-server/app/Controllers/Http/ImageController.js | 2 +- src/internal-server/app/Controllers/Http/UserController.js | 8 ++------ src/internal-server/app/Controllers/Http/WorkspaceController.js | 7 +------ src/internal-server/app/ImageHelper.js | 2 +- src/internal-server/database/factory.js | 1 + src/internal-server/start.ts | 2 +- src/internal-server/start/routes.js | 2 +- src/internal-server/test.ts | 2 +- 8 files changed, 9 insertions(+), 17 deletions(-) (limited to 'src/internal-server') diff --git a/src/internal-server/app/Controllers/Http/ImageController.js b/src/internal-server/app/Controllers/Http/ImageController.js index 5b8337c49..3ce6fb22d 100644 --- a/src/internal-server/app/Controllers/Http/ImageController.js +++ b/src/internal-server/app/Controllers/Http/ImageController.js @@ -1,6 +1,6 @@ const Env = use('Env'); -const path = require('path'); +const path = require('node:path'); const fs = require('fs-extra'); const sanitize = require('sanitize-filename'); diff --git a/src/internal-server/app/Controllers/Http/UserController.js b/src/internal-server/app/Controllers/Http/UserController.js index 43d925119..943d7705e 100644 --- a/src/internal-server/app/Controllers/Http/UserController.js +++ b/src/internal-server/app/Controllers/Http/UserController.js @@ -6,7 +6,7 @@ const { validateAll } = use('Validator'); const fetch = require('node-fetch'); const { v4: uuid } = require('uuid'); -const crypto = require('crypto'); +const crypto = require('node:crypto'); const { DEFAULT_APP_SETTINGS } = require('../../../../config'); const { convertToJSON } = require('../../../../jsUtils'); const { API_VERSION } = require('../../../../environment-remote'); @@ -224,11 +224,7 @@ class UserController { } // Account import/export - async export({ - // eslint-disable-next-line no-unused-vars - auth, - response, - }) { + async export({ _auth, response }) { const allServices = await Service.all(); const services = allServices.toJSON(); const allWorkspaces = await Workspace.all(); diff --git a/src/internal-server/app/Controllers/Http/WorkspaceController.js b/src/internal-server/app/Controllers/Http/WorkspaceController.js index 352589567..d271dac12 100644 --- a/src/internal-server/app/Controllers/Http/WorkspaceController.js +++ b/src/internal-server/app/Controllers/Http/WorkspaceController.js @@ -92,12 +92,7 @@ class WorkspaceController { }); } - async delete({ - // eslint-disable-next-line no-unused-vars - request, - response, - params, - }) { + async delete({ response, params }) { // Validate user input const validation = await validateAll(params, { id: 'required', diff --git a/src/internal-server/app/ImageHelper.js b/src/internal-server/app/ImageHelper.js index fba610069..b24a97836 100644 --- a/src/internal-server/app/ImageHelper.js +++ b/src/internal-server/app/ImageHelper.js @@ -2,7 +2,7 @@ const Env = use('Env'); const { v4: uuid } = require('uuid'); -const path = require('path'); +const path = require('node:path'); const fs = require('fs-extra'); const { API_VERSION } = require('../../environment-remote'); diff --git a/src/internal-server/database/factory.js b/src/internal-server/database/factory.js index 8534fc20a..8cd45a80d 100644 --- a/src/internal-server/database/factory.js +++ b/src/internal-server/database/factory.js @@ -1,3 +1,4 @@ +/* eslint-disable unicorn/no-empty-file */ /* |-------------------------------------------------------------------------- | Factory diff --git a/src/internal-server/start.ts b/src/internal-server/start.ts index f5e1953e7..b6ee65986 100644 --- a/src/internal-server/start.ts +++ b/src/internal-server/start.ts @@ -18,7 +18,7 @@ import fold from '@adonisjs/fold'; import { Ignitor, hooks } from '@adonisjs/ignitor'; import { readFile, stat, chmod, writeFile } from 'fs-extra'; -import { join } from 'path'; +import { join } from 'node:path'; import { LOCAL_HOSTNAME } from '../config'; import { isWindows } from '../environment'; diff --git a/src/internal-server/start/routes.js b/src/internal-server/start/routes.js index 8aca39347..2dbd0713e 100644 --- a/src/internal-server/start/routes.js +++ b/src/internal-server/start/routes.js @@ -5,7 +5,7 @@ | */ -const { timingSafeEqual } = require('crypto'); +const { timingSafeEqual } = require('node:crypto'); /** @type {typeof import('@adonisjs/framework/src/Route/Manager')} */ const Route = use('Route'); diff --git a/src/internal-server/test.ts b/src/internal-server/test.ts index 6949df79e..c163656fb 100644 --- a/src/internal-server/test.ts +++ b/src/internal-server/test.ts @@ -1,4 +1,4 @@ -import { join } from 'path'; +import { join } from 'node:path'; import { ensureDirSync } from 'fs-extra'; import { server } from './start'; -- cgit v1.2.3-70-g09d2