diff options
author | 2023-07-30 10:55:59 -0600 | |
---|---|---|
committer | 2023-07-30 23:57:51 +0000 | |
commit | 080d8b05297f3f5afcf33354a40a5201697b1df5 (patch) | |
tree | 35180bd3cb9fcd137feca3fe169032cbbb469463 /src/helpers | |
parent | refactor: various improvements (#1296) (diff) | |
download | ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.tar.gz ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.tar.zst ferdium-app-080d8b05297f3f5afcf33354a40a5201697b1df5.zip |
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
Diffstat (limited to 'src/helpers')
-rw-r--r-- | src/helpers/asar-helpers.ts | 2 | ||||
-rw-r--r-- | src/helpers/password-helpers.ts | 2 | ||||
-rw-r--r-- | src/helpers/recipe-helpers.ts | 2 | ||||
-rw-r--r-- | src/helpers/url-helpers.ts | 2 | ||||
-rw-r--r-- | src/helpers/userAgent-helpers.ts | 3 |
5 files changed, 6 insertions, 5 deletions
diff --git a/src/helpers/asar-helpers.ts b/src/helpers/asar-helpers.ts index 9d975c193..77dd50bb1 100644 --- a/src/helpers/asar-helpers.ts +++ b/src/helpers/asar-helpers.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { join } from 'path'; | 1 | import { join } from 'node:path'; |
2 | 2 | ||
3 | export function asarPath(dir: string = '') { | 3 | export function asarPath(dir: string = '') { |
4 | return dir.replace('app.asar', 'app.asar.unpacked'); | 4 | return dir.replace('app.asar', 'app.asar.unpacked'); |
diff --git a/src/helpers/password-helpers.ts b/src/helpers/password-helpers.ts index d5f2d0c49..75ef5606a 100644 --- a/src/helpers/password-helpers.ts +++ b/src/helpers/password-helpers.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { createHash, BinaryLike } from 'crypto'; | 1 | import { createHash, BinaryLike } from 'node:crypto'; |
2 | 2 | ||
3 | export function hash(password: BinaryLike): string { | 3 | export function hash(password: BinaryLike): string { |
4 | return createHash('sha256').update(password).digest('base64'); | 4 | return createHash('sha256').update(password).digest('base64'); |
diff --git a/src/helpers/recipe-helpers.ts b/src/helpers/recipe-helpers.ts index 68a1578e3..500be0cfc 100644 --- a/src/helpers/recipe-helpers.ts +++ b/src/helpers/recipe-helpers.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | /* eslint-disable import/no-import-module-exports */ | 1 | /* eslint-disable import/no-import-module-exports */ |
2 | /* eslint-disable global-require */ | 2 | /* eslint-disable global-require */ |
3 | import { parse } from 'path'; | 3 | import { parse } from 'node:path'; |
4 | import { userDataRecipesPath } from '../environment-remote'; | 4 | import { userDataRecipesPath } from '../environment-remote'; |
5 | 5 | ||
6 | export function getRecipeDirectory(id: string = ''): string { | 6 | export function getRecipeDirectory(id: string = ''): string { |
diff --git a/src/helpers/url-helpers.ts b/src/helpers/url-helpers.ts index 795d3f2cb..fe637bb08 100644 --- a/src/helpers/url-helpers.ts +++ b/src/helpers/url-helpers.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | // This is taken from: https://benjamin-altpeter.de/shell-openexternal-dangers/ | 1 | // This is taken from: https://benjamin-altpeter.de/shell-openexternal-dangers/ |
2 | import { URL } from 'url'; | 2 | import { URL } from 'node:url'; |
3 | import { ensureDirSync, existsSync } from 'fs-extra'; | 3 | import { ensureDirSync, existsSync } from 'fs-extra'; |
4 | import { shell } from 'electron'; | 4 | import { shell } from 'electron'; |
5 | import normalizeUrl from 'normalize-url'; | 5 | import normalizeUrl from 'normalize-url'; |
diff --git a/src/helpers/userAgent-helpers.ts b/src/helpers/userAgent-helpers.ts index a89207326..bc99fbc52 100644 --- a/src/helpers/userAgent-helpers.ts +++ b/src/helpers/userAgent-helpers.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { cpus } from 'os'; | 1 | import { cpus } from 'node:os'; |
2 | import macosVersion from 'macos-version'; | 2 | import macosVersion from 'macos-version'; |
3 | import { chrome } from 'useragent-generator'; | 3 | import { chrome } from 'useragent-generator'; |
4 | import { | 4 | import { |
@@ -14,6 +14,7 @@ function macOS() { | |||
14 | const version = macosVersion() ?? ''; | 14 | const version = macosVersion() ?? ''; |
15 | let cpuName = cpus()[0].model.split(' ')[0]; | 15 | let cpuName = cpus()[0].model.split(' ')[0]; |
16 | if (cpuName && /\(/.test(cpuName)) { | 16 | if (cpuName && /\(/.test(cpuName)) { |
17 | // eslint-disable-next-line prefer-destructuring | ||
17 | cpuName = cpuName.split('(')[0]; | 18 | cpuName = cpuName.split('(')[0]; |
18 | } | 19 | } |
19 | return `Macintosh; ${cpuName} Mac OS X ${version.replaceAll('.', '_')}`; | 20 | return `Macintosh; ${cpuName} Mac OS X ${version.replaceAll('.', '_')}`; |