Skip to content

Commit

Permalink
chore: lint fix for prettier v3
Browse files Browse the repository at this point in the history
  • Loading branch information
kumavis committed Nov 21, 2024
1 parent e9250c3 commit 12a0599
Show file tree
Hide file tree
Showing 63 changed files with 239 additions and 267 deletions.
2 changes: 1 addition & 1 deletion app/scripts/controllers/account-tracker-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async function withController<ReturnValue>(
({
id: 'accountId',
address: SELECTED_ADDRESS,
} as InternalAccount);
}) as InternalAccount;
controllerMessenger.registerActionHandler(
'AccountsController:getSelectedAccount',
getSelectedAccount || getSelectedAccountStub,
Expand Down
19 changes: 8 additions & 11 deletions app/scripts/controllers/decrypt-message.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const createMessengerMock = () =>
call: jest.fn(),
// TODO: Replace `any` with type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any as jest.Mocked<DecryptMessageControllerMessenger>);
}) as any as jest.Mocked<DecryptMessageControllerMessenger>;

const createDecryptMessageManagerMock = <T>() =>
({
Expand All @@ -61,7 +61,7 @@ const createDecryptMessageManagerMock = <T>() =>
},
// TODO: Replace `any` with type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any as jest.Mocked<T>);
}) as any as jest.Mocked<T>;

describe('DecryptMessageController', () => {
class MockDecryptMessageController extends DecryptMessageController {
Expand Down Expand Up @@ -178,9 +178,8 @@ describe('DecryptMessageController', () => {
);
getStateMock.mockReturnValue(mockExtState);

const result = await decryptMessageController.decryptMessage(
messageToDecrypt,
);
const result =
await decryptMessageController.decryptMessage(messageToDecrypt);

expect(decryptMessageManagerMock.approveMessage).toBeCalledTimes(1);
expect(decryptMessageManagerMock.approveMessage).toBeCalledWith(
Expand Down Expand Up @@ -248,9 +247,8 @@ describe('DecryptMessageController', () => {
);
getStateMock.mockReturnValue(mockExtState);

const result = await decryptMessageController.decryptMessageInline(
messageToDecrypt,
);
const result =
await decryptMessageController.decryptMessageInline(messageToDecrypt);

expect(decryptMessageManagerMock.setResult).toBeCalledTimes(1);
expect(decryptMessageManagerMock.setResult).toBeCalledWith(
Expand All @@ -277,9 +275,8 @@ describe('DecryptMessageController', () => {
);
getStateMock.mockReturnValue(mockExtState);

const result = await decryptMessageController.cancelDecryptMessage(
messageIdMock,
);
const result =
await decryptMessageController.cancelDecryptMessage(messageIdMock);

expect(decryptMessageManagerMock.rejectMessage).toBeCalledTimes(1);
expect(decryptMessageManagerMock.rejectMessage).toBeCalledWith(
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/controllers/encryption-public-key.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const createMessengerMock = () =>
registerInitialEventPayload: jest.fn(),
// TODO: Replace `any` with type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any as jest.Mocked<EncryptionPublicKeyControllerMessenger>);
}) as any as jest.Mocked<EncryptionPublicKeyControllerMessenger>;

const createEncryptionPublicKeyManagerMock = <T>() =>
({
Expand All @@ -78,7 +78,7 @@ const createEncryptionPublicKeyManagerMock = <T>() =>
},
// TODO: Replace `any` with type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any as jest.Mocked<T>);
}) as any as jest.Mocked<T>;

describe('EncryptionPublicKeyController', () => {
let encryptionPublicKeyController: EncryptionPublicKeyController;
Expand Down
14 changes: 8 additions & 6 deletions app/scripts/controllers/permissions/background-api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@ describe('permission background API methods', () => {
}),
};

const id = await getPermissionBackgroundApiMethods(
permissionController,
).requestAccountsPermissionWithId('foo.com');
const id =
await getPermissionBackgroundApiMethods(
permissionController,
).requestAccountsPermissionWithId('foo.com');

expect(permissionController.requestPermissions).toHaveBeenCalledTimes(1);
expect(permissionController.requestPermissions).toHaveBeenCalledWith(
Expand All @@ -211,9 +212,10 @@ describe('permission background API methods', () => {
}),
};

const id = await getPermissionBackgroundApiMethods(
permissionController,
).requestAccountsAndChainPermissionsWithId('foo.com');
const id =
await getPermissionBackgroundApiMethods(
permissionController,
).requestAccountsAndChainPermissionsWithId('foo.com');

expect(permissionController.requestPermissions).toHaveBeenCalledTimes(1);
expect(permissionController.requestPermissions).toHaveBeenCalledWith(
Expand Down
11 changes: 7 additions & 4 deletions app/scripts/lib/state-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ function sanitizeSnapData(state: FlattenedUIState) {
return;
}

state.snaps = Object.values(snapsData).reduce((acc, snap) => {
acc[snap.id] = stripLargeSnapData(snap) as Snap;
return acc;
}, {} as SnapControllerState['snaps']);
state.snaps = Object.values(snapsData).reduce(
(acc, snap) => {
acc[snap.id] = stripLargeSnapData(snap) as Snap;
return acc;
},
{} as SnapControllerState['snaps'],
);
}

function stripLargeSnapData(snapData: Snap): Partial<Snap> {
Expand Down
5 changes: 2 additions & 3 deletions app/scripts/lib/transaction/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ export async function addTransaction(
): Promise<TransactionMeta> {
await validateSecurity(request);

const { transactionMeta, waitForHash } = await addTransactionOrUserOperation(
request,
);
const { transactionMeta, waitForHash } =
await addTransactionOrUserOperation(request);

if (!request.waitForSubmit) {
waitForHash().catch(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from './tx-verification-middleware';

const getMockNetworkController = (chainId: `0x${string}` = '0x1') =>
({ state: mockNetworkState({ chainId }) } as NetworkController);
({ state: mockNetworkState({ chainId }) }) as NetworkController;

const mockTrustedSigners: Partial<Record<EXPERIENCES_TYPE, Hex>> = {
[EXPERIENCES_TYPE.METAMASK_BRIDGE]:
Expand Down
10 changes: 4 additions & 6 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4838,9 +4838,8 @@ export default class MetamaskController extends EventEmitter {
* @returns {'hardware' | 'imported' | 'snap' | 'MetaMask'}
*/
async getAccountType(address) {
const keyringType = await this.keyringController.getAccountKeyringType(
address,
);
const keyringType =
await this.keyringController.getAccountKeyringType(address);
switch (keyringType) {
case KeyringType.trezor:
case KeyringType.lattice:
Expand Down Expand Up @@ -4951,9 +4950,8 @@ export default class MetamaskController extends EventEmitter {
async addNewAccount(accountCount) {
const oldAccounts = await this.keyringController.getAccounts();

const addedAccountAddress = await this.keyringController.addNewAccount(
accountCount,
);
const addedAccountAddress =
await this.keyringController.addNewAccount(accountCount);

if (!oldAccounts.includes(addedAccountAddress)) {
this.preferencesController.setSelectedAddress(addedAccountAddress);
Expand Down
25 changes: 10 additions & 15 deletions app/scripts/metamask-controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,10 @@ describe('MetaMaskController', () => {
it('can only create new vault on keyringController once', async () => {
const password = 'a-fake-password';

const vault1 = await metamaskController.createNewVaultAndKeychain(
password,
);
const vault2 = await metamaskController.createNewVaultAndKeychain(
password,
);
const vault1 =
await metamaskController.createNewVaultAndKeychain(password);
const vault2 =
await metamaskController.createNewVaultAndKeychain(password);

expect(vault1).toStrictEqual(vault2);
});
Expand Down Expand Up @@ -885,9 +883,8 @@ describe('MetaMaskController', () => {
it('should be unlocked by default', async () => {
await metamaskController.connectHardware(device, 0);

const status = await metamaskController.checkHardwareStatus(
device,
);
const status =
await metamaskController.checkHardwareStatus(device);

expect(status).toStrictEqual(true);
});
Expand Down Expand Up @@ -2192,9 +2189,8 @@ describe('MetaMaskController', () => {
)
.mockReturnValue(tokenData);

const tokenSymbol = await metamaskController.getTokenSymbol(
'0xNotInTokenList',
);
const tokenSymbol =
await metamaskController.getTokenSymbol('0xNotInTokenList');

expect(tokenSymbol).toStrictEqual(tokenData.symbol);
});
Expand Down Expand Up @@ -2230,9 +2226,8 @@ describe('MetaMaskController', () => {
throw new Error('error');
});

const tokenSymbol = await metamaskController.getTokenSymbol(
'0xNotInTokenList',
);
const tokenSymbol =
await metamaskController.getTokenSymbol('0xNotInTokenList');

expect(tokenSymbol).toStrictEqual(null);
});
Expand Down
10 changes: 4 additions & 6 deletions app/scripts/services/data-deletion-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,8 @@ describe('DataDeletionService', () => {
mockDataDeletionStatusInterceptor(mockTaskId).reply(200, mockResponse);
const dataDeletionService = new DataDeletionService(getDefaultOptions());

const response = await dataDeletionService.fetchDeletionRegulationStatus(
mockTaskId,
);
const response =
await dataDeletionService.fetchDeletionRegulationStatus(mockTaskId);

expect(response).toStrictEqual(mockOverAllStatus);
});
Expand Down Expand Up @@ -623,9 +622,8 @@ describe('DataDeletionService', () => {
mockDataDeletionStatusInterceptor(mockTaskId).reply(200, mockResponse);
const dataDeletionService = new DataDeletionService(getDefaultOptions());

const response = await dataDeletionService.fetchDeletionRegulationStatus(
mockTaskId,
);
const response =
await dataDeletionService.fetchDeletionRegulationStatus(mockTaskId);

expect(response).toStrictEqual(mockOverAllStatus);
});
Expand Down
6 changes: 3 additions & 3 deletions app/scripts/services/data-deletion-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const fallbackDataDeletionEndpoint = 'https://metametrics.metamask.test';

const DEFAULT_ANALYTICS_DATA_DELETION_SOURCE_ID = inTest
? fallbackSourceId
: process.env.ANALYTICS_DATA_DELETION_SOURCE_ID ?? fallbackSourceId;
: (process.env.ANALYTICS_DATA_DELETION_SOURCE_ID ?? fallbackSourceId);
const DEFAULT_ANALYTICS_DATA_DELETION_ENDPOINT = inTest
? fallbackDataDeletionEndpoint
: process.env.ANALYTICS_DATA_DELETION_ENDPOINT ??
fallbackDataDeletionEndpoint;
: (process.env.ANALYTICS_DATA_DELETION_ENDPOINT ??
fallbackDataDeletionEndpoint);

/**
* The number of times we retry a specific failed request to the data deletion API.
Expand Down
33 changes: 18 additions & 15 deletions development/webpack/test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,24 @@ export function mockWebpack(
maps: (string | null)[],
devtool: 'source-map' | 'hidden-source-map' | false = 'source-map',
) {
const assets = files.reduce((acc, name, i) => {
const source = contents[i];
const map = maps?.[i];
const webpackSource = map
? new SourceMapSource(source, name, map)
: new RawSource(source);
acc[name] = {
name,
info: {
size: webpackSource.size(),
},
source: webpackSource,
};
return acc;
}, {} as Record<string, Asset>);
const assets = files.reduce(
(acc, name, i) => {
const source = contents[i];
const map = maps?.[i];
const webpackSource = map
? new SourceMapSource(source, name, map)
: new RawSource(source);
acc[name] = {
name,
info: {
size: webpackSource.size(),
},
source: webpackSource,
};
return acc;
},
{} as Record<string, Asset>,
);
let done: () => void;
const promise = new Promise<void>((resolve) => {
done = resolve;
Expand Down
8 changes: 3 additions & 5 deletions development/webpack/test/plugins.ManifestPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@ describe('ManifestPlugin', () => {
zip,
} = testCase;
const context = join(__dirname, `fixtures/ManifestPlugin/${fixture}`);
const baseManifest = require(join(
context,
`manifest/v${manifestVersion}`,
'_base.json',
));
const baseManifest = require(
join(context, `manifest/v${manifestVersion}`, '_base.json'),
);
const expectedAssets = getExpectedAssets(zip, browsers, files);
const validateManifest = getValidateManifest(testCase, baseManifest);

Expand Down
5 changes: 2 additions & 3 deletions shared/lib/error-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ const _setupLocale = async (currentLocale) => {
promises.push(Promise.resolve({})); // currentLocaleMessages
}

const [, enLocaleMessages, currentLocaleMessages] = await Promise.all(
promises,
);
const [, enLocaleMessages, currentLocaleMessages] =
await Promise.all(promises);
return { currentLocaleMessages, enLocaleMessages };
};

Expand Down
5 changes: 2 additions & 3 deletions test/e2e/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,8 @@ async function main() {
let existingParentDirectory;
if (out) {
outputDirectory = path.dirname(out);
existingParentDirectory = await getFirstParentDirectoryThatExists(
outputDirectory,
);
existingParentDirectory =
await getFirstParentDirectoryThatExists(outputDirectory);
if (!(await isWritable(existingParentDirectory))) {
throw new Error('Specified output file directory is not writable');
}
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/flask/btc/common-btc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ export async function withBtcAccountSnap(

export async function getQuickNodeSeenRequests(mockServer: Mockttp) {
const seenRequests = await Promise.all(
(
await mockServer.getMockedEndpoints()
).map((mockedEndpoint) => mockedEndpoint.getSeenRequests()),
(await mockServer.getMockedEndpoints()).map((mockedEndpoint) =>
mockedEndpoint.getSeenRequests(),
),
);
return seenRequests
.flat()
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/flask/user-operations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,8 @@ async function expectTransactionDetailsMatchReceipt(
throw new Error('No user operation hash found');
}

const receipt = await bundlerServer.getUserOperationReceipt(
userOperationHash,
);
const receipt =
await bundlerServer.getUserOperationReceipt(userOperationHash);

if (!receipt) {
throw new Error('No user operation receipt found');
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/lavamoat-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ async function main() {
let existingParentDirectory;
if (out) {
outputDirectory = path.dirname(out);
existingParentDirectory = await getFirstParentDirectoryThatExists(
outputDirectory,
);
existingParentDirectory =
await getFirstParentDirectoryThatExists(outputDirectory);
if (!(await isWritable(existingParentDirectory))) {
throw new Error('Specified output file directory is not writable');
}
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/mv3-perf-stats/bundle-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ async function main() {
if (out) {
const outPath = `${out}/bundle_size.json`;
const outputDirectory = path.dirname(outPath);
const existingParentDirectory = await getFirstParentDirectoryThatExists(
outputDirectory,
);
const existingParentDirectory =
await getFirstParentDirectoryThatExists(outputDirectory);
if (!(await isWritable(existingParentDirectory))) {
throw new Error('Specified output file directory is not writable');
}
Expand Down
Loading

0 comments on commit 12a0599

Please sign in to comment.