Skip to content

Commit

Permalink
chore: add 'no-case-declarations' ESLint rule
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-sanderson committed Oct 31, 2024
1 parent a64091e commit 855548f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ module.exports = {
allowArrowFunctions: true,
},
],
'no-case-declarations': 'error',
// Fix for TypeScript.
'react/jsx-filename-extension': [
'error',
Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain-link/src/workers/electrum/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ const onRequest = async <T extends Message>(
throw new CustomError(`Subscription ${request.payload.type} not implemented`);
}
// @ts-expect-error this message is used in tests
case 'raw':
case 'raw': {
// @ts-expect-error

const { method, params } = request.payload;

return client
.request(method, ...params)
.then((res: any) => ({ type: method, payload: res }));
}
default:
throw new CustomError('worker_unknown_request', `+${request.type}`);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/connect/src/data/analyticsInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const enhanceMessageWithAnalytics = (
data: { device?: Device },
): CoreEventMessage => {
switch (message.type) {
case UI_REQUEST.REQUEST_CONFIRMATION:
case UI_REQUEST.REQUEST_CONFIRMATION: {
const { device } = data;

return {
Expand Down Expand Up @@ -37,6 +37,7 @@ export const enhanceMessageWithAnalytics = (
},
},
};
}

default:
return message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const MultiShareBackupModal = ({ onCancel }: MultiShareBackupModalProps)

const getStepConfig = (): StepConfig => {
switch (step) {
case 'first-info':
case 'first-info': {
const goToStepNextStep = () => {
setIsSubmitted(true);
if (isChecked1 && isChecked2) {
Expand Down Expand Up @@ -107,8 +107,9 @@ export const MultiShareBackupModal = ({ onCancel }: MultiShareBackupModalProps)
isCancelable: true,
hasBackdropCancel: true,
};
}

case 'second-info':
case 'second-info': {
const enterBackup = async () => {
setStep('verify-ownership');

Expand Down Expand Up @@ -160,6 +161,7 @@ export const MultiShareBackupModal = ({ onCancel }: MultiShareBackupModalProps)
isCancelable: true,
hasBackdropCancel: true,
};
}

case 'verify-ownership':
return {
Expand Down
3 changes: 2 additions & 1 deletion suite-common/wallet-utils/src/tokenUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ export const getContractAddressForNetwork = (
case 'dsol':
return contractAddress;
case 'ada':
case 'tada':
case 'tada': {
const { policyId } = parseAsset(contractAddress);

return policyId.toLowerCase();
}
default:
return contractAddress.toLowerCase();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const AccountSelectBottomSheet = React.memo(
}}
/>
);
case 'token':
case 'token': {
const { token, account } = item;

return (
Expand All @@ -82,6 +82,7 @@ export const AccountSelectBottomSheet = React.memo(
}
/>
);
}
default:
return null;
}
Expand Down
3 changes: 2 additions & 1 deletion suite-native/blockchain/src/blockchainMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const blockchainMiddleware = createMiddleware(
dispatch(onBlockchainConnectThunk({ symbol: action.payload.coin.shortcut }));

break;
case TREZOR_CONNECT_BLOCKCHAIN_ACTIONS.BLOCK:
case TREZOR_CONNECT_BLOCKCHAIN_ACTIONS.BLOCK: {
const networksWithPendingTransactions =
selectNetworksWithPendingTransactions(getState());
const symbol = action.payload.coin.shortcut.toLowerCase() as NetworkSymbol;
Expand All @@ -39,6 +39,7 @@ export const blockchainMiddleware = createMiddleware(
}

break;
}
case TREZOR_CONNECT_BLOCKCHAIN_ACTIONS.NOTIFICATION:
dispatch(onBlockchainNotificationThunk(action.payload));
break;
Expand Down

0 comments on commit 855548f

Please sign in to comment.