mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
Remove Map/Set eslint rule
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export function testRedundantHasBeforeDelete() {
|
||||
const m = new Map<string, number>();
|
||||
const s = new Set<string>();
|
||||
|
||||
// Invalid cases
|
||||
m.delete('key');
|
||||
|
||||
s.delete('key');
|
||||
|
||||
// Cases with else clause
|
||||
if (!m.delete('key')) {
|
||||
console.log('not found');
|
||||
}
|
||||
|
||||
if (m.delete('key')) {
|
||||
console.log('deleted');
|
||||
} else {
|
||||
console.log('not found');
|
||||
}
|
||||
|
||||
// Valid cases
|
||||
m.delete('key');
|
||||
s.delete('key');
|
||||
|
||||
if (m.has('key')) {
|
||||
console.log('deleting');
|
||||
m.delete('key');
|
||||
}
|
||||
|
||||
if (m.has('key')) {
|
||||
m.delete('otherKey');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user