Skip to content

Commit c459156

Browse files
GudahttGuillaumeRx
andauthored
chore: Remove unused ESLint ignore directives (#7154)
## Explanation ## References Relates to #6790 These changes were extracted from the draft PR #7148 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Removes redundant ESLint ignore comments (e.g., `jest/no-conditional-in-test`, related enable/disable blocks, and a stray `no-var`) across numerous test files without functional changes. > > - **Tests cleanup**: > - Strip unused ESLint disable/enable comments across many test files in packages like `account-tree-controller`, `assets-controllers`, `bridge-controller`, `bridge-status-controller`, `chain-agnostic-permission`, `controller-utils`, `earn-controller`, `eth-json-rpc-*`, `json-rpc-engine`, `network-controller`, `network-enablement-controller`, `profile-sync-controller`, `sample-controllers`, and `shield-controller`. > - Primarily removes `/* eslint-disable jest/no-conditional-in-test */` and matching enable blocks; also removes a few other unused directives (e.g., `no-var`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e38e3e7. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Guillaume Roux <guillaumeroux123@gmail.com>
1 parent ba9a5cc commit c459156

File tree

28 files changed

+0
-117
lines changed

28 files changed

+0
-117
lines changed

packages/account-tree-controller/src/backup-and-sync/syncing/group.test.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ describe('BackupAndSync - Syncing - Group', () => {
239239
async (
240240
options: Parameters<typeof metadataExports.compareAndSyncMetadata>[0],
241241
) => {
242-
/* eslint-disable jest/no-conditional-in-test */
243242
if (
244243
options.userStorageMetadata &&
245244
'value' in options.userStorageMetadata &&
@@ -249,7 +248,6 @@ describe('BackupAndSync - Syncing - Group', () => {
249248
applyNameUpdate = options.applyLocalUpdate;
250249
}
251250
return false;
252-
/* eslint-enable jest/no-conditional-in-test */
253251
},
254252
);
255253

@@ -265,7 +263,6 @@ describe('BackupAndSync - Syncing - Group', () => {
265263

266264
expect(validateNameFunction).toBeDefined();
267265
expect(applyNameUpdate).toBeDefined();
268-
/* eslint-disable jest/no-conditional-in-test */
269266
/* eslint-disable jest/no-conditional-expect */
270267
if (validateNameFunction) {
271268
expect(validateNameFunction('New Name')).toBe(true);
@@ -281,7 +278,6 @@ describe('BackupAndSync - Syncing - Group', () => {
281278
true,
282279
);
283280
}
284-
/* eslint-enable jest/no-conditional-in-test */
285281
/* eslint-enable jest/no-conditional-expect */
286282
});
287283

@@ -305,7 +301,6 @@ describe('BackupAndSync - Syncing - Group', () => {
305301
async (
306302
options: Parameters<typeof metadataExports.compareAndSyncMetadata>[0],
307303
) => {
308-
/* eslint-disable jest/no-conditional-in-test */
309304
if (
310305
options.userStorageMetadata &&
311306
'value' in options.userStorageMetadata &&
@@ -315,7 +310,6 @@ describe('BackupAndSync - Syncing - Group', () => {
315310
applyPinnedUpdate = options.applyLocalUpdate;
316311
}
317312
return false;
318-
/* eslint-enable jest/no-conditional-in-test */
319313
},
320314
);
321315

@@ -331,7 +325,6 @@ describe('BackupAndSync - Syncing - Group', () => {
331325

332326
expect(validatePinnedFunction).toBeDefined();
333327
expect(applyPinnedUpdate).toBeDefined();
334-
/* eslint-disable jest/no-conditional-in-test */
335328
/* eslint-disable jest/no-conditional-expect */
336329
if (validatePinnedFunction) {
337330
expect(validatePinnedFunction(true)).toBe(true);
@@ -346,7 +339,6 @@ describe('BackupAndSync - Syncing - Group', () => {
346339
mockContext.controller.setAccountGroupPinned,
347340
).toHaveBeenCalledWith(mockLocalGroup.id, true);
348341
}
349-
/* eslint-enable jest/no-conditional-in-test */
350342
/* eslint-enable jest/no-conditional-expect */
351343
});
352344

@@ -370,7 +362,6 @@ describe('BackupAndSync - Syncing - Group', () => {
370362
async (
371363
options: Parameters<typeof metadataExports.compareAndSyncMetadata>[0],
372364
) => {
373-
/* eslint-disable jest/no-conditional-in-test */
374365
if (
375366
options.userStorageMetadata &&
376367
'value' in options.userStorageMetadata &&
@@ -380,7 +371,6 @@ describe('BackupAndSync - Syncing - Group', () => {
380371
applyHiddenUpdate = options.applyLocalUpdate;
381372
}
382373
return false;
383-
/* eslint-enable jest/no-conditional-in-test */
384374
},
385375
);
386376

@@ -396,7 +386,6 @@ describe('BackupAndSync - Syncing - Group', () => {
396386

397387
expect(validateHiddenFunction).toBeDefined();
398388
expect(applyHiddenUpdate).toBeDefined();
399-
/* eslint-disable jest/no-conditional-in-test */
400389
/* eslint-disable jest/no-conditional-expect */
401390
if (validateHiddenFunction) {
402391
expect(validateHiddenFunction(true)).toBe(true);
@@ -411,7 +400,6 @@ describe('BackupAndSync - Syncing - Group', () => {
411400
mockContext.controller.setAccountGroupHidden,
412401
).toHaveBeenCalledWith(mockLocalGroup.id, false);
413402
}
414-
/* eslint-enable jest/no-conditional-in-test */
415403
/* eslint-enable jest/no-conditional-expect */
416404
});
417405
});

packages/account-tree-controller/src/backup-and-sync/syncing/wallet.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,13 @@ describe('BackupAndSync - Syncing - Wallet', () => {
131131
);
132132

133133
expect(applyLocalUpdate).toBeDefined();
134-
/* eslint-disable jest/no-conditional-in-test */
135134
/* eslint-disable jest/no-conditional-expect */
136135
if (applyLocalUpdate) {
137136
await applyLocalUpdate('New Name');
138137
expect(
139138
mockContext.controller.setAccountWalletName,
140139
).toHaveBeenCalledWith(mockLocalWallet.id, 'New Name');
141140
}
142-
/* eslint-enable jest/no-conditional-in-test */
143141
/* eslint-enable jest/no-conditional-expect */
144142
});
145143

@@ -169,15 +167,13 @@ describe('BackupAndSync - Syncing - Wallet', () => {
169167
);
170168

171169
expect(validateUserStorageValue).toBeDefined();
172-
/* eslint-disable jest/no-conditional-in-test */
173170
/* eslint-disable jest/no-conditional-expect */
174171
if (validateUserStorageValue) {
175172
expect(validateUserStorageValue('valid string')).toBe(true);
176173
expect(validateUserStorageValue(123)).toBe(false);
177174
expect(validateUserStorageValue(null)).toBe(false);
178175
expect(validateUserStorageValue(undefined)).toBe(false);
179176
}
180-
/* eslint-enable jest/no-conditional-in-test */
181177
/* eslint-enable jest/no-conditional-expect */
182178
});
183179
});

packages/account-tree-controller/src/backup-and-sync/user-storage/validation.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ describe('BackupAndSync - UserStorage - Validation', () => {
203203
try {
204204
assertValidLegacyUserStorageAccount(multipleFailuresData);
205205
} catch (error) {
206-
// eslint-disable-next-line jest/no-conditional-in-test
207206
errorMessage = error instanceof Error ? error.message : String(error);
208207
}
209208

packages/assets-controllers/src/NftController.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,7 +3348,6 @@ describe('NftController', () => {
33483348

33493349
const { nftController } = setupController({
33503350
getERC721TokenURI: jest.fn().mockImplementation((tokenAddress) => {
3351-
// eslint-disable-next-line jest/no-conditional-in-test
33523351
switch (tokenAddress) {
33533352
case '0x01':
33543353
return 'https://testtokenuri-1.com';
@@ -3359,7 +3358,6 @@ describe('NftController', () => {
33593358
}
33603359
}),
33613360
getERC1155TokenURI: jest.fn().mockImplementation((tokenAddress) => {
3362-
// eslint-disable-next-line jest/no-conditional-in-test
33633361
switch (tokenAddress) {
33643362
case '0x03':
33653363
return 'https://testtokenuri-3.com';

packages/assets-controllers/src/TokenSearchDiscoveryDataController/TokenSearchDiscoveryDataController.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,6 @@ describe('TokenSearchDiscoveryDataController', () => {
671671
return {
672672
[tokenAddress as Hex]: {
673673
...basePrice,
674-
// eslint-disable-next-line jest/no-conditional-in-test
675674
price: currency === 'USD' ? 10.5 : 9.5,
676675
currency,
677676
},
@@ -740,7 +739,6 @@ describe('TokenSearchDiscoveryDataController', () => {
740739
const mockFetchTokenPrices = jest
741740
.fn()
742741
.mockImplementation(({ currency }: { currency: string }) => {
743-
// eslint-disable-next-line jest/no-conditional-in-test
744742
if (currency === 'USD') {
745743
return Promise.resolve({ [tokenAddress as Hex]: mockTokenPrice });
746744
}
@@ -783,14 +781,12 @@ describe('TokenSearchDiscoveryDataController', () => {
783781

784782
(fetchTokenMetadata as jest.Mock).mockImplementation(
785783
(_chainId, address) => {
786-
// eslint-disable-next-line jest/no-conditional-in-test
787784
if (address === tokenAddress1) {
788785
return Promise.resolve({
789786
decimals: 18,
790787
symbol: 'DAI',
791788
name: 'Dai Stablecoin',
792789
});
793-
// eslint-disable-next-line jest/no-conditional-in-test
794790
} else if (address === tokenAddress2) {
795791
return Promise.resolve({
796792
decimals: 6,

packages/bridge-controller/src/bridge-controller.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable jest/no-restricted-matchers */
2-
/* eslint-disable jest/no-conditional-in-test */
32
import { Contract } from '@ethersproject/contracts';
43
import { deriveStateFromMetadata } from '@metamask/base-controller';
54
import {

packages/bridge-controller/src/utils/balance.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { fetchTokenBalance } from './balance';
1010
import { FakeProvider } from '../../../../tests/fake-provider';
1111

1212
declare global {
13-
// eslint-disable-next-line no-var
1413
var ethereumProvider: Provider;
1514
}
1615

packages/bridge-status-controller/src/bridge-status-controller.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable jest/no-conditional-in-test */
21
/* eslint-disable jest/no-restricted-matchers */
32
import { deriveStateFromMetadata } from '@metamask/base-controller';
43
import type {

packages/chain-agnostic-permission/src/scope/filter.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ describe('filter', () => {
7272

7373
it('returns supported and unsupported scopes', () => {
7474
MockAssert.assertScopeSupported.mockImplementation((scopeString) => {
75-
// This is okay; we are inside of a mock.
76-
// eslint-disable-next-line jest/no-conditional-in-test
7775
if (scopeString === 'eip155:1') {
7876
throw new Error('scope not supported');
7977
}
@@ -174,13 +172,9 @@ describe('filter', () => {
174172
it('returns only supported methods', () => {
175173
MockSupported.isSupportedMethod.mockImplementation(
176174
(scopeString, method) => {
177-
// This is okay; we are inside of a mock.
178-
// eslint-disable-next-line jest/no-conditional-in-test
179175
if (scopeString === 'eip155:1' && method === 'method1') {
180176
return false;
181177
}
182-
// This is okay; we are inside of a mock.
183-
// eslint-disable-next-line jest/no-conditional-in-test
184178
if (scopeString === 'eip155:5' && method === 'methodB') {
185179
return false;
186180
}
@@ -261,13 +255,9 @@ describe('filter', () => {
261255
it('returns only supported notifications', () => {
262256
MockSupported.isSupportedNotification.mockImplementation(
263257
(scopeString, notification) => {
264-
// This is okay; we are inside of a mock.
265-
// eslint-disable-next-line jest/no-conditional-in-test
266258
if (scopeString === 'eip155:1' && notification === 'notification1') {
267259
return false;
268260
}
269-
// This is okay; we are inside of a mock.
270-
// eslint-disable-next-line jest/no-conditional-in-test
271261
if (scopeString === 'eip155:5' && notification === 'notificationB') {
272262
return false;
273263
}

packages/controller-utils/src/create-service-policy.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// We use conditions exclusively in this file.
2-
/* eslint-disable jest/no-conditional-in-test */
3-
41
import { handleWhen } from 'cockatiel';
52
import { useFakeTimers } from 'sinon';
63
import type { SinonFakeTimers } from 'sinon';

0 commit comments

Comments
 (0)