refactor(cli): fully remove React anti patterns, improve type safety and fix UX oversights in SettingsDialog.tsx (#18963)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
Pyush Sinha
2026-03-02 13:30:58 -08:00
committed by GitHub
parent 18d0375a7f
commit 8133d63ac6
14 changed files with 589 additions and 1390 deletions
+7 -8
View File
@@ -4,12 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type {
LoadableSettingScope,
LoadedSettings,
} from '../config/settings.js';
import type { LoadableSettingScope, Settings } from '../config/settings.js';
import { isLoadableSettingScope, SettingScope } from '../config/settings.js';
import { settingExistsInScope } from './settingsUtils.js';
import { isInSettingsScope } from './settingsUtils.js';
/**
* Shared scope labels for dialog components that need to display setting scopes
@@ -43,7 +40,9 @@ export function getScopeItems(): Array<{
export function getScopeMessageForSetting(
settingKey: string,
selectedScope: LoadableSettingScope,
settings: LoadedSettings,
settings: {
forScope: (scope: LoadableSettingScope) => { settings: Settings };
},
): string {
const otherScopes = Object.values(SettingScope)
.filter(isLoadableSettingScope)
@@ -51,7 +50,7 @@ export function getScopeMessageForSetting(
const modifiedInOtherScopes = otherScopes.filter((scope) => {
const scopeSettings = settings.forScope(scope).settings;
return settingExistsInScope(settingKey, scopeSettings);
return isInSettingsScope(settingKey, scopeSettings);
});
if (modifiedInOtherScopes.length === 0) {
@@ -60,7 +59,7 @@ export function getScopeMessageForSetting(
const modifiedScopesStr = modifiedInOtherScopes.join(', ');
const currentScopeSettings = settings.forScope(selectedScope).settings;
const existsInCurrentScope = settingExistsInScope(
const existsInCurrentScope = isInSettingsScope(
settingKey,
currentScopeSettings,
);