diff --git a/.eslintrc.json b/.eslintrc.json
index a186512b02..149db07813 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,8 +1,48 @@
{
- "plugins": ["import"],
- "extends": ["react-app", "react-app/jest", "prettier"],
+ "env": {
+ "browser": true,
+ "es2021": true
+ },
+ "settings": {
+ "react": {
+ "version": "detect"
+ }
+ },
+ "extends": [
+ "eslint:recommended",
+ "plugin:react/recommended",
+ "plugin:@typescript-eslint/recommended",
+ "prettier"
+ ],
"parser": "@typescript-eslint/parser",
+ "parserOptions": {
+ "ecmaFeatures": {
+ "jsx": true
+ },
+ "ecmaVersion": "latest",
+ "sourceType": "module"
+ },
+ "plugins": ["react", "@typescript-eslint", "import", "react-hooks"],
+ "overrides": [
+ {
+ "files": ["config-overrides.js"],
+ "env": {
+ "node": true,
+ "commonjs": true
+ }
+ }
+ ],
"rules": {
+ "@typescript-eslint/no-var-requires": "off",
+ "@typescript-eslint/ban-types": "off",
+ "react/no-children-prop": "off",
+ "react/no-unescaped-entities": "off",
+ "@typescript-eslint/no-inferrable-types": "off",
+ "react/prop-types": "off",
+ "prefer-const": "off",
+ "jsx-a11y/img-redundant-alt": "off",
+ "react/react-in-jsx-scope": "off",
+ "@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "error",
"react-hooks/exhaustive-deps": "error",
"@typescript-eslint/no-redeclare": "error",
diff --git a/package.json b/package.json
index e9a11dccd0..9fc7dbf5db 100644
--- a/package.json
+++ b/package.json
@@ -49,7 +49,7 @@
"jest": "26.6.0",
"**/@typescript-eslint/eslint-plugin": "^4.1.1",
"**/@typescript-eslint/parser": "^4.1.1",
- "eslint-plugin-react-hooks": "4.2.0"
+ "eslint-plugin-react-hooks": "4.2.1"
},
"scripts": {
"compile-styles": "lessc ./node_modules/antd/dist/antd.less ./src/styles/antd.css --js",
@@ -93,11 +93,14 @@
"@types/react": "^17",
"@types/react-dom": "^17",
"@types/react-router-dom": "^5.1.7",
+ "@typescript-eslint/eslint-plugin": "^5.21.0",
+ "@typescript-eslint/parser": "^5.21.0",
"browserify-fs": "^1.0.0",
"browserify-zlib": "^0.2.0",
"crypto-browserify": "^3.12.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-import": "^2.25.3",
+ "eslint-plugin-react": "^7.29.4",
"https-browserify": "^1.0.0",
"husky": "^7.0.0",
"less": "^4.1.1",
diff --git a/src/components/Landing/QAs.tsx b/src/components/Landing/QAs.tsx
index d8103ff568..4567cc3ee6 100644
--- a/src/components/Landing/QAs.tsx
+++ b/src/components/Landing/QAs.tsx
@@ -1,3 +1,4 @@
+/* eslint-disable react/jsx-key */
import { t, Trans } from '@lingui/macro'
import ExternalLink from 'components/shared/ExternalLink'
import { PropsWithChildren } from 'react'
diff --git a/src/components/Navbar/ThemePicker.tsx b/src/components/Navbar/ThemePicker.tsx
index dca1ae282e..096e1c62a7 100644
--- a/src/components/Navbar/ThemePicker.tsx
+++ b/src/components/Navbar/ThemePicker.tsx
@@ -6,7 +6,7 @@ import React, { CSSProperties, useContext } from 'react'
import { ThemeOption } from 'constants/theme/theme-option'
-export default function ThemePicker({ mobile }: { mobile?: boolean }) {
+export default function ThemePicker() {
const {
themeOption,
setThemeOption,
diff --git a/src/components/Projects/HoldingsProjects.tsx b/src/components/Projects/HoldingsProjects.tsx
index 06d699fd74..237a931c1d 100644
--- a/src/components/Projects/HoldingsProjects.tsx
+++ b/src/components/Projects/HoldingsProjects.tsx
@@ -22,8 +22,8 @@ export default function HoldingsProjects() {
{projects && projects.length > 0 && (
- {projects.map(p => (
-
+ {projects.map((p, i) => (
+
))}
diff --git a/src/components/shared/ManageTokensModal.tsx b/src/components/shared/ManageTokensModal.tsx
index f1f5704299..69902ccd61 100644
--- a/src/components/shared/ManageTokensModal.tsx
+++ b/src/components/shared/ManageTokensModal.tsx
@@ -82,7 +82,7 @@ export default function ManageTokensModal({
plural: true,
})
- const redeemDisabled = !Boolean(hasOverflow)
+ const redeemDisabled = !hasOverflow
const hasIssuedTokens = tokenAddress && tokenAddress !== constants.AddressZero
return (
diff --git a/src/components/shared/ProjectRiskNotice.tsx b/src/components/shared/ProjectRiskNotice.tsx
index dfa1a2b83f..146dbedbbb 100644
--- a/src/components/shared/ProjectRiskNotice.tsx
+++ b/src/components/shared/ProjectRiskNotice.tsx
@@ -38,8 +38,8 @@ export default function ProjectRiskNotice({
- {warnings.map(text => (
- - {text}
+ {warnings.map((text, i) => (
+ - {text}
))}
diff --git a/src/components/shared/TransactionModal.tsx b/src/components/shared/TransactionModal.tsx
index 08be212a14..132232322a 100644
--- a/src/components/shared/TransactionModal.tsx
+++ b/src/components/shared/TransactionModal.tsx
@@ -59,9 +59,6 @@ export default function TransactionModal(props: TransactionModalProps) {
},
}
- if (props.transactionPending) {
- }
-
return (
{props.transactionPending ? (
diff --git a/src/components/shared/formItems/ProjectReserved.tsx b/src/components/shared/formItems/ProjectReserved.tsx
index 7f13ea39b7..3ff61b302d 100644
--- a/src/components/shared/formItems/ProjectReserved.tsx
+++ b/src/components/shared/formItems/ProjectReserved.tsx
@@ -40,8 +40,6 @@ export default function ProjectReserved({
theme: { colors },
} = useContext(ThemeContext)
- const shouldRenderToggle = Boolean(onToggled)
-
const [showRiskWarning, setShowRiskWarning] = useState(
(value ?? 0) > RESERVED_RATE_WARNING_THRESHOLD_PERCENT,
)
@@ -94,10 +92,10 @@ export default function ProjectReserved({
label={
hideLabel ? undefined : (
<>
- {shouldRenderToggle ? (
+ {onToggled ? (
Reserved rate
- {!Boolean(checked) && (
+ {checked && (
{refs.map((r, i) => (
-
+
diff --git a/src/components/shared/inputs/ImageUploader.tsx b/src/components/shared/inputs/ImageUploader.tsx
index 4aae377297..3386c1566f 100644
--- a/src/components/shared/inputs/ImageUploader.tsx
+++ b/src/components/shared/inputs/ImageUploader.tsx
@@ -44,7 +44,6 @@ export default function ImageUploader({
{url && (
- // eslint-disable-next-line jsx-a11y/img-redundant-alt
)}
diff --git a/src/components/shared/modals/IssueTokenModal.tsx b/src/components/shared/modals/IssueTokenModal.tsx
index 695e04430d..0c7b0ed158 100644
--- a/src/components/shared/modals/IssueTokenModal.tsx
+++ b/src/components/shared/modals/IssueTokenModal.tsx
@@ -59,7 +59,7 @@ export default function IssueTokenModal({
transactionPending={transactionPending}
>
- {!Boolean(isNewDeploy) ? (
+ {!isNewDeploy ? (
Issue an ERC-20 to be used as this project's token. Once issued,
anyone can claim their existing token balance in the new token.
diff --git a/src/components/v2/V2Create/forms/FundingForm/index.tsx b/src/components/v2/V2Create/forms/FundingForm/index.tsx
index c07322e29c..151def6463 100644
--- a/src/components/v2/V2Create/forms/FundingForm/index.tsx
+++ b/src/components/v2/V2Create/forms/FundingForm/index.tsx
@@ -450,7 +450,6 @@ export default function FundingForm({
targetSubFee={undefined}
currency={V2CurrencyName(targetCurrency) ?? 'ETH'}
onTargetChange={setTarget}
- onTargetSubFeeChange={() => {}}
onCurrencyChange={currencyName =>
setTargetCurrency(getV2CurrencyOption(currencyName))
}
@@ -515,8 +514,8 @@ export default function FundingForm({
},
]}
>
- {/* Added a hidden input here because Form.Item needs
- a child Input to work. Need the parent Form.Item to
+ {/* Added a hidden input here because Form.Item needs
+ a child Input to work. Need the parent Form.Item to
validate totalSplitsPercentage */}
diff --git a/src/components/v2/V2Project/V2FundingCycleSection/FundingCycleHistory.tsx b/src/components/v2/V2Project/V2FundingCycleSection/FundingCycleHistory.tsx
index 2ac4a47470..9ef8f40c9f 100644
--- a/src/components/v2/V2Project/V2FundingCycleSection/FundingCycleHistory.tsx
+++ b/src/components/v2/V2Project/V2FundingCycleSection/FundingCycleHistory.tsx
@@ -293,6 +293,7 @@ export default function FundingCycleHistory() {
{pastFundingCycles.length ? (
pastFundingCycles.map((fundingCycle: V2FundingCycle, i) => (
({
themeOption: defaultThemeOption,
theme: juiceTheme(defaultThemeOption),
- setThemeOption: (themeOption: ThemeOption) => {},
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
+ setThemeOption: function (themeOption: ThemeOption) {},
isDarkMode: defaultThemeOption === ThemeOption.dark,
})
diff --git a/src/declarations.d.ts b/src/declarations.d.ts
index 8bc1ff7534..495ee3f7ef 100644
--- a/src/declarations.d.ts
+++ b/src/declarations.d.ts
@@ -1,2 +1,2 @@
-declare var Desmos
+declare let Desmos
declare module 'ethereum-block-by-date'
diff --git a/src/hooks/ERC20SushiswapPrice.ts b/src/hooks/ERC20SushiswapPrice.ts
index ebd4f7082b..0041ce3eab 100644
--- a/src/hooks/ERC20SushiswapPrice.ts
+++ b/src/hooks/ERC20SushiswapPrice.ts
@@ -1,7 +1,7 @@
import { Token, WETH9, Route, Pair, CurrencyAmount } from '@sushiswap/sdk'
import { Contract } from '@ethersproject/contracts'
-import { abi as IUniswapV2PairABI } from '@uniswap/v2-core/build/IUniswapV2Pair.json'
+import IUniswapV2PairABI from '@uniswap/v2-core/build/IUniswapV2Pair.json'
import { useQuery } from 'react-query'
@@ -22,7 +22,7 @@ async function fetchPairData(tokenA: Token, tokenB: Token): Promise {
const [reserves0, reserves1] = await new Contract(
pairAddress,
- IUniswapV2PairABI,
+ IUniswapV2PairABI.abi,
readProvider,
).getReserves()
diff --git a/src/hooks/ERC20UniswapPrice.ts b/src/hooks/ERC20UniswapPrice.ts
index bc71984d57..99ebd32c64 100644
--- a/src/hooks/ERC20UniswapPrice.ts
+++ b/src/hooks/ERC20UniswapPrice.ts
@@ -3,8 +3,8 @@ import { Token } from '@uniswap/sdk-core'
import { useQuery } from 'react-query'
import { BigNumber } from '@ethersproject/bignumber'
import { Contract } from '@ethersproject/contracts'
-import { abi as IUniswapV3PoolABI } from '@uniswap/v3-core/artifacts/contracts/interfaces/IUniswapV3Pool.sol/IUniswapV3Pool.json'
-import { abi as IUniswapV3FactoryABI } from '@uniswap/v3-core/artifacts/contracts/interfaces/IUniswapV3Factory.sol/IUniswapV3Factory.json'
+import IUniswapV3PoolABI from '@uniswap/v3-core/artifacts/contracts/interfaces/IUniswapV3Pool.sol/IUniswapV3Pool.json'
+import IUniswapV3FactoryABI from '@uniswap/v3-core/artifacts/contracts/interfaces/IUniswapV3Factory.sol/IUniswapV3Factory.json'
import { FACTORY_ADDRESS as UNISWAP_V3_FACTORY_ADDRESS } from '@uniswap/v3-sdk'
import * as ethersConstants from '@ethersproject/constants'
@@ -52,7 +52,7 @@ const networkId = readNetwork.chainId
export function useUniswapPriceQuery({ tokenSymbol, tokenAddress }: Props) {
const factoryContract = new Contract(
UNISWAP_V3_FACTORY_ADDRESS,
- IUniswapV3FactoryABI,
+ IUniswapV3FactoryABI.abi,
readProvider,
)
@@ -133,7 +133,7 @@ export function useUniswapPriceQuery({ tokenSymbol, tokenAddress }: Props) {
const poolContract = new Contract(
poolAddress,
- IUniswapV3PoolABI,
+ IUniswapV3PoolABI.abi,
readProvider,
)
diff --git a/src/hooks/Poller.ts b/src/hooks/Poller.ts
index b080e8d060..d425b8892e 100644
--- a/src/hooks/Poller.ts
+++ b/src/hooks/Poller.ts
@@ -9,7 +9,7 @@ export function usePoller(
// run at start too
useEffect(
- function() {
+ function () {
fn()
},
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -18,7 +18,7 @@ export function usePoller(
// Remember the latest fn.
useEffect(
- function() {
+ function () {
savedCallback.current = fn
},
[fn],
@@ -26,13 +26,13 @@ export function usePoller(
// Set up the interval.
useEffect(
- function() {
+ function () {
function tick() {
if (savedCallback.current) savedCallback.current()
}
- var id_1 = setInterval(tick, delay)
- return function() {
+ let id_1 = setInterval(tick, delay)
+ return function () {
return clearInterval(id_1)
}
},
diff --git a/src/hooks/ProjectMetadata.ts b/src/hooks/ProjectMetadata.ts
index 9cd327afee..c9bc69dc54 100644
--- a/src/hooks/ProjectMetadata.ts
+++ b/src/hooks/ProjectMetadata.ts
@@ -10,7 +10,7 @@ export function useProjectMetadata(uri: string | undefined) {
if (!uri) {
throw new Error('Project URI not specified.')
}
- const url = ipfsCidUrl(uri!)
+ const url = ipfsCidUrl(uri)
const response = await axios.get(url)
return consolidateMetadata(response.data)
},
diff --git a/src/hooks/v1/contractReader/ContractReader.ts b/src/hooks/v1/contractReader/ContractReader.ts
index d7ac4e1d0b..18af7fb320 100644
--- a/src/hooks/v1/contractReader/ContractReader.ts
+++ b/src/hooks/v1/contractReader/ContractReader.ts
@@ -96,7 +96,7 @@ export default function useContractReader({
getValue()
- const listener = (x: any) => getValue() // eslint-disable-line @typescript-eslint/no-explicit-any
+ const listener = () => getValue()
let subscriptions: {
contract: Contract
diff --git a/src/hooks/v2/contractReader/V2ContractReader.ts b/src/hooks/v2/contractReader/V2ContractReader.ts
index a1357b2df7..c4deeff267 100644
--- a/src/hooks/v2/contractReader/V2ContractReader.ts
+++ b/src/hooks/v2/contractReader/V2ContractReader.ts
@@ -102,7 +102,7 @@ export default function useV2ContractReader({
getValue()
- const listener = (x: any) => getValue() // eslint-disable-line @typescript-eslint/no-explicit-any
+ const listener = () => getValue()
let subscriptions: {
contract: Contract
diff --git a/src/models/semantic-theme/colors.ts b/src/models/semantic-theme/colors.ts
index 3c817c538a..3aa8f85b18 100644
--- a/src/models/semantic-theme/colors.ts
+++ b/src/models/semantic-theme/colors.ts
@@ -1,5 +1,6 @@
import { Property } from 'csstype'
+// eslint-disable-next-line @typescript-eslint/no-namespace
namespace SemanticColor {
export type Primary = { primary: Property.Color }
export type Secondary = { secondary: Property.Color }
diff --git a/yarn.lock b/yarn.lock
index 13d11da1de..4234b8a248 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4269,6 +4269,21 @@
semver "^7.3.5"
tsutils "^3.21.0"
+"@typescript-eslint/eslint-plugin@^5.21.0":
+ version "5.21.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.21.0.tgz#bfc22e0191e6404ab1192973b3b4ea0461c1e878"
+ integrity sha512-fTU85q8v5ZLpoZEyn/u1S2qrFOhi33Edo2CZ0+q1gDaWWm0JuPh3bgOyU8lM0edIEYgKLDkPFiZX2MOupgjlyg==
+ dependencies:
+ "@typescript-eslint/scope-manager" "5.21.0"
+ "@typescript-eslint/type-utils" "5.21.0"
+ "@typescript-eslint/utils" "5.21.0"
+ debug "^4.3.2"
+ functional-red-black-tree "^1.0.1"
+ ignore "^5.1.8"
+ regexpp "^3.2.0"
+ semver "^7.3.5"
+ tsutils "^3.21.0"
+
"@typescript-eslint/experimental-utils@4.31.2":
version "4.31.2"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.31.2.tgz#98727a9c1e977dd5d20c8705e69cd3c2a86553fa"
@@ -4298,6 +4313,16 @@
"@typescript-eslint/typescript-estree" "4.31.2"
debug "^4.3.1"
+"@typescript-eslint/parser@^5.21.0":
+ version "5.21.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.21.0.tgz#6cb72673dbf3e1905b9c432175a3c86cdaf2071f"
+ integrity sha512-8RUwTO77hstXUr3pZoWZbRQUxXcSXafZ8/5gpnQCfXvgmP9gpNlRGlWzvfbEQ14TLjmtU8eGnONkff8U2ui2Eg==
+ dependencies:
+ "@typescript-eslint/scope-manager" "5.21.0"
+ "@typescript-eslint/types" "5.21.0"
+ "@typescript-eslint/typescript-estree" "5.21.0"
+ debug "^4.3.2"
+
"@typescript-eslint/scope-manager@4.31.2":
version "4.31.2"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.31.2.tgz#1d528cb3ed3bcd88019c20a57c18b897b073923a"
@@ -4314,6 +4339,15 @@
"@typescript-eslint/types" "5.21.0"
"@typescript-eslint/visitor-keys" "5.21.0"
+"@typescript-eslint/type-utils@5.21.0":
+ version "5.21.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.21.0.tgz#ff89668786ad596d904c21b215e5285da1b6262e"
+ integrity sha512-MxmLZj0tkGlkcZCSE17ORaHl8Th3JQwBzyXL/uvC6sNmu128LsgjTX0NIzy+wdH2J7Pd02GN8FaoudJntFvSOw==
+ dependencies:
+ "@typescript-eslint/utils" "5.21.0"
+ debug "^4.3.2"
+ tsutils "^3.21.0"
+
"@typescript-eslint/types@4.31.2":
version "4.31.2"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.31.2.tgz#2aea7177d6d744521a168ed4668eddbd912dfadf"
@@ -8826,12 +8860,12 @@ eslint-plugin-jsx-a11y@^6.5.1:
language-tags "^1.0.5"
minimatch "^3.0.4"
-eslint-plugin-react-hooks@4.2.0, eslint-plugin-react-hooks@^4.3.0:
- version "4.2.0"
- resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.0.tgz#8c229c268d468956334c943bb45fc860280f5556"
- integrity sha512-623WEiZJqxR7VdxFCKLI6d6LLpwJkGPYKODnkH3D7WpOG5KM8yWueBd8TLsNAetEJNF5iJmolaAKO3F8yzyVBQ==
+eslint-plugin-react-hooks@4.2.1, eslint-plugin-react-hooks@^4.3.0:
+ version "4.2.1-rc.3-next-e7d0053e6-20220325"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.1-rc.3-next-e7d0053e6-20220325.tgz#9f5a7608e506153564c8bc6e875d6bf23ec2543d"
+ integrity sha512-fxenGUvnIfrPiCTGNncK1FyOuuPDNTHweHUwU3C6jy+ym39bbyMlO8sdNCtpXkZdsf8/cxYAhEm/H9g0QcElVQ==
-eslint-plugin-react@^7.27.1:
+eslint-plugin-react@^7.27.1, eslint-plugin-react@^7.29.4:
version "7.29.4"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.29.4.tgz#4717de5227f55f3801a5fd51a16a4fa22b5914d2"
integrity sha512-CVCXajliVh509PcZYRFyu/BoUEz452+jtQJq2b3Bae4v3xBUWPLCmtmBM+ZinG4MzwmxJgJ2M5rMqhqLVn7MtQ==
@@ -11141,7 +11175,7 @@ ignore@^5.1.4:
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
-ignore@^5.2.0:
+ignore@^5.1.8, ignore@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a"
integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==