diff options
author | 2023-07-30 10:55:59 -0600 | |
---|---|---|
committer | 2023-07-30 23:57:51 +0000 | |
commit | 080d8b05297f3f5afcf33354a40a5201697b1df5 (patch) | |
tree | 35180bd3cb9fcd137feca3fe169032cbbb469463 /src/jsUtils.ts | |
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/jsUtils.ts')
-rw-r--r-- | src/jsUtils.ts | 6 |
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 | ||
6 | export const convertToJSON = (data: string | any | undefined | null) => | 6 | export 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 | ||
9 | export const cleanseJSObject = (data: any | undefined | null) => | 9 | export const cleanseJSObject = (data?: any | null) => |
10 | JSON.parse(JSON.stringify(data)); | 10 | JSON.parse(JSON.stringify(data)); |
11 | 11 | ||
12 | export const isEscKeyPress = (keyCode: number) => keyCode === 27; | 12 | export const isEscKeyPress = (keyCode: number) => keyCode === 27; |
13 | 13 | ||
14 | export const safeParseInt = (text: string | number | undefined | null) => { | 14 | export 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 | } |