From 8c131073730ec684145c2cc8ee8d6b39bbe9278d Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Sun, 23 Jul 2023 20:08:52 -0600 Subject: chore: improve lint setup - update eslint config - merged eslint rules for JS and TS to avoid duplicates - extended stricter lint ruleset from typescript-eslint - corrected wrong setup for certain eslint rulesets - opt in to reportUnusedDisableDirectives config option - fix or disable a lot of lint issues throughout codebase - remove trailingComma: all from prettier config which is default in prettier v3 - add volta configuration to package.json to autoload correct node and pnpm versions - upgrade all eslint and prettier related dependencies to latest - remove config options from settings.json which are default anyways - remove config options from settings.json which are outdated/unknown - set up prettier as default formatter in settings.json --- src/internal-server/app/Controllers/Http/UserController.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/internal-server/app/Controllers') diff --git a/src/internal-server/app/Controllers/Http/UserController.js b/src/internal-server/app/Controllers/Http/UserController.js index 9a9d76636..a9c67a1b2 100644 --- a/src/internal-server/app/Controllers/Http/UserController.js +++ b/src/internal-server/app/Controllers/Http/UserController.js @@ -26,6 +26,7 @@ const apiRequest = (url, route, method, auth) => .then(data => data.json()) .then(json => resolve(json)); } catch (error) { + // eslint-disable-next-line no-console console.log(error); reject(); } @@ -197,7 +198,7 @@ class UserController { const services = await apiRequest(server, 'me/services', 'GET', token); for (const service of services) { - await this._createAndCacheService(service, serviceIdTranslation); // eslint-disable-line no-await-in-loop + await this._createAndCacheService(service, serviceIdTranslation); } } catch (error) { const errorMessage = `Could not import your services into our system.\nError: ${error}`; @@ -209,7 +210,7 @@ class UserController { const workspaces = await apiRequest(server, 'workspace', 'GET', token); for (const workspace of workspaces) { - await this._createWorkspace(workspace, serviceIdTranslation); // eslint-disable-line no-await-in-loop + await this._createWorkspace(workspace, serviceIdTranslation); } } catch (error) { const errorMessage = `Could not import your workspaces into our system.\nError: ${error}`; @@ -257,6 +258,7 @@ class UserController { try { file = JSON.parse(request.input('file')); } catch (error) { + // eslint-disable-next-line no-console console.log(error); return response.send( 'Could not import: Invalid file, could not read file', @@ -272,7 +274,7 @@ class UserController { // Import services try { for (const service of file.services) { - await this._createAndCacheService(service, serviceIdTranslation); // eslint-disable-line no-await-in-loop + await this._createAndCacheService(service, serviceIdTranslation); } } catch (error) { const errorMessage = `Could not import your services into our system.\nError: ${error}`; @@ -282,7 +284,7 @@ class UserController { // Import workspaces try { for (const workspace of file.workspaces) { - await this._createWorkspace(workspace, serviceIdTranslation); // eslint-disable-line no-await-in-loop + await this._createWorkspace(workspace, serviceIdTranslation); } } catch (error) { const errorMessage = `Could not import your workspaces into our system.\nError: ${error}`; @@ -302,6 +304,7 @@ class UserController { ); if (workspace.services) { + // eslint-disable-next-line no-param-reassign workspace.services = convertToJSON(workspace.services); } const services = @@ -311,6 +314,7 @@ class UserController { ) : []; if (workspace.data) { + // eslint-disable-next-line no-param-reassign workspace.data = convertToJSON(workspace.data); } @@ -334,9 +338,11 @@ class UserController { ); // store the old serviceId as the key for future lookup + // eslint-disable-next-line no-param-reassign serviceIdTranslation[service.serviceId] = newServiceId; if (service.settings) { + // eslint-disable-next-line no-param-reassign service.settings = convertToJSON(service.settings); } -- cgit v1.2.3-70-g09d2