Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eslint rules #3475

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"additionalHooks": "useAsync"
}
],
"no-only-tests/no-only-tests": "error"
"no-only-tests/no-only-tests": "error",
"object-shorthand": ["error", "properties"],
"jsx-quotes": ["error", "prefer-double"],
"react/jsx-curly-brace-presence": ["error", { "props": "never", "children": "never" }]
},
"ignorePatterns": ["node_modules/", ".next/", ".github/"],
"plugins": ["unused-imports", "@typescript-eslint", "no-only-tests"]
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/pages/address_book.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export function verifyEditedNameNotExists(name) {
}

export function clickOnWhatsNewBtn(force = false) {
cy.contains(whatsNewBtnStr).click({ force: force })
cy.contains(whatsNewBtnStr).click({ force })
}

export function acceptBeamerCookies() {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/pages/safeapps.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export function clearSearchAppInput() {
}

export function verifyLinkName(name) {
cy.findAllByRole('link', { name: name }).should('have.length', 1)
cy.findAllByRole('link', { name }).should('have.length', 1)
}

export function clickOnApp(app) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/batch/BatchIndicator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const BatchIndicator = ({ onClick }: { onClick?: () => void }) => {
<Badge
variant="standard"
badgeContent={length}
color={'secondary'}
color="secondary"
anchorOrigin={{
vertical: 'bottom',
horizontal: 'right',
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/EthHashInfo/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe('EthHashInfo', () => {
)

const { container } = render(
<EthHashInfo address={'0xe26920604f9a02c5a877d449faa71b7504f0c2508dcc7c0384078a024b8e592f'} showCopyButton />,
<EthHashInfo address="0xe26920604f9a02c5a877d449faa71b7504f0c2508dcc7c0384078a024b8e592f" showCopyButton />,
)

const button = container.querySelector('button')
Expand Down
8 changes: 4 additions & 4 deletions src/components/new-safe/create/logic/address-book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export const updateAddressBook = (
return (dispatch) => {
dispatch(
upsertAddressBookEntry({
chainId: chainId,
address: address,
name: name,
chainId,
address,
name,
}),
)

Expand All @@ -37,7 +37,7 @@ export const updateAddressBook = (
value: owner.address,
name: owner.name || owner.ens,
})),
chainId: chainId,
chainId,
nonce: 0,
},
}),
Expand Down
2 changes: 1 addition & 1 deletion src/components/new-safe/create/logic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const estimateSafeCreationGas = async (
const encodedSafeCreationTx = await encodeSafeCreationTx({ ...safeParams, chain })

const gas = await provider.estimateGas({
from: from,
from,
to: await readOnlyProxyFactoryContract.getAddress(),
data: encodedSafeCreationTx,
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/nfts/NftCollections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const NftCollections = (): ReactElement => {
)}

{/* NFT preview */}
{<NftPreviewModal onClose={() => setPreviewNft(undefined)} nft={previewNft} />}
<NftPreviewModal onClose={() => setPreviewNft(undefined)} nft={previewNft} />
</>
)
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/safe-apps/AppFrame/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ const AppFrame = ({ appUrl, allowedFeaturesList, safeAppFromManifest }: AppFrame
const data = {
app: safeAppFromManifest,
appId: remoteApp ? String(remoteApp.id) : undefined,
requestId: requestId,
txs: txs,
params: params,
requestId,
txs,
params,
}

setCurrentRequestId(requestId)
Expand Down
2 changes: 1 addition & 1 deletion src/components/safe-apps/SafeAppCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const SafeAppCardGridView = ({
openPreviewDrawer,
}: SafeAppCardViewProps) => {
return (
<SafeAppCardContainer safeAppUrl={safeAppUrl} onClickSafeApp={onClickSafeApp} height={'100%'}>
<SafeAppCardContainer safeAppUrl={safeAppUrl} onClickSafeApp={onClickSafeApp} height="100%">
{/* Safe App Header */}
<CardHeader
className={css.safeAppHeader}
Expand Down
2 changes: 1 addition & 1 deletion src/components/safe-apps/SafeAppSocialLinksCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const SafeAppSocialLinksCard = ({ safeApp }: SafeAppSocialLinksCardProps) => {
)}

{hasSocialLinks && developerWebsite && (
<Divider sx={{ height: '40px' }} orientation="vertical" component={'div'} />
<Divider sx={{ height: '40px' }} orientation="vertical" component="div" />
)}

{/* Developer website section */}
Expand Down
2 changes: 1 addition & 1 deletion src/components/safe-apps/SafeAppsFilters/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const SafeAppsFilters = ({
) : (
<MenuItem disabled sx={{ padding: '0 6px 2px 6px', height: CATEGORY_OPTION_HEIGHT }} disableGutters>
<ListItemText
primary={'No categories defined'}
primary="No categories defined"
primaryTypographyProps={{ fontSize: 14, paddingLeft: '5px' }}
/>
</MenuItem>
Expand Down
4 changes: 2 additions & 2 deletions src/components/safe-messages/MsgSigners/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const MsgSigners = ({
))}
{!showOnlyConfirmations && confirmations.length > 0 && (
<ListItem>
<ListItemIcon sx={{ backgroundColor: backgroundColor }}>
<ListItemIcon sx={{ backgroundColor }}>
<Dot />
</ListItemIcon>
<ListItemText>
Expand All @@ -121,7 +121,7 @@ export const MsgSigners = ({
<ListItemText>
<Box display="flex" flexDirection="row" alignItems="center" gap={1}>
<Skeleton variant="circular" width={36} height={36} />
<Typography variant="body2" color={'text.secondary'}>
<Typography variant="body2" color="text.secondary">
Confirmation #{idx + 1 + confirmationsSubmitted}
</Typography>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ describe('useNotificationPreferences', () => {

const preferences = {
[`${chainId}:${safeAddress}`]: {
chainId: chainId,
safeAddress: safeAddress,
chainId,
safeAddress,
preferences: DEFAULT_NOTIFICATION_PREFERENCES,
},
}
Expand All @@ -307,8 +307,8 @@ describe('useNotificationPreferences', () => {
await waitFor(() => {
expect(result.current.getAllPreferences()).toEqual({
[`${chainId}:${safeAddress}`]: {
chainId: chainId,
safeAddress: safeAddress,
chainId,
safeAddress,
preferences: {
...DEFAULT_NOTIFICATION_PREFERENCES,
[WebhookType.CONFIRMATION_REQUEST]: false,
Expand Down
4 changes: 2 additions & 2 deletions src/components/settings/owner/EditOwnerDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const EditOwnerDialog = ({ chainId, address, name }: { chainId: string; a
if (data.name !== name) {
dispatch(
upsertAddressBookEntry({
chainId: chainId,
address: address,
chainId,
address,
name: data.name,
}),
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebar/WatchlistAddButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const WatchlistAddButton = () => {
pathname: AppRoutes.newSafe.load,
query: {
chain: chain?.shortName,
address: address,
address,
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/transactions/UntrustedTxWarning/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import WarningIcon from '@/public/images/notifications/warning.svg'

const UntrustedTxWarning = () => {
return (
<Tooltip title={`This token is unfamiliar and may pose risks when interacting with it or involved addresses`}>
<Tooltip title="This token is unfamiliar and may pose risks when interacting with it or involved addresses">
<Box
lineHeight="16px"
sx={{
Expand Down
2 changes: 1 addition & 1 deletion src/components/tx-flow/flows/AddOwner/ReviewOwner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const ReviewOwner = ({ params }: { params: AddOwnerFlowProps | ReplaceOwn
if (typeof newOwner.name !== 'undefined') {
dispatch(
upsertAddressBookEntry({
chainId: chainId,
chainId,
address: newOwner.address,
name: newOwner.name,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const ReviewSpendingLimit = ({ params }: { params: NewSpendingLimitFlowPr
>
{existingAmount}
</Typography>
{'→'}
</>
)}
</SendAmountBlock>
Expand Down
2 changes: 1 addition & 1 deletion src/components/tx/ApprovalEditor/hooks/useApprovalInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const useApprovalInfos = (payload: {
? PSEUDO_APPROVAL_VALUES.UNLIMITED
: formatUnits(approval.amount, tokenInfo?.decimals)

return { ...approval, tokenInfo: tokenInfo, amountFormatted }
return { ...approval, tokenInfo, amountFormatted }
}),
)
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/tx/SignOrExecuteForm/ExecuteForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const ExecuteForm = ({
Cannot execute a transaction from the Safe Account itself, please connect a different account.
</ErrorMessage>
) : !walletCanPay && !willRelay ? (
<ErrorMessage level={'info'}>
<ErrorMessage level="info">
Your connected wallet doesn&apos;t have enough funds to execute this transaction.
</ErrorMessage>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('SignOrExecute', () => {
safeTx={safeTxBuilder().build()}
onSubmit={jest.fn()}
safeTxError={undefined}
txId={'someid'}
txId="someid"
isExecutable={true}
chainId="1"
/>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/tx/SignOrExecuteForm/hooks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('SignOrExecute hooks', () => {
jest.spyOn(wallet, 'default').mockReturnValue({
chainId: '1',
label: 'MetaMask',
address: address,
address,
} as ConnectedWallet)

const { result } = renderHook(() => useIsExecutionLoop())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const usePendingSafeStatus = (): void => {
chainId: safe.chainId,
address: safeAddress,
status: {
status: status,
status,
txHash: 'txHash' in detail ? detail.txHash : undefined,
taskId: 'taskId' in detail ? detail.taskId : undefined,
startBlock: await provider?.getBlockNumber(),
Expand Down
2 changes: 1 addition & 1 deletion src/features/recovery/hooks/useRecoveryTxNotification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function useRecoveryTxNotifications(): void {
title,
message,
detailedMessage: isError ? detail.error.message : undefined,
groupKey: groupKey,
groupKey,
variant: isError ? 'error' : isSuccess ? 'success' : 'info',
link,
}),
Expand Down
12 changes: 6 additions & 6 deletions src/features/recovery/services/recovery-sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,22 @@ export async function dispatchRecoveryProposal({
recoveryDispatch(RecoveryEvent.PROCESSING_BY_SMART_CONTRACT_WALLET, {
moduleAddress: delayModifierAddress,
recoveryTxHash,
txType: txType,
txType,
txHash: tx.hash,
})
} else {
waitForRecoveryTx({
moduleAddress: delayModifierAddress,
recoveryTxHash,
txType: txType,
txType,
tx,
})
}
} catch (error) {
recoveryDispatch(RecoveryEvent.FAILED, {
moduleAddress: delayModifierAddress,
recoveryTxHash,
txType: txType,
txType,
error: asError(error),
})

Expand Down Expand Up @@ -168,22 +168,22 @@ export async function dispatchRecoveryExecution({
recoveryDispatch(RecoveryEvent.PROCESSING_BY_SMART_CONTRACT_WALLET, {
moduleAddress: delayModifierAddress,
recoveryTxHash: args.txHash,
txType: txType,
txType,
txHash: tx.hash,
})
} else {
waitForRecoveryTx({
moduleAddress: delayModifierAddress,
recoveryTxHash: args.txHash,
txType: txType,
txType,
tx,
})
}
} catch (error) {
recoveryDispatch(RecoveryEvent.FAILED, {
moduleAddress: delayModifierAddress,
recoveryTxHash: args.txHash,
txType: txType,
txType,
error: asError(error),
})

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/__tests__/usePendingActions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ describe('usePendingActions hook', () => {
const mockPage = {
error: undefined,
loading: false,
page: page,
page,
}
jest.spyOn(useTxQueue, 'default').mockReturnValue(mockPage)

Expand Down
4 changes: 2 additions & 2 deletions src/hooks/coreSDK/safeCoreSDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ export const initSafeSDK = async ({
if (undeployedSafe) {
return Safe.create({
ethAdapter: createReadOnlyEthersAdapter(provider),
isL1SafeSingleton: isL1SafeSingleton,
isL1SafeSingleton,
predictedSafe: undeployedSafe.props,
})
}

return Safe.create({
ethAdapter: createReadOnlyEthersAdapter(provider),
safeAddress: address,
isL1SafeSingleton: isL1SafeSingleton,
isL1SafeSingleton,
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/messages/useSafeMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const useSafeMessages = (
{
page,
error: error?.message,
loading: loading,
loading,
}
: // Stored page
{
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useGasPrice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const parseEtherscanOracleResult = (result: EtherscanResult, gweiFactor: string)
const baseFee = BigInt(Number(result.suggestBaseFee) * Number(gweiFactor))

return {
maxFeePerGas: maxFeePerGas,
maxFeePerGas,
maxPriorityFeePerGas: maxFeePerGas - baseFee,
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useTxQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const useTxQueue = (
? {
page,
error: error?.message,
loading: loading,
loading,
}
: {
page: queueState.data,
Expand Down
2 changes: 1 addition & 1 deletion src/store/txQueueSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const txQueueListener = (listenerMiddleware: typeof listenerMiddlewareIns
sameAddress(address.value, awaitingSigner),
)
) {
txDispatch(TxEvent.SIGNATURE_INDEXED, { txId: txId })
txDispatch(TxEvent.SIGNATURE_INDEXED, { txId })
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const mockWeb3Provider = (
return Promise.resolve(50_000n)
}),
_isProvider: true,
resolveName: resolveName,
resolveName,
} as unknown as JsonRpcProvider
jest.spyOn(web3, 'useWeb3ReadOnly').mockReturnValue(mockWeb3ReadOnly)
return mockWeb3ReadOnly
Expand Down