FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore: restrict imports from dist (#2443) · sameepsi/interface@ea17c7c · GitHub

Repository navigation

Commit ea17c7c

Browse files
authored
chore: restrict imports from dist (Uniswap#2443)
* fix: consistent @uniswap/v3-sdk imports * fix: consistent @redux/toolkit imports * fix: consistent @web-react imports * fix: consistent @uniswap/token-lists imports * chore: restrict dist/ imports
1 parent 52630aa commit ea17c7c

9 files changed

Lines changed: 22 additions & 17 deletions

File tree

‎.eslintrc.json‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,26 @@
3939
"paths": [
4040
{
4141
"name": "lodash",
42-
"message": "Please import lodash modules directly (lodash/module)."
42+
"message": "Please import from 'lodash/module' directly to support tree-shaking."
43+
},
44+
{
45+
"name": "ethers",
46+
"message": "Please import from '@ethersproject/module' directly to support tree-shaking."
4347
},
4448
{
4549
"name": "styled-components",
4650
"message": "Please import from styled-components/macro."
51+
}
52+
],
53+
"patterns": [
54+
{
55+
"group": ["**/dist"],
56+
"message": "Do not import from dist/ - this is an implementation detail, and breaks tree-shaking."
4757
},
4858
{
49-
"name": "ethers",
50-
"message": "Please import from @ethersproject."
59+
"group": ["!styled-components/macro"]
5160
}
52-
],
53-
"patterns": ["!styled-components/macro"]
61+
]
5462
}
5563
]
5664
}

‎src/components/SearchModal/ImportToken.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Plural, Trans } from '@lingui/macro'
22
import { Currency, Token } from '@uniswap/sdk-core'
3-
import { TokenList } from '@uniswap/token-lists/dist/types'
3+
import { TokenList } from '@uniswap/token-lists'
44
import { ButtonPrimary } from 'components/Button'
55
import Card from 'components/Card'
66
import { AutoColumn } from 'components/Column'

‎src/hooks/web3.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { Web3Provider } from '@ethersproject/providers'
22
import { useWeb3React } from '@web3-react/core'
3-
import { Web3ReactContextInterface } from '@web3-react/core/dist/types'
43
import { useEffect, useState } from 'react'
54

65
import { gnosisSafe, injected } from '../connectors'
76
import { IS_IN_IFRAME, NetworkContextName } from '../constants/misc'
87
import { isMobile } from '../utils/userAgent'
98

10-
export function useActiveWeb3React(): Web3ReactContextInterface<Web3Provider> {
9+
export function useActiveWeb3React() {
1110
const context = useWeb3React<Web3Provider>()
1211
const contextNetwork = useWeb3React<Web3Provider>(NetworkContextName)
1312
return context.active ? context : contextNetwork

‎src/state/data/slice.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BaseQueryApi, BaseQueryFn } from '@reduxjs/toolkit/dist/query/baseQueryTypes'
1+
import { BaseQueryFn } from '@reduxjs/toolkit/query'
22
import { createApi } from '@reduxjs/toolkit/query/react'
33
import { SupportedChainId } from 'constants/chains'
44
import { DocumentNode } from 'graphql'
@@ -82,7 +82,7 @@ function graphqlRequestBaseQuery(): BaseQueryFn<
8282
Pick<ClientError, 'name' | 'message' | 'stack'>,
8383
Partial<Pick<ClientError, 'request' | 'response'>>
8484
> {
85-
return async ({ document, variables }, { getState }: BaseQueryApi) => {
85+
return async ({ document, variables }, { getState }) => {
8686
try {
8787
const chainId = (getState() as AppState).application.chainId
8888

‎src/state/lists/reducer.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { createReducer } from '@reduxjs/toolkit'
2-
import { getVersionUpgrade, VersionUpgrade } from '@uniswap/token-lists'
3-
import { TokenList } from '@uniswap/token-lists/dist/types'
2+
import { getVersionUpgrade, TokenList, VersionUpgrade } from '@uniswap/token-lists'
43

54
import { DEFAULT_ACTIVE_LIST_URLS } from '../../constants/lists'
65
import { DEFAULT_LIST_OF_LISTS } from '../../constants/lists'

‎src/state/lists/wrappedTokenInfo.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Currency, Token } from '@uniswap/sdk-core'
2-
import { Tags, TokenInfo } from '@uniswap/token-lists'
3-
import { TokenList } from '@uniswap/token-lists/dist/types'
2+
import { Tags, TokenInfo, TokenList } from '@uniswap/token-lists'
43

54
import { isAddress } from '../../utils'
65

‎src/state/mint/v3/hooks.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
TICK_SPACINGS,
1111
TickMath,
1212
tickToPrice,
13-
} from '@uniswap/v3-sdk/dist/'
13+
} from '@uniswap/v3-sdk'
1414
import { usePool } from 'hooks/usePools'
1515
import JSBI from 'jsbi'
1616
import { useCallback, useMemo } from 'react'

‎src/state/mint/v3/utils.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
priceToClosestTick,
77
TICK_SPACINGS,
88
TickMath,
9-
} from '@uniswap/v3-sdk/dist/'
9+
} from '@uniswap/v3-sdk'
1010
import JSBI from 'jsbi'
1111

1212
export function tryParsePrice(baseToken?: Token, quoteToken?: Token, value?: string) {

‎src/utils/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { AddressZero } from '@ethersproject/constants'
33
import { Contract } from '@ethersproject/contracts'
44
import { JsonRpcSigner, Web3Provider } from '@ethersproject/providers'
55
import { Token } from '@uniswap/sdk-core'
6-
import { FeeAmount } from '@uniswap/v3-sdk/dist/'
6+
import { FeeAmount } from '@uniswap/v3-sdk'
77

88
import { TokenAddressMap } from '../state/lists/hooks'
99

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL