fix: add no-typeof-undefined rule (#5114)

This commit is contained in:
LongYinan
2023-11-29 04:43:58 +00:00
parent bd488262fa
commit 19c61e051d
3 changed files with 3 additions and 2 deletions

View File

@@ -212,6 +212,7 @@ const config = {
'unicorn/prefer-dom-node-remove': 'error', 'unicorn/prefer-dom-node-remove': 'error',
'unicorn/prefer-array-some': 'error', 'unicorn/prefer-array-some': 'error',
'unicorn/prefer-date-now': 'error', 'unicorn/prefer-date-now': 'error',
'unicorn/no-typeof-undefined': 'error',
'unicorn/no-useless-promise-resolve-reject': 'error', 'unicorn/no-useless-promise-resolve-reject': 'error',
'sonarjs/no-all-duplicated-branches': 'error', 'sonarjs/no-all-duplicated-branches': 'error',
'sonarjs/no-element-overwrite': 'error', 'sonarjs/no-element-overwrite': 'error',

View File

@@ -50,7 +50,7 @@ function boolean(value: string) {
} }
export function parseEnvValue(value: string | undefined, type?: EnvConfigType) { export function parseEnvValue(value: string | undefined, type?: EnvConfigType) {
if (typeof value === 'undefined') { if (value === undefined) {
return; return;
} }

View File

@@ -10,7 +10,7 @@ export function applyEnvToConfig(rawConfig: AFFiNEConfig) {
? [config, process.env[env]] ? [config, process.env[env]]
: [config[0], parseEnvValue(process.env[env], config[1])]; : [config[0], parseEnvValue(process.env[env], config[1])];
if (typeof value !== 'undefined') { if (value !== undefined) {
set(rawConfig, path, value); set(rawConfig, path, value);
} }
} }