diff --git a/.eslintignore b/.eslintignore
index e34cedf643..98ca688355 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -2,3 +2,4 @@
*.d.ts
/src/graphql/data/__generated__/types-and-hooks.ts
/src/graphql/thegraph/__generated__/types-and-hooks.ts
+/src/schema/schema.graphql
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 0000000000..cb37c8d9a4
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,7 @@
+/* eslint-env node */
+
+require('@uniswap/eslint-config/load')
+
+module.exports = {
+ extends: '@uniswap/eslint-config/react',
+}
diff --git a/.eslintrc.json b/.eslintrc.json
deleted file mode 100644
index 3bb6768387..0000000000
--- a/.eslintrc.json
+++ /dev/null
@@ -1,109 +0,0 @@
-{
- "parser": "@typescript-eslint/parser",
- "parserOptions": {
- "ecmaVersion": 2020,
- "sourceType": "module",
- "ecmaFeatures": {
- // Allows for the parsing of JSX
- "jsx": true
- }
- },
- "settings": {
- "react": {
- "version": "detect"
- },
- "import/parsers": {
- "@typescript-eslint/parser": [".ts", ".tsx"]
- },
- "import/resolver": {
- "typescript": {
- "alwaysTryTypes": true
- }
- }
- },
- "ignorePatterns": [
- "src/types/v3",
- "src/abis/types",
- "src/locales/**/*.js",
- "src/locales/**/en-US.po",
- "node_modules",
- "coverage",
- "build",
- "dist",
- ".DS_Store",
- ".env.local",
- ".env.development.local",
- ".env.test.local",
- ".env.production.local",
- ".idea/",
- ".vscode/",
- "package-lock.json",
- "yarn.lock"
- ],
- "extends": [
- "react-app",
- "plugin:react/recommended",
- "plugin:@typescript-eslint/recommended",
- "plugin:react-hooks/recommended",
- "prettier/@typescript-eslint",
- "plugin:prettier/recommended",
- "plugin:import/typescript"
- ],
- "plugins": ["import", "simple-import-sort", "unused-imports"],
- "rules": {
- "import/no-unused-modules": [2, { "unusedExports": true }],
- "unused-imports/no-unused-imports": "error",
- "simple-import-sort/imports": "error",
- "simple-import-sort/exports": "error",
- "@typescript-eslint/explicit-function-return-type": "off",
- "prettier/prettier": "error",
- "@typescript-eslint/no-explicit-any": "off",
- "@typescript-eslint/ban-ts-comment": "off",
- "@typescript-eslint/ban-ts-ignore": "off",
- "@typescript-eslint/explicit-module-boundary-types": "off",
- "react/react-in-jsx-scope": "off",
- "react/jsx-curly-brace-presence": ["error", { "props": "never", "children": "never" }],
- "object-shorthand": ["error", "always"],
- "no-restricted-imports": [
- "error",
- {
- "paths": [
- {
- "name": "ethers",
- "message": "Please import from '@ethersproject/module' directly to support tree-shaking."
- },
- {
- "name": "styled-components",
- "message": "Please import from styled-components/macro."
- },
- {
- "name": "@lingui/macro",
- "importNames": ["t"],
- "message": "Please use instead of t."
- }
- ],
- "patterns": [
- {
- "group": ["**/dist"],
- "message": "Do not import from dist/ - this is an implementation detail, and breaks tree-shaking."
- },
- {
- "group": ["!styled-components/macro"]
- }
- ]
- }
- ],
- "@typescript-eslint/no-restricted-imports": [
- "error",
- {
- "paths": [
- {
- "name": "@ethersproject/providers",
- "message": "Please only use Providers instantiated in constants/providers to improve traceability.",
- "allowTypeImports": true
- }
- ]
- }
- ]
- }
-}
diff --git a/.prettierignore b/.prettierignore
deleted file mode 100644
index 40710857f5..0000000000
--- a/.prettierignore
+++ /dev/null
@@ -1 +0,0 @@
-/src/schema/schema.graphql
\ No newline at end of file
diff --git a/.prettierrc b/.prettierrc
deleted file mode 100644
index 31ba22d843..0000000000
--- a/.prettierrc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "semi": false,
- "singleQuote": true,
- "printWidth": 120
-}
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000000..a99e2432b2
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,6 @@
+{
+ "recommendations": [
+ "dbaeumer.vscode-eslint"
+ ],
+ "unwantedRecommendations": []
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
index bff658ad78..1107045fbf 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -5,15 +5,12 @@
"editor.formatOnSaveMode": "file",
"editor.tabCompletion": "on",
"editor.tabSize": 2,
- "editor.formatOnSave": true,
+ "editor.formatOnSave": false,
"editor.inlineSuggest.enabled": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"files.eol": "\n",
"eslint.enable": true,
- "eslint.debug": true,
- "[typescript]": {
- "editor.defaultFormatter": "esbenp.prettier-vscode"
- }
+ "eslint.debug": true
}
diff --git a/apollo-codegen.ts b/apollo-codegen.ts
index 43b1fe1ca3..ccc36e913d 100644
--- a/apollo-codegen.ts
+++ b/apollo-codegen.ts
@@ -1,3 +1,5 @@
+/* eslint-env node */
+
import type { CodegenConfig } from '@graphql-codegen/cli'
// Generates TS objects from the schemas returned by graphql queries
diff --git a/apollo-codegen_thegraph.ts b/apollo-codegen_thegraph.ts
index 085f64d95b..677a6bd24c 100644
--- a/apollo-codegen_thegraph.ts
+++ b/apollo-codegen_thegraph.ts
@@ -1,3 +1,5 @@
+/* eslint-env node */
+
import type { CodegenConfig } from '@graphql-codegen/cli'
// Generates TS objects from the schemas returned by graphql queries
diff --git a/babel-plugin-macros.config.js b/babel-plugin-macros.config.js
index 6d1fae318a..5f65e606c0 100644
--- a/babel-plugin-macros.config.js
+++ b/babel-plugin-macros.config.js
@@ -1,3 +1,5 @@
+/* eslint-env node */
+
const isDev = process.env.NODE_ENV === 'development'
module.exports = {
diff --git a/cypress/release.ts b/cypress/release.ts
index 1b8134739d..f639f6587c 100644
--- a/cypress/release.ts
+++ b/cypress/release.ts
@@ -8,7 +8,8 @@ describe(
},
() => {
it('loads swap page', () => {
- // We *must* wait in order to space out the retry attempts.
+ // TODO: We *must* wait in order to space out the retry attempts. Find a better way to do this.
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(ONE_MINUTE)
.visit('/', {
retryOnStatusCodeFailure: true,
diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts
index fb78dd23df..327c10e458 100644
--- a/cypress/support/e2e.ts
+++ b/cypress/support/e2e.ts
@@ -85,8 +85,7 @@ beforeEach(() => {
})
})
-Cypress.on('uncaught:exception', (_err, _runnable) => {
- // returning false here prevents Cypress from
- // failing the test
+Cypress.on('uncaught:exception', () => {
+ // returning false here prevents Cypress from failing the test
return false
})
diff --git a/cypress/utils/graphql-test-utils.ts b/cypress/utils/graphql-test-utils.ts
index f6c3ed6375..b5b2039834 100644
--- a/cypress/utils/graphql-test-utils.ts
+++ b/cypress/utils/graphql-test-utils.ts
@@ -1,7 +1,7 @@
// Utility to match GraphQL mutation based on the query name
export const hasQuery = (req: any, queryName: string) => {
const { body } = req
- return body.hasOwnProperty('query') && body.query.includes(queryName)
+ return Object.prototype.hasOwnProperty.call(body, 'query') && body.query.includes(queryName)
}
// Alias query if queryName matches
diff --git a/fetch-schema.js b/fetch-schema.js
index 0bfdc239a1..229ea8428d 100644
--- a/fetch-schema.js
+++ b/fetch-schema.js
@@ -1,9 +1,10 @@
-/* eslint-disable */
+/* eslint-env node */
+
require('dotenv').config({ path: '.env.production' })
+
const { exec } = require('child_process')
const dataConfig = require('./graphql.config')
const thegraphConfig = require('./graphql_thegraph.config')
-/* eslint-enable */
function fetchSchema(url, outputFile) {
exec(
diff --git a/graphql.config.js b/graphql.config.js
index 240d3a7b18..784486127a 100644
--- a/graphql.config.js
+++ b/graphql.config.js
@@ -1,3 +1,5 @@
+/* eslint-env node */
+
module.exports = {
src: './src',
language: 'typescript',
diff --git a/graphql_thegraph.config.js b/graphql_thegraph.config.js
index b8564f0816..29ce5dbe9f 100644
--- a/graphql_thegraph.config.js
+++ b/graphql_thegraph.config.js
@@ -1,4 +1,5 @@
-// eslint-disable-next-line @typescript-eslint/no-var-requires
+/* eslint-env node */
+
const defaultConfig = require('./graphql.config')
module.exports = {
diff --git a/package.json b/package.json
index 522ad109d9..2cdc5832f1 100644
--- a/package.json
+++ b/package.json
@@ -90,22 +90,12 @@
"@types/ua-parser-js": "^0.7.35",
"@types/uuid": "^8.3.4",
"@types/wcag-contrast": "^3.0.0",
- "@typescript-eslint/eslint-plugin": "^4",
- "@typescript-eslint/parser": "^4",
+ "@uniswap/eslint-config": "^1.1.1",
"@vanilla-extract/babel-plugin": "^1.1.7",
"@vanilla-extract/webpack-plugin": "^2.1.11",
"cypress": "^10.3.1",
"env-cmd": "^10.1.0",
"eslint": "^7.11.0",
- "eslint-config-prettier": "^6.11.0",
- "eslint-import-resolver-typescript": "^3.5.2",
- "eslint-plugin-better-styled-components": "^1.1.2",
- "eslint-plugin-import": "^2.26.0",
- "eslint-plugin-prettier": "^3.1.3",
- "eslint-plugin-react": "^7.21.5",
- "eslint-plugin-react-hooks": "^4.6.0",
- "eslint-plugin-simple-import-sort": "^7.0.0",
- "eslint-plugin-unused-imports": "^2.0.0",
"jest-styled-components": "^7.0.8",
"ms.macro": "^2.0.0",
"patch-package": "^6.4.7",
diff --git a/prei18n-extract.js b/prei18n-extract.js
index 15c8ce613d..d27248ba53 100644
--- a/prei18n-extract.js
+++ b/prei18n-extract.js
@@ -1,4 +1,5 @@
-// eslint-disable-next-line @typescript-eslint/no-var-requires
+/* eslint-env node */
+
const { exec } = require('child_process')
const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE)
diff --git a/src/components/AccountDetails/TransactionSummary.tsx b/src/components/AccountDetails/TransactionSummary.tsx
index 981e055155..924329f3b8 100644
--- a/src/components/AccountDetails/TransactionSummary.tsx
+++ b/src/components/AccountDetails/TransactionSummary.tsx
@@ -14,18 +14,15 @@ import {
CollectFeesTransactionInfo,
CreateV3PoolTransactionInfo,
DelegateTransactionInfo,
- DepositLiquidityStakingTransactionInfo,
ExactInputSwapTransactionInfo,
ExactOutputSwapTransactionInfo,
ExecuteTransactionInfo,
MigrateV2LiquidityToV3TransactionInfo,
QueueTransactionInfo,
RemoveLiquidityV3TransactionInfo,
- SubmitProposalTransactionInfo,
TransactionInfo,
TransactionType,
VoteTransactionInfo,
- WithdrawLiquidityStakingTransactionInfo,
WrapTransactionInfo,
} from '../../state/transactions/types'
@@ -83,7 +80,7 @@ function ClaimSummary({ info: { recipient, uniAmountRaw } }: { info: ClaimTransa
)
}
-function SubmitProposalTransactionSummary(_: { info: SubmitProposalTransactionInfo }) {
+function SubmitProposalTransactionSummary() {
return Submit new proposal
}
@@ -175,13 +172,13 @@ function WrapSummary({ info: { chainId, currencyAmountRaw, unwrapped } }: { info
}
}
-function DepositLiquidityStakingSummary(_: { info: DepositLiquidityStakingTransactionInfo }) {
+function DepositLiquidityStakingSummary() {
// not worth rendering the tokens since you can should no longer deposit liquidity in the staking contracts
// todo: deprecate and delete the code paths that allow this, show user more information
return Deposit liquidity
}
-function WithdrawLiquidityStakingSummary(_: { info: WithdrawLiquidityStakingTransactionInfo }) {
+function WithdrawLiquidityStakingSummary() {
return Withdraw deposited liquidity
}
@@ -319,10 +316,10 @@ export function TransactionSummary({ info }: { info: TransactionInfo }) {
return
case TransactionType.DEPOSIT_LIQUIDITY_STAKING:
- return
+ return
case TransactionType.WITHDRAW_LIQUIDITY_STAKING:
- return
+ return
case TransactionType.SWAP:
return
@@ -358,6 +355,6 @@ export function TransactionSummary({ info }: { info: TransactionInfo }) {
return
case TransactionType.SUBMIT_PROPOSAL:
- return
+ return
}
}
diff --git a/src/components/AccountDetailsV2/LogoView.tsx b/src/components/AccountDetailsV2/LogoView.tsx
index 8a5ec873a9..ac11868642 100644
--- a/src/components/AccountDetailsV2/LogoView.tsx
+++ b/src/components/AccountDetailsV2/LogoView.tsx
@@ -39,26 +39,32 @@ const getCurrency = ({ info, chainId }: { info: TransactionInfo; chainId: number
switch (info.type) {
case TransactionType.ADD_LIQUIDITY_V3_POOL:
case TransactionType.REMOVE_LIQUIDITY_V3:
- case TransactionType.CREATE_V3_POOL:
+ case TransactionType.CREATE_V3_POOL: {
const { baseCurrencyId, quoteCurrencyId } = info
return { currencyId0: baseCurrencyId, currencyId1: quoteCurrencyId }
- case TransactionType.SWAP:
+ }
+ case TransactionType.SWAP: {
const { inputCurrencyId, outputCurrencyId } = info
return { currencyId0: inputCurrencyId, currencyId1: outputCurrencyId }
- case TransactionType.WRAP:
+ }
+ case TransactionType.WRAP: {
const { unwrapped } = info
const native = info.chainId ? nativeOnChain(info.chainId) : undefined
const base = 'ETH'
const wrappedCurrency = native?.wrapped.address ?? 'WETH'
return { currencyId0: unwrapped ? wrappedCurrency : base, currencyId1: unwrapped ? base : wrappedCurrency }
- case TransactionType.COLLECT_FEES:
+ }
+ case TransactionType.COLLECT_FEES: {
const { currencyId0, currencyId1 } = info
return { currencyId0, currencyId1 }
- case TransactionType.APPROVAL:
+ }
+ case TransactionType.APPROVAL: {
return { currencyId0: info.tokenAddress, currencyId1: undefined }
- case TransactionType.CLAIM:
+ }
+ case TransactionType.CLAIM: {
const uniAddress = chainId ? UNI_ADDRESS[chainId] : undefined
return { currencyId0: uniAddress, currencyId1: undefined }
+ }
default:
return { currencyId0: undefined, currencyId1: undefined }
}
diff --git a/src/components/FeatureFlagModal/FeatureFlagModal.tsx b/src/components/FeatureFlagModal/FeatureFlagModal.tsx
index 7a95686dd4..44936f32ed 100644
--- a/src/components/FeatureFlagModal/FeatureFlagModal.tsx
+++ b/src/components/FeatureFlagModal/FeatureFlagModal.tsx
@@ -164,7 +164,7 @@ function FeatureFlagGroup({ name, children }: PropsWithChildren<{ name: string }
)
}
-function FeatureFlagOption({ variant, featureFlag, value, label }: FeatureFlagProps) {
+function FeatureFlagOption({ variant, featureFlag, label }: FeatureFlagProps) {
const updateFlag = useUpdateFlag()
const [count, setCount] = useState(0)
const featureFlags = useAtomValue(featureFlagSettings)
diff --git a/src/components/FiatOnrampModal/index.tsx b/src/components/FiatOnrampModal/index.tsx
index 538e5f6217..7c4965f46c 100644
--- a/src/components/FiatOnrampModal/index.tsx
+++ b/src/components/FiatOnrampModal/index.tsx
@@ -67,7 +67,7 @@ const MOONPAY_SUPPORTED_CURRENCY_CODES = [
export default function FiatOnrampModal() {
const { account } = useWeb3React()
const theme = useTheme()
- const closeModal = useCloseModal(ApplicationModal.FIAT_ONRAMP)
+ const closeModal = useCloseModal()
const fiatOnrampModalOpen = useModalIsOpen(ApplicationModal.FIAT_ONRAMP)
const [signedIframeUrl, setSignedIframeUrl] = useState(null)
diff --git a/src/components/NavigationTabs/index.tsx b/src/components/NavigationTabs/index.tsx
index 3b2f908f84..d0934672c3 100644
--- a/src/components/NavigationTabs/index.tsx
+++ b/src/components/NavigationTabs/index.tsx
@@ -76,7 +76,7 @@ export function AddRemoveTabs({
// detect if back should redirect to v3 or v2 pool page
const poolLink = location.pathname.includes('add/v2')
? '/pool/v2'
- : '/pool' + (!!positionID ? `/${positionID.toString()}` : '')
+ : '/pool' + (positionID ? `/${positionID.toString()}` : '')
return (
diff --git a/src/components/Toggle/index.tsx b/src/components/Toggle/index.tsx
index ab371b7a0c..c4b8ad06be 100644
--- a/src/components/Toggle/index.tsx
+++ b/src/components/Toggle/index.tsx
@@ -51,7 +51,7 @@ const ToggleElement = styled.span<{ isActive?: boolean; bgColor?: string; isInit
${({ isActive, isInitialToggleLoad }) => (isInitialToggleLoad ? 'none' : isActive ? turnOnToggle : turnOffToggle)}
ease-in;
background: ${({ theme, bgColor, isActive }) =>
- isActive ? bgColor ?? theme.accentAction : !!bgColor ? theme.deprecated_bg4 : theme.textTertiary};
+ isActive ? bgColor ?? theme.accentAction : bgColor ? theme.deprecated_bg4 : theme.textTertiary};
border-radius: 50%;
height: 24px;
:hover {
diff --git a/src/components/Tokens/TokenDetails/Skeleton.tsx b/src/components/Tokens/TokenDetails/Skeleton.tsx
index 531a2eb0e2..5d7596b29b 100644
--- a/src/components/Tokens/TokenDetails/Skeleton.tsx
+++ b/src/components/Tokens/TokenDetails/Skeleton.tsx
@@ -222,7 +222,7 @@ export default function TokenDetailsSkeleton() {
const { chainName } = useParams<{ chainName?: string }>()
return (
-
+
Tokens
diff --git a/src/components/Tokens/TokenDetails/StatsSection.tsx b/src/components/Tokens/TokenDetails/StatsSection.tsx
index ee78e8e03b..57a406b33d 100644
--- a/src/components/Tokens/TokenDetails/StatsSection.tsx
+++ b/src/components/Tokens/TokenDetails/StatsSection.tsx
@@ -51,24 +51,13 @@ export const StatsWrapper = styled.div`
type NumericStat = number | undefined | null
-function Stat({
- value,
- title,
- description,
- isPrice = false,
-}: {
- value: NumericStat
- title: ReactNode
- description?: ReactNode
- isPrice?: boolean
-}) {
+function Stat({ value, title, description }: { value: NumericStat; title: ReactNode; description?: ReactNode }) {
return (
{title}
{description && }
-
{formatNumber(value, NumberType.FiatTokenStats)}
)
@@ -106,8 +95,8 @@ export default function StatsSection(props: StatsSectionProps) {
/>
- 52W low} isPrice={true} />
- 52W high} isPrice={true} />
+ 52W low} />
+ 52W high} />
diff --git a/src/components/WalletDropdown/AuthenticatedHeader.tsx b/src/components/WalletDropdown/AuthenticatedHeader.tsx
index 86ebd5ba05..389b06f842 100644
--- a/src/components/WalletDropdown/AuthenticatedHeader.tsx
+++ b/src/components/WalletDropdown/AuthenticatedHeader.tsx
@@ -192,7 +192,7 @@ const AuthenticatedHeader = () => {
explorer,
} = getChainInfoOrDefault(chainId ? chainId : SupportedChainId.MAINNET)
const navigate = useNavigate()
- const closeModal = useCloseModal(ApplicationModal.WALLET_DROPDOWN)
+ const closeModal = useCloseModal()
const setSellPageState = useProfilePageState((state) => state.setProfilePageState)
const resetSellAssets = useSellAsset((state) => state.reset)
const clearCollectionFilters = useWalletCollections((state) => state.clearCollectionFilters)
diff --git a/src/components/WalletModal/index.test.tsx b/src/components/WalletModal/index.test.tsx
index 1d75178408..5ae19bf9c5 100644
--- a/src/components/WalletModal/index.test.tsx
+++ b/src/components/WalletModal/index.test.tsx
@@ -1,6 +1,4 @@
-import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
import * as connectionUtils from 'connection/utils'
-import { ApplicationModal } from 'state/application/reducer'
import { nativeOnChain } from '../../constants/tokens'
import { render, screen } from '../../test-utils'
@@ -20,7 +18,7 @@ jest.mock('utils/userAgent', () => ({
jest.mock('.../../state/application/hooks', () => {
return {
- useModalIsOpen: (_modal: ApplicationModal) => true,
+ useModalIsOpen: () => true,
useToggleWalletModal: () => {
return
},
@@ -29,7 +27,7 @@ jest.mock('.../../state/application/hooks', () => {
jest.mock('hooks/useStablecoinPrice', () => {
return {
- useStablecoinValue: (_currencyAmount: CurrencyAmount | undefined | null) => {
+ useStablecoinValue: () => {
return
},
}
@@ -38,10 +36,10 @@ jest.mock('hooks/useStablecoinPrice', () => {
jest.mock('lib/hooks/useCurrencyBalance', () => {
return {
__esModule: true,
- default: (account?: string, currency?: Currency) => {
+ default: () => {
return
},
- useTokenBalance: (account?: string, token?: Token) => {
+ useTokenBalance: () => {
return
},
}
diff --git a/src/components/Web3Status/index.tsx b/src/components/Web3Status/index.tsx
index f2e2429b8b..22fbf126c2 100644
--- a/src/components/Web3Status/index.tsx
+++ b/src/components/Web3Status/index.tsx
@@ -300,7 +300,7 @@ export default function Web3Status() {
const allTransactions = useAllTransactions()
const ref = useRef(null)
const walletRef = useRef(null)
- const closeModal = useCloseModal(ApplicationModal.WALLET_DROPDOWN)
+ const closeModal = useCloseModal()
const isOpen = useModalIsOpen(ApplicationModal.WALLET_DROPDOWN)
useOnClickOutside(ref, isOpen ? closeModal : undefined, [walletRef])
diff --git a/src/constants/chains.test.ts b/src/constants/chains.test.ts
index 6b6f32d5f1..6880411754 100644
--- a/src/constants/chains.test.ts
+++ b/src/constants/chains.test.ts
@@ -3,9 +3,11 @@ import { ALL_SUPPORTED_CHAIN_IDS, SupportedChainId } from './chains'
describe('chains', () => {
describe('ALL_SUPPORTED_CHAIN_IDS', () => {
it('contains all the values in the SupportedChainId enum', () => {
- Object.values(SupportedChainId).forEach((chainId) => {
- if (typeof chainId === 'number') expect(ALL_SUPPORTED_CHAIN_IDS.includes(chainId as number)).toBeTruthy()
- })
+ Object.values(SupportedChainId)
+ .filter((chainId) => typeof chainId === 'number')
+ .forEach((chainId) => {
+ expect(ALL_SUPPORTED_CHAIN_IDS.includes(chainId as number)).toBeTruthy()
+ })
})
it('contains no duplicates', () => {
diff --git a/src/hooks/useAutoSlippageTolerance.ts b/src/hooks/useAutoSlippageTolerance.ts
index 612a56bc1d..f7865fc739 100644
--- a/src/hooks/useAutoSlippageTolerance.ts
+++ b/src/hooks/useAutoSlippageTolerance.ts
@@ -36,7 +36,7 @@ const V2_SWAP_HOP_GAS_ESTIMATE = 50_000
* https://github.com/Uniswap/smart-order-router/blob/main/src/routers/alpha-router/gas-models/v2/v2-heuristic-gas-model.ts
*/
function guesstimateGas(trade: Trade | undefined): number | undefined {
- if (!!trade) {
+ if (trade) {
let gas = 0
for (const { route } of trade.swaps) {
if (route.protocol === Protocol.V2) {
diff --git a/src/hooks/useColor.ts b/src/hooks/useColor.ts
index 229732248d..160fbb6267 100644
--- a/src/hooks/useColor.ts
+++ b/src/hooks/useColor.ts
@@ -1,3 +1,4 @@
+import * as Sentry from '@sentry/react'
import { Token } from '@uniswap/sdk-core'
import { SupportedChainId } from 'constants/chains'
import uriToHttp from 'lib/utils/uriToHttp'
@@ -37,7 +38,9 @@ async function getColorFromToken(token: Token): Promise {
try {
logoURI = URIForEthToken(address)
return await getColorFromUriPath(logoURI)
- } catch (e) {}
+ } catch (error) {
+ Sentry.captureMessage(error.toString())
+ }
}
return null
diff --git a/src/hooks/useIsWindowVisible.ts b/src/hooks/useIsWindowVisible.ts
index b1c08ccc48..b5c3d98ec4 100644
--- a/src/hooks/useIsWindowVisible.ts
+++ b/src/hooks/useIsWindowVisible.ts
@@ -19,7 +19,7 @@ export default function useIsWindowVisible(): boolean {
useEffect(() => {
if (!isVisibilityStateSupported()) return undefined
- setFocused((focused) => isWindowVisible())
+ setFocused(() => isWindowVisible())
document.addEventListener('visibilitychange', listener)
return () => {
diff --git a/src/hooks/useSyncChainQuery.ts b/src/hooks/useSyncChainQuery.ts
index d08b510dce..9eae861766 100644
--- a/src/hooks/useSyncChainQuery.ts
+++ b/src/hooks/useSyncChainQuery.ts
@@ -9,7 +9,7 @@ import usePrevious from './usePrevious'
import useSelectChain from './useSelectChain'
function getChainIdFromName(name: string) {
- const entry = Object.entries(CHAIN_IDS_TO_NAMES).find(([_, n]) => n === name)
+ const entry = Object.entries(CHAIN_IDS_TO_NAMES).find(([, n]) => n === name)
const chainId = entry?.[0]
return chainId ? parseInt(chainId) : undefined
}
diff --git a/src/index.tsx b/src/index.tsx
index d4b1997780..e0772920e8 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -29,7 +29,7 @@ import UserUpdater from './state/user/updater'
import ThemeProvider, { ThemedGlobalStyle } from './theme'
import RadialGradientByChainUpdater from './theme/components/RadialGradientByChainUpdater'
-if (!!window.ethereum) {
+if (window.ethereum) {
window.ethereum.autoRefreshOnNetworkChange = false
}
diff --git a/src/lib/hooks/useInterval.test.tsx b/src/lib/hooks/useInterval.test.tsx
index 8fa1b7fe4b..e7c99a7f8d 100644
--- a/src/lib/hooks/useInterval.test.tsx
+++ b/src/lib/hooks/useInterval.test.tsx
@@ -11,30 +11,30 @@ describe('useInterval', () => {
})
describe('with a synchronous function', () => {
- it('it runs on an interval', () => {
+ it('runs on an interval', () => {
jest.useFakeTimers()
renderHook(() => useInterval(spy, 100))
expect(spy).toHaveBeenCalledTimes(1)
- jest.runTimersToTime(100)
+ jest.advanceTimersByTime(100)
expect(spy).toHaveBeenCalledTimes(2)
})
})
describe('with an async funtion', () => {
- it('it runs on an interval exclusive of fn resolving', async () => {
+ it('runs on an interval exclusive of fn resolving', async () => {
jest.useFakeTimers()
spy.mockImplementation(() => Promise.resolve(undefined))
renderHook(() => useInterval(spy, 100))
expect(spy).toHaveBeenCalledTimes(1)
- jest.runTimersToTime(100)
+ jest.advanceTimersByTime(100)
expect(spy).toHaveBeenCalledTimes(1)
await spy.mock.results[0].value
- jest.runTimersToTime(100)
+ jest.advanceTimersByTime(100)
expect(spy).toHaveBeenCalledTimes(2)
})
})
diff --git a/src/lib/hooks/useTokenList/fetchTokenList.test.ts b/src/lib/hooks/useTokenList/fetchTokenList.test.ts
index ed15beda21..d6c6268141 100644
--- a/src/lib/hooks/useTokenList/fetchTokenList.test.ts
+++ b/src/lib/hooks/useTokenList/fetchTokenList.test.ts
@@ -5,7 +5,7 @@ describe.skip('fetchTokenList', () => {
it('throws on an invalid list url', async () => {
const url = 'https://example.com'
- await expect(fetchTokenList(url, resolver)).rejects.toThrowError(`failed to fetch list: ${url}`)
+ await expect(fetchTokenList(url, resolver)).rejects.toThrow(`failed to fetch list: ${url}`)
expect(resolver).not.toHaveBeenCalled()
})
diff --git a/src/lib/i18n.tsx b/src/lib/i18n.tsx
index 6d0b509830..0c701d663d 100644
--- a/src/lib/i18n.tsx
+++ b/src/lib/i18n.tsx
@@ -1,5 +1,6 @@
import { i18n } from '@lingui/core'
import { I18nProvider } from '@lingui/react'
+import * as Sentry from '@sentry/react'
import { DEFAULT_LOCALE, SupportedLocale } from 'constants/locales'
import {
af,
@@ -82,7 +83,9 @@ export async function dynamicActivate(locale: SupportedLocale) {
const catalog = await import(`locales/${locale}.js`)
// Bundlers will either export it as default or as a named export named default.
i18n.load(locale, catalog.messages || catalog.default.messages)
- } catch {}
+ } catch (error) {
+ Sentry.captureMessage(error.toString())
+ }
i18n.activate(locale)
}
diff --git a/src/lib/utils/formatLocaleNumber.test.ts b/src/lib/utils/formatLocaleNumber.test.ts
index 8e73cc9c73..01563c99fd 100644
--- a/src/lib/utils/formatLocaleNumber.test.ts
+++ b/src/lib/utils/formatLocaleNumber.test.ts
@@ -15,6 +15,7 @@ function expectedOutput(l: SupportedLocale): string {
case 'zh-TW':
return `4,000,000.123`
case 'fr-FR':
+ // eslint-disable-next-line no-irregular-whitespace
return `4 000 000,123`
case 'ar-SA':
return `٤٬٠٠٠٬٠٠٠٫١٢٣`
@@ -28,6 +29,7 @@ function expectedOutput(l: SupportedLocale): string {
case 'ru-RU':
case 'sv-SE':
case 'uk-UA':
+ // eslint-disable-next-line no-irregular-whitespace
return `4 000 000,123`
case 'ca-ES':
case 'da-DK':
diff --git a/src/lib/utils/uriToHttp.ts b/src/lib/utils/uriToHttp.ts
index c6db147a0e..c8d5f40664 100644
--- a/src/lib/utils/uriToHttp.ts
+++ b/src/lib/utils/uriToHttp.ts
@@ -11,15 +11,18 @@ export default function uriToHttp(uri: string): string[] {
return [uri]
case 'http':
return ['https' + uri.substr(4), uri]
- case 'ipfs':
+ case 'ipfs': {
const hash = uri.match(/^ipfs:(\/\/)?(.*)$/i)?.[2]
return [`https://cloudflare-ipfs.com/ipfs/${hash}/`, `https://ipfs.io/ipfs/${hash}/`]
- case 'ipns':
+ }
+ case 'ipns': {
const name = uri.match(/^ipns:(\/\/)?(.*)$/i)?.[2]
return [`https://cloudflare-ipfs.com/ipns/${name}/`, `https://ipfs.io/ipns/${name}/`]
- case 'ar':
+ }
+ case 'ar': {
const tx = uri.match(/^ar:(\/\/)?(.*)$/i)?.[2]
return [`https://arweave.net/${tx}`]
+ }
default:
return []
}
diff --git a/src/nft/components/bag/profile/ListingButton.tsx b/src/nft/components/bag/profile/ListingButton.tsx
index 4c01566b6a..053fec8fe6 100644
--- a/src/nft/components/bag/profile/ListingButton.tsx
+++ b/src/nft/components/bag/profile/ListingButton.tsx
@@ -186,7 +186,7 @@ export const ListingButton = ({ onClick, buttonText, showWarningOverride = false
{warningMessage}
- {!!disableListButton ? (
+ {disableListButton ? (
diff --git a/src/nft/components/collection/ActivityCells.tsx b/src/nft/components/collection/ActivityCells.tsx
index 811586925b..d864c99199 100644
--- a/src/nft/components/collection/ActivityCells.tsx
+++ b/src/nft/components/collection/ActivityCells.tsx
@@ -316,7 +316,7 @@ interface RankingProps {
details?: boolean
}
-const Ranking = ({ details, rarity, collectionName, rarityVerified }: RankingProps) => {
+const Ranking = ({ rarity, collectionName, rarityVerified }: RankingProps) => {
const rarityProviderLogo = getRarityProviderLogo(rarity.source)
return (
diff --git a/src/nft/components/collection/Card.tsx b/src/nft/components/collection/Card.tsx
index d1f12ff990..0f6d89b695 100644
--- a/src/nft/components/collection/Card.tsx
+++ b/src/nft/components/collection/Card.tsx
@@ -577,7 +577,7 @@ interface ProfileNftDetailsProps {
const ProfileNftDetails = ({ asset, hideDetails }: ProfileNftDetailsProps) => {
const assetName = () => {
if (!asset.name && !asset.tokenId) return
- return !!asset.name ? asset.name : `#${asset.tokenId}`
+ return asset.name ? asset.name : `#${asset.tokenId}`
}
const shouldShowUserListedPrice = !asset.notForSale && asset.asset_contract.tokenType !== NftStandard.Erc1155
diff --git a/src/nft/components/collection/CollectionStats.tsx b/src/nft/components/collection/CollectionStats.tsx
index 9c59c9a57f..4742436857 100644
--- a/src/nft/components/collection/CollectionStats.tsx
+++ b/src/nft/components/collection/CollectionStats.tsx
@@ -387,12 +387,11 @@ const StatsRow = ({ stats, isMobile, ...props }: { stats: GenieCollection; isMob
{totalSupplyStr}
) : null}
- {Boolean(uniqueOwnersPercentage && stats.standard !== TokenType.ERC1155) ? (
+ {uniqueOwnersPercentage && stats.standard !== TokenType.ERC1155 ? (
{uniqueOwnersPercentage}%
) : null}
-
{stats.stats?.total_listings && stats.standard !== TokenType.ERC1155 ? (
{listedPercentageStr}%
diff --git a/src/nft/components/details/AssetDetails.tsx b/src/nft/components/details/AssetDetails.tsx
index 0c055e9e9f..1b3a63b87d 100644
--- a/src/nft/components/details/AssetDetails.tsx
+++ b/src/nft/components/details/AssetDetails.tsx
@@ -263,7 +263,7 @@ export const AssetDetails = ({ asset, collection }: AssetDetailsProps) => {
return MediaType.Audio
} else if (isVideo(asset.animationUrl ?? '')) {
return MediaType.Video
- } else if (!!asset.animationUrl) {
+ } else if (asset.animationUrl) {
return MediaType.Embed
}
return MediaType.Image
diff --git a/src/nft/components/icons.tsx b/src/nft/components/icons.tsx
index 41d125e339..c67ac95870 100644
--- a/src/nft/components/icons.tsx
+++ b/src/nft/components/icons.tsx
@@ -3,7 +3,8 @@ import styled, { useTheme } from 'styled-components/macro'
import { themeVars, vars } from '../css/sprinkles.css'
-type SVGProps = React.SVGProps
+// ESLint reports `fill` is missing, whereas it exists on an SVGProps type
+type SVGProps = React.SVGProps & { fill?: string }
export const UniIcon = (props: SVGProps) => (
)
-export const ActivityExternalLinkIcon = (_props: SVGProps) => (
+export const ActivityExternalLinkIcon = () => (