From b8d5680011bbfcfbc67c833dabfa0401d32c1de3 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Fri, 16 Sep 2022 09:04:32 -0700 Subject: [PATCH] chore: set curly eslint rule to multi line (#1322) * chore: set curly eslint rule to multi line * chore: fix lint * chore: make eslint rule error and fix resulting errors --- .eslintrc.json | 6 +++--- apps/token/src/components/vega-wallet/hooks.ts | 6 ++++-- apps/token/src/lib/url-connector.ts | 3 ++- libs/cypress/src/lib/eip1193-bridge.ts | 3 ++- .../lib/components/markets-container/markets-container.tsx | 5 ++++- libs/web3/src/lib/web3-connect-dialog.tsx | 6 ++++-- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e443df6d4..453edd508 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -51,8 +51,7 @@ "ul": ["list"], "ol": ["list"] } - ], - "curly": "warn" + ] } }, { @@ -75,7 +74,8 @@ "prefer": "type-imports", "disallowTypeAnnotations": true } - ] + ], + "curly": ["error", "multi-line"] } }, { diff --git a/apps/token/src/components/vega-wallet/hooks.ts b/apps/token/src/components/vega-wallet/hooks.ts index 840a7c7e8..cc863a223 100644 --- a/apps/token/src/components/vega-wallet/hooks.ts +++ b/apps/token/src/components/vega-wallet/hooks.ts @@ -197,14 +197,16 @@ export const usePollForDelegations = () => { new BigNumber(a.currentEpochStake || 0).isLessThan( b.currentEpochStake || 0 ) - ) + ) { return 1; + } if ( new BigNumber(a.currentEpochStake || 0).isGreaterThan( b.currentEpochStake || 0 ) - ) + ) { return -1; + } if ((!a.name && b.name) || a.name < b.name) return 1; if ((!b.name && a.name) || a.name > b.name) return -1; if (a.nodeId > b.nodeId) return 1; diff --git a/apps/token/src/lib/url-connector.ts b/apps/token/src/lib/url-connector.ts index 0133e0f75..4eb1521ce 100644 --- a/apps/token/src/lib/url-connector.ts +++ b/apps/token/src/lib/url-connector.ts @@ -34,8 +34,9 @@ export class CustomizedBridge extends Eip1193Bridge { // If from is present on eth_call it errors, removing it makes the library set // from as the connected wallet which works fine - if (params && params.length && params[0].from && method === 'eth_call') + if (params && params.length && params[0].from && method === 'eth_call') { delete params[0].from; + } let result; // For sending a transaction if we call send it will error // as it wants gasLimit in sendTransaction but hexlify sets the property gas diff --git a/libs/cypress/src/lib/eip1193-bridge.ts b/libs/cypress/src/lib/eip1193-bridge.ts index 430a0008c..31531fe46 100644 --- a/libs/cypress/src/lib/eip1193-bridge.ts +++ b/libs/cypress/src/lib/eip1193-bridge.ts @@ -50,8 +50,9 @@ export class CustomizedBridge extends Eip1193Bridge { // If from is present on eth_call it errors, removing it makes the library set // from as the connected wallet which works fine - if (params && params.length && params[0].from && method === 'eth_call') + if (params && params.length && params[0].from && method === 'eth_call') { delete params[0].from; + } let result; // For sending a transaction if we call send it will error // as it wants gasLimit in sendTransaction but hexlify sets the property gas diff --git a/libs/market-list/src/lib/components/markets-container/markets-container.tsx b/libs/market-list/src/lib/components/markets-container/markets-container.tsx index bcbbdc9ab..410020e44 100644 --- a/libs/market-list/src/lib/components/markets-container/markets-container.tsx +++ b/libs/market-list/src/lib/components/markets-container/markets-container.tsx @@ -21,8 +21,11 @@ export const MarketsContainer = ({ onSelect }: MarketsContainerProps) => { onRowClicked={(rowEvent: RowClickedEvent) => { const { data, event } = rowEvent; // filters out clicks on the symbol column because it should display asset details - if ((event?.target as HTMLElement).tagName.toUpperCase() === 'BUTTON') + if ( + (event?.target as HTMLElement).tagName.toUpperCase() === 'BUTTON' + ) { return; + } onSelect((data as MarketWithData).id); }} /> diff --git a/libs/web3/src/lib/web3-connect-dialog.tsx b/libs/web3/src/lib/web3-connect-dialog.tsx index 9ec13fdca..bc01fd653 100644 --- a/libs/web3/src/lib/web3-connect-dialog.tsx +++ b/libs/web3/src/lib/web3-connect-dialog.tsx @@ -49,15 +49,17 @@ export const Web3ConnectDialog = ({ }; function getConnectorInfo(connector: Connector) { - if (connector instanceof MetaMask) + if (connector instanceof MetaMask) { return { name: 'MetaMask', text: t('MetaMask, Brave or other injected web wallet'), }; - if (connector instanceof WalletConnect) + } + if (connector instanceof WalletConnect) { return { name: 'WalletConnect', text: t('WalletConnect'), }; + } return { name: 'Unknown', text: t('Unknown') }; }