aboutsummaryrefslogtreecommitdiffstats
path: root/src/preload-safe-debug.ts
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2023-07-30 10:55:59 -0600
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2023-07-30 23:57:51 +0000
commit080d8b05297f3f5afcf33354a40a5201697b1df5 (patch)
tree35180bd3cb9fcd137feca3fe169032cbbb469463 /src/preload-safe-debug.ts
parentrefactor: various improvements (#1296) (diff)
downloadferdium-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/preload-safe-debug.ts')
-rw-r--r--src/preload-safe-debug.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/preload-safe-debug.ts b/src/preload-safe-debug.ts
index d18dd8639..471ae1a1f 100644
--- a/src/preload-safe-debug.ts
+++ b/src/preload-safe-debug.ts
@@ -8,6 +8,7 @@
8 * We disable the `debug` package in context isolated renderers, 8 * We disable the `debug` package in context isolated renderers,
9 * because they correspond to preload scripts. 9 * because they correspond to preload scripts.
10 */ 10 */
11// eslint-disable-next-line unicorn/no-empty-file
11module.exports = function debug(namespace: string): (...params: any[]) => void { 12module.exports = function debug(namespace: string): (...params: any[]) => void {
12 if ( 13 if (
13 typeof process === 'object' && 14 typeof process === 'object' &&
@@ -18,13 +19,14 @@ module.exports = function debug(namespace: string): (...params: any[]) => void {
18 // We don't reimplement the matching algorithm from `debug` and just dump all 19 // We don't reimplement the matching algorithm from `debug` and just dump all
19 // messages to the console if some form of `Ferdium` debugging is enabled. 20 // messages to the console if some form of `Ferdium` debugging is enabled.
20 if (process.env.DEBUG?.startsWith('Ferdium:')) { 21 if (process.env.DEBUG?.startsWith('Ferdium:')) {
22 // eslint-disable-next-line no-console
21 return (...params) => console.debug(`[${namespace}]`, ...params); 23 return (...params) => console.debug(`[${namespace}]`, ...params);
22 } 24 }
23 return () => {}; 25 return () => {};
24 } 26 }
25 /* 27 /*
26 eslint-disable-next-line global-require --
27 This file contains a workaround for situations were global require is problematic. 28 This file contains a workaround for situations were global require is problematic.
28 */ 29 */
30 // eslint-disable-next-line global-require
29 return require('debug')(namespace); 31 return require('debug')(namespace);
30}; 32};