diff options
author | 2023-07-23 20:08:52 -0600 | |
---|---|---|
committer | 2023-07-25 07:45:23 +0000 | |
commit | 8c131073730ec684145c2cc8ee8d6b39bbe9278d (patch) | |
tree | 1129d432ae88475909f0e5d38960395b75364902 /src/internal-server/app | |
parent | 6.4.1-nightly.11 [skip ci] (diff) | |
download | ferdium-app-8c131073730ec684145c2cc8ee8d6b39bbe9278d.tar.gz ferdium-app-8c131073730ec684145c2cc8ee8d6b39bbe9278d.tar.zst ferdium-app-8c131073730ec684145c2cc8ee8d6b39bbe9278d.zip |
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
Diffstat (limited to 'src/internal-server/app')
-rw-r--r-- | src/internal-server/app/Controllers/Http/UserController.js | 14 |
1 files changed, 10 insertions, 4 deletions
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) => | |||
26 | .then(data => data.json()) | 26 | .then(data => data.json()) |
27 | .then(json => resolve(json)); | 27 | .then(json => resolve(json)); |
28 | } catch (error) { | 28 | } catch (error) { |
29 | // eslint-disable-next-line no-console | ||
29 | console.log(error); | 30 | console.log(error); |
30 | reject(); | 31 | reject(); |
31 | } | 32 | } |
@@ -197,7 +198,7 @@ class UserController { | |||
197 | const services = await apiRequest(server, 'me/services', 'GET', token); | 198 | const services = await apiRequest(server, 'me/services', 'GET', token); |
198 | 199 | ||
199 | for (const service of services) { | 200 | for (const service of services) { |
200 | await this._createAndCacheService(service, serviceIdTranslation); // eslint-disable-line no-await-in-loop | 201 | await this._createAndCacheService(service, serviceIdTranslation); |
201 | } | 202 | } |
202 | } catch (error) { | 203 | } catch (error) { |
203 | const errorMessage = `Could not import your services into our system.\nError: ${error}`; | 204 | const errorMessage = `Could not import your services into our system.\nError: ${error}`; |
@@ -209,7 +210,7 @@ class UserController { | |||
209 | const workspaces = await apiRequest(server, 'workspace', 'GET', token); | 210 | const workspaces = await apiRequest(server, 'workspace', 'GET', token); |
210 | 211 | ||
211 | for (const workspace of workspaces) { | 212 | for (const workspace of workspaces) { |
212 | await this._createWorkspace(workspace, serviceIdTranslation); // eslint-disable-line no-await-in-loop | 213 | await this._createWorkspace(workspace, serviceIdTranslation); |
213 | } | 214 | } |
214 | } catch (error) { | 215 | } catch (error) { |
215 | const errorMessage = `Could not import your workspaces into our system.\nError: ${error}`; | 216 | const errorMessage = `Could not import your workspaces into our system.\nError: ${error}`; |
@@ -257,6 +258,7 @@ class UserController { | |||
257 | try { | 258 | try { |
258 | file = JSON.parse(request.input('file')); | 259 | file = JSON.parse(request.input('file')); |
259 | } catch (error) { | 260 | } catch (error) { |
261 | // eslint-disable-next-line no-console | ||
260 | console.log(error); | 262 | console.log(error); |
261 | return response.send( | 263 | return response.send( |
262 | 'Could not import: Invalid file, could not read file', | 264 | 'Could not import: Invalid file, could not read file', |
@@ -272,7 +274,7 @@ class UserController { | |||
272 | // Import services | 274 | // Import services |
273 | try { | 275 | try { |
274 | for (const service of file.services) { | 276 | for (const service of file.services) { |
275 | await this._createAndCacheService(service, serviceIdTranslation); // eslint-disable-line no-await-in-loop | 277 | await this._createAndCacheService(service, serviceIdTranslation); |
276 | } | 278 | } |
277 | } catch (error) { | 279 | } catch (error) { |
278 | const errorMessage = `Could not import your services into our system.\nError: ${error}`; | 280 | const errorMessage = `Could not import your services into our system.\nError: ${error}`; |
@@ -282,7 +284,7 @@ class UserController { | |||
282 | // Import workspaces | 284 | // Import workspaces |
283 | try { | 285 | try { |
284 | for (const workspace of file.workspaces) { | 286 | for (const workspace of file.workspaces) { |
285 | await this._createWorkspace(workspace, serviceIdTranslation); // eslint-disable-line no-await-in-loop | 287 | await this._createWorkspace(workspace, serviceIdTranslation); |
286 | } | 288 | } |
287 | } catch (error) { | 289 | } catch (error) { |
288 | const errorMessage = `Could not import your workspaces into our system.\nError: ${error}`; | 290 | const errorMessage = `Could not import your workspaces into our system.\nError: ${error}`; |
@@ -302,6 +304,7 @@ class UserController { | |||
302 | ); | 304 | ); |
303 | 305 | ||
304 | if (workspace.services) { | 306 | if (workspace.services) { |
307 | // eslint-disable-next-line no-param-reassign | ||
305 | workspace.services = convertToJSON(workspace.services); | 308 | workspace.services = convertToJSON(workspace.services); |
306 | } | 309 | } |
307 | const services = | 310 | const services = |
@@ -311,6 +314,7 @@ class UserController { | |||
311 | ) | 314 | ) |
312 | : []; | 315 | : []; |
313 | if (workspace.data) { | 316 | if (workspace.data) { |
317 | // eslint-disable-next-line no-param-reassign | ||
314 | workspace.data = convertToJSON(workspace.data); | 318 | workspace.data = convertToJSON(workspace.data); |
315 | } | 319 | } |
316 | 320 | ||
@@ -334,9 +338,11 @@ class UserController { | |||
334 | ); | 338 | ); |
335 | 339 | ||
336 | // store the old serviceId as the key for future lookup | 340 | // store the old serviceId as the key for future lookup |
341 | // eslint-disable-next-line no-param-reassign | ||
337 | serviceIdTranslation[service.serviceId] = newServiceId; | 342 | serviceIdTranslation[service.serviceId] = newServiceId; |
338 | 343 | ||
339 | if (service.settings) { | 344 | if (service.settings) { |
345 | // eslint-disable-next-line no-param-reassign | ||
340 | service.settings = convertToJSON(service.settings); | 346 | service.settings = convertToJSON(service.settings); |
341 | } | 347 | } |
342 | 348 | ||