summaryrefslogtreecommitdiffstats
path: root/src/jsUtils.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/jsUtils.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/jsUtils.ts')
-rw-r--r--src/jsUtils.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/jsUtils.ts b/src/jsUtils.ts
index f6a1df2fe..0095028ef 100644
--- a/src/jsUtils.ts
+++ b/src/jsUtils.ts
@@ -3,15 +3,15 @@ export const ifUndefined = <T>(
3 defaultValue: T, 3 defaultValue: T,
4): T => source ?? defaultValue; 4): T => source ?? defaultValue;
5 5
6export const convertToJSON = (data: string | any | undefined | null) => 6export const convertToJSON = (data?: string | any | null) =>
7 data && typeof data === 'string' && data.length > 0 ? JSON.parse(data) : data; 7 data && typeof data === 'string' && data.length > 0 ? JSON.parse(data) : data;
8 8
9export const cleanseJSObject = (data: any | undefined | null) => 9export const cleanseJSObject = (data?: any | null) =>
10 JSON.parse(JSON.stringify(data)); 10 JSON.parse(JSON.stringify(data));
11 11
12export const isEscKeyPress = (keyCode: number) => keyCode === 27; 12export const isEscKeyPress = (keyCode: number) => keyCode === 27;
13 13
14export const safeParseInt = (text: string | number | undefined | null) => { 14export const safeParseInt = (text?: string | number | null) => {
15 if (text === undefined || text === null) { 15 if (text === undefined || text === null) {
16 return 0; 16 return 0;
17 } 17 }