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/helpers/asar-helpers.ts | 2 +- src/helpers/password-helpers.ts | 2 +- src/helpers/recipe-helpers.ts | 2 +- src/helpers/url-helpers.ts | 2 +- src/helpers/userAgent-helpers.ts | 3 ++- 5 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/helpers') 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 @@ -import { join } from 'path'; +import { join } from 'node:path'; export function asarPath(dir: string = '') { 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 @@ -import { createHash, BinaryLike } from 'crypto'; +import { createHash, BinaryLike } from 'node:crypto'; export function hash(password: BinaryLike): string { 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 @@ /* eslint-disable import/no-import-module-exports */ /* eslint-disable global-require */ -import { parse } from 'path'; +import { parse } from 'node:path'; import { userDataRecipesPath } from '../environment-remote'; 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 @@ // This is taken from: https://benjamin-altpeter.de/shell-openexternal-dangers/ -import { URL } from 'url'; +import { URL } from 'node:url'; import { ensureDirSync, existsSync } from 'fs-extra'; import { shell } from 'electron'; 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 @@ -import { cpus } from 'os'; +import { cpus } from 'node:os'; import macosVersion from 'macos-version'; import { chrome } from 'useragent-generator'; import { @@ -14,6 +14,7 @@ function macOS() { const version = macosVersion() ?? ''; let cpuName = cpus()[0].model.split(' ')[0]; if (cpuName && /\(/.test(cpuName)) { + // eslint-disable-next-line prefer-destructuring cpuName = cpuName.split('(')[0]; } return `Macintosh; ${cpuName} Mac OS X ${version.replaceAll('.', '_')}`; -- cgit v1.2.3-54-g00ecf