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/webview/lib/Userscript.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/webview/lib/Userscript.ts') diff --git a/src/webview/lib/Userscript.ts b/src/webview/lib/Userscript.ts index b0e4fb805..5adc1ac3a 100644 --- a/src/webview/lib/Userscript.ts +++ b/src/webview/lib/Userscript.ts @@ -32,7 +32,7 @@ export default class Userscript { * * @param {*} settings */ - // eslint-disable-next-line camelcase + internal_setSettings(settings: any) { // This is needed to get a clean JS object from the settings itself to provide better accessibility // Otherwise this will be a mobX instance @@ -45,7 +45,7 @@ export default class Userscript { * @param {number} indirect Indirect messages */ setBadge(direct: number = 0, indirect: number = 0) { - if (this.recipe && this.recipe.setBadge) { + if (this.recipe?.setBadge) { this.recipe.setBadge(direct, indirect); } } @@ -55,7 +55,7 @@ export default class Userscript { * @param {*} title Dialog title */ setDialogTitle(title: string) { - if (this.recipe && this.recipe.setDialogTitle) { + if (this.recipe?.setDialogTitle) { this.recipe.setDialogTitle(title); } } @@ -66,7 +66,7 @@ export default class Userscript { * @param {...string} files */ injectCSSFiles(...files: string[]) { - if (this.recipe && this.recipe.injectCSS) { + if (this.recipe?.injectCSS) { // @ts-expect-error A spread argument must either have a tuple type or be passed to a rest parameter. this.recipe.injectCSS(...files); } @@ -99,6 +99,7 @@ export default class Userscript { * @param {string} key * @return Value of the key */ + // eslint-disable-next-line consistent-return get(key: string) { const ferdiumUserKey = window.localStorage.getItem(`ferdium-user-${key}`); -- cgit v1.2.3-70-g09d2