Skip to content

Commit 32dd0c8

Browse files
authored
Merge branch 'main' into dependabot/github_actions/github-actions-02d3d6b679
2 parents ce81bc9 + 5aaae05 commit 32dd0c8

53 files changed

Lines changed: 922 additions & 722 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extensions/git-id-switcher/eslint.config.mjs

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ export default [
111111
"unicorn/prevent-abbreviations": "off",
112112
// userName/userEmail/userSigningKey mirror git config keys (user.name/user.email/user.signingkey);
113113
// "username" connotes a login handle, which these display-name values are not
114-
"unicorn/consistent-compound-words": ["error", { replacements: { userName: false } }],
114+
"unicorn/consistent-compound-words": [
115+
"error",
116+
{ replacements: { userName: false } },
117+
],
115118
"unicorn/filename-case": "off",
116119
"unicorn/no-process-exit": "off",
117120
"unicorn/prefer-module": "off",
@@ -120,6 +123,34 @@ export default [
120123
"unicorn/import-style": "off",
121124
"unicorn/no-useless-undefined": "off", // TypeScript requires explicit undefined arguments (resolve(undefined), update(key, undefined))
122125
"unicorn/no-useless-error-capture-stack-trace": "off", // V8-specific Error.captureStackTrace is guarded by if-check for non-V8 engines
126+
127+
// ADR-00240 Phase 1: disable v67 rules that conflict with VS Code extension patterns.
128+
"unicorn/no-top-level-assignment-in-function": "off",
129+
"unicorn/no-top-level-side-effects": "off",
130+
"unicorn/no-non-function-verb-prefix": "off",
131+
"unicorn/no-error-property-assignment": "off",
132+
133+
// ADR-00240 Phase 1: keep remaining v67 findings visible while unblocking CI.
134+
"unicorn/prefer-await": "warn",
135+
"unicorn/max-nested-calls": "warn",
136+
"unicorn/consistent-boolean-name": "warn",
137+
"unicorn/no-computed-property-existence-check": "warn",
138+
"unicorn/consistent-class-member-order": "warn",
139+
"unicorn/no-break-in-nested-loop": "warn",
140+
"unicorn/no-unsafe-string-replacement": "warn",
141+
"unicorn/prefer-unicode-code-point-escapes": "warn",
142+
"unicorn/prefer-early-return": "warn",
143+
"unicorn/prefer-number-coercion": "warn",
144+
"unicorn/no-declarations-before-early-exit": "warn",
145+
"unicorn/no-incorrect-template-string-interpolation": "warn",
146+
"unicorn/no-unreadable-array-destructuring": "warn",
147+
"unicorn/number-literal-case": "warn",
148+
"unicorn/require-array-sort-compare": "warn",
149+
"unicorn/no-optional-chaining-on-undeclared-variable": "warn",
150+
"unicorn/prefer-iterator-to-array": "warn",
151+
"unicorn/prefer-minimal-ternary": "warn",
152+
"unicorn/prefer-uint8array-base64": "warn",
153+
"unicorn/prefer-private-class-fields": "warn",
123154
},
124155
linterOptions: {
125156
reportUnusedDisableDirectives: "warn",
@@ -165,7 +196,12 @@ export default [
165196
},
166197
},
167198
{
168-
files: ["**/validators/common.ts", "**/core/constants.ts", "**/ui/htmlTemplates/csp.ts", "**/ui/htmlTemplates/shell.ts"],
199+
files: [
200+
"**/validators/common.ts",
201+
"**/core/constants.ts",
202+
"**/ui/htmlTemplates/csp.ts",
203+
"**/ui/htmlTemplates/shell.ts",
204+
],
169205
rules: {
170206
"no-restricted-syntax": "off",
171207
"no-magic-numbers": "off",
@@ -204,6 +240,14 @@ export default [
204240
},
205241
},
206242
{
207-
ignores: ["out/**", "node_modules/**", "coverage/**", "scripts/**", ".vscode-test/**", "*.js", "*.mjs"],
243+
ignores: [
244+
"out/**",
245+
"node_modules/**",
246+
"coverage/**",
247+
"scripts/**",
248+
".vscode-test/**",
249+
"*.js",
250+
"*.mjs",
251+
],
208252
},
209253
];

extensions/git-id-switcher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
"@vscode/vsce": "^3.9.2",
312312
"eslint": "^10.5.0",
313313
"eslint-plugin-sonarjs": "^4.0.3",
314-
"eslint-plugin-unicorn": "^65.0.1",
314+
"eslint-plugin-unicorn": "^67.0.0",
315315
"fast-check": "^4.8.0",
316316
"glob": "^13.0.6",
317317
"mocha": "^11.7.6",

extensions/git-id-switcher/src/commands/handlers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ export async function selectIdentityCommand(
101101
* @returns New lastIndex after add operation
102102
*/
103103
async function handleManageAdd(lastIndex: number): Promise<number> {
104-
const success = await handleAddIdentity();
105-
if (success) {
104+
const isSuccess = await handleAddIdentity();
105+
if (isSuccess) {
106106
const newIdentities = getIdentitiesWithValidation();
107107
return newIdentities.length - 1;
108108
}
@@ -140,8 +140,8 @@ async function handleManageDelete(
140140
context: vscode.ExtensionContext,
141141
statusBar: IdentityStatusBar
142142
): Promise<number> {
143-
const success = await handleDeleteIdentity(context, statusBar, identity);
144-
if (success) {
143+
const isSuccess = await handleDeleteIdentity(context, statusBar, identity);
144+
if (isSuccess) {
145145
const newIdentities = getIdentitiesWithValidation();
146146
return Math.min(index, Math.max(0, newIdentities.length - 1));
147147
}
@@ -163,8 +163,8 @@ async function handleManageMove(
163163
direction: 'up' | 'down'
164164
): Promise<number> {
165165
try {
166-
const moved = await moveIdentityInConfig(identity.id, direction);
167-
if (moved) {
166+
const isMoved = await moveIdentityInConfig(identity.id, direction);
167+
if (isMoved) {
168168
return direction === 'up' ? index - 1 : index + 1;
169169
}
170170
return index;

extensions/git-id-switcher/src/core/extension.ts

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -153,36 +153,38 @@ async function performTrustedInitialization(context: vscode.ExtensionContext): P
153153
});
154154
}),
155155
vscode.workspace.onDidChangeConfiguration((e: vscode.ConfigurationChangeEvent) => {
156-
if (e.affectsConfiguration('gitIdSwitcher')) {
156+
if (!e.affectsConfiguration('gitIdSwitcher')) {
157+
return;
158+
}
159+
160+
try {
161+
const newSnapshot = securityLogger.createConfigSnapshot();
162+
const changes = securityLogger.detectConfigChanges(newSnapshot);
163+
if (changes.length > 0) {
164+
securityLogger.logConfigChanges(changes);
165+
}
166+
securityLogger.storeConfigSnapshot();
167+
} catch (error) {
168+
extensionLogger.error(`Error handling config change: ${getUserSafeMessage(error)}`);
157169
try {
158-
const newSnapshot = securityLogger.createConfigSnapshot();
159-
const changes = securityLogger.detectConfigChanges(newSnapshot);
160-
if (changes.length > 0) {
161-
securityLogger.logConfigChanges(changes);
162-
}
163170
securityLogger.storeConfigSnapshot();
164-
} catch (error) {
165-
extensionLogger.error(`Error handling config change: ${getUserSafeMessage(error)}`);
166-
try {
167-
securityLogger.storeConfigSnapshot();
168-
} catch (snapshotError) {
169-
extensionLogger.error(`Error storing config snapshot: ${getUserSafeMessage(snapshotError)}`);
170-
}
171+
} catch (snapshotError) {
172+
extensionLogger.error(`Error storing config snapshot: ${getUserSafeMessage(snapshotError)}`);
171173
}
172-
173-
invalidateIdentityCache();
174-
initializeState(context)
175-
.then(() => performSyncCheck())
176-
.catch(error => {
177-
const safeMessage = getUserSafeMessage(error);
178-
extensionLogger.error(`Failed to initialize after config change: ${safeMessage}`);
179-
if (isFatalError(error)) {
180-
vscode.window.showErrorMessage(
181-
vscode.l10n.t('Failed to initialize Git ID Switcher: {0}', safeMessage)
182-
);
183-
}
184-
});
185174
}
175+
176+
invalidateIdentityCache();
177+
initializeState(context)
178+
.then(() => performSyncCheck())
179+
.catch(error => {
180+
const safeMessage = getUserSafeMessage(error);
181+
extensionLogger.error(`Failed to initialize after config change: ${safeMessage}`);
182+
if (isFatalError(error)) {
183+
vscode.window.showErrorMessage(
184+
vscode.l10n.t('Failed to initialize Git ID Switcher: {0}', safeMessage)
185+
);
186+
}
187+
});
186188
}),
187189
// Sync check on window focus return
188190
vscode.window.onDidChangeWindowState((state: vscode.WindowState) => {

0 commit comments

Comments
 (0)