Skip to content

Commit

Permalink
Fix code style issues with ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
lint-action committed Feb 16, 2021
1 parent 37b0e2f commit 9d9b57d
Show file tree
Hide file tree
Showing 166 changed files with 885 additions and 889 deletions.
22 changes: 6 additions & 16 deletions cypress/integration/swap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,23 @@ describe('Swap', () => {
cy.visit('/swap')
})
it('can enter an amount into input', () => {
cy.get('#swap-currency-input .token-amount-input')
.type('0.001', { delay: 200 })
.should('have.value', '0.001')
cy.get('#swap-currency-input .token-amount-input').type('0.001', { delay: 200 }).should('have.value', '0.001')
})

it('zero swap amount', () => {
cy.get('#swap-currency-input .token-amount-input')
.type('0.0', { delay: 200 })
.should('have.value', '0.0')
cy.get('#swap-currency-input .token-amount-input').type('0.0', { delay: 200 }).should('have.value', '0.0')
})

it('invalid swap amount', () => {
cy.get('#swap-currency-input .token-amount-input')
.type('\\', { delay: 200 })
.should('have.value', '')
cy.get('#swap-currency-input .token-amount-input').type('\\', { delay: 200 }).should('have.value', '')
})

it('can enter an amount into output', () => {
cy.get('#swap-currency-output .token-amount-input')
.type('0.001', { delay: 200 })
.should('have.value', '0.001')
cy.get('#swap-currency-output .token-amount-input').type('0.001', { delay: 200 }).should('have.value', '0.001')
})

it('zero output amount', () => {
cy.get('#swap-currency-output .token-amount-input')
.type('0.0', { delay: 200 })
.should('have.value', '0.0')
cy.get('#swap-currency-output .token-amount-input').type('0.0', { delay: 200 }).should('have.value', '0.0')
})

it('can swap ETH for DAI', () => {
Expand All @@ -49,7 +39,7 @@ describe('Swap', () => {

describe('expert mode', () => {
beforeEach(() => {
cy.window().then(win => {
cy.window().then((win) => {
cy.stub(win, 'prompt').returns('confirm')
})
cy.get('#open-settings-dialog-button').click()
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ Cypress.Commands.overwrite('visit', (original, url, options) => {
const provider = new JsonRpcProvider('https://rinkeby.infura.io/v3/4bf032f2d38a4ed6bb975b80d6340847', 4)
const signer = new Wallet(PRIVATE_KEY_TEST_NEVER_USE, provider)
win.ethereum = new CustomizedBridge(signer, provider)
}
},
})
})
8 changes: 4 additions & 4 deletions src/components/AccountDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const HeaderRow = styled.div`
${({ theme }) => theme.flexRowNoWrap};
padding: 1rem 1rem;
font-weight: 500;
color: ${props => (props.color === 'blue' ? ({ theme }) => theme.primary1 : 'inherit')};
color: ${(props) => (props.color === 'blue' ? ({ theme }) => theme.primary1 : 'inherit')};
${({ theme }) => theme.mediaWidth.upToMedium`
padding: 1rem;
`};
Expand Down Expand Up @@ -223,7 +223,7 @@ export default function AccountDetails({
pendingTransactions,
confirmedTransactions,
ENSName,
openOptions
openOptions,
}: AccountDetailsProps) {
const { chainId, account, connector } = useActiveWeb3React()
const theme = useContext(ThemeContext)
Expand All @@ -234,10 +234,10 @@ export default function AccountDetails({
const isMetaMask = !!(ethereum && ethereum.isMetaMask)
const name = Object.keys(SUPPORTED_WALLETS)
.filter(
k =>
(k) =>
SUPPORTED_WALLETS[k].connector === connector && (connector !== injected || isMetaMask === (k === 'METAMASK'))
)
.map(k => SUPPORTED_WALLETS[k].name)[0]
.map((k) => SUPPORTED_WALLETS[k].name)[0]
return <WalletName>Connected with {name}</WalletName>
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/AddressInputPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const Input = styled.input<{ error?: boolean }>`
export default function AddressInputPanel({
id,
value,
onChange
onChange,
}: {
id?: string
// the typed string value
Expand All @@ -82,7 +82,7 @@ export default function AddressInputPanel({
const { address, loading, name } = useENS(value)

const handleInput = useCallback(
event => {
(event) => {
const input = event.target.value
const withoutSpaces = input.replace(/\s+/g, '')
onChange(withoutSpaces)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Confetti/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function Confetti({ start, variant }: { start: boolean; variant?:
h: height,
w: width,
x: 0,
y: _variant === 'top' ? height * 0.25 : _variant === 'bottom' ? height * 0.75 : height * 0.5
y: _variant === 'top' ? height * 0.25 : _variant === 'bottom' ? height * 0.75 : height * 0.5,
}}
initialVelocityX={15}
initialVelocityY={30}
Expand Down
4 changes: 2 additions & 2 deletions src/components/CurrencyInputPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export default function CurrencyInputPanel({
otherCurrency,
id,
showCommonBases,
customBalanceText
customBalanceText,
}: CurrencyInputPanelProps) {
const { t } = useTranslation()

Expand Down Expand Up @@ -191,7 +191,7 @@ export default function CurrencyInputPanel({
<NumericalInput
className="token-amount-input"
value={value}
onUserInput={val => {
onUserInput={(val) => {
onUserInput(val)
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/CurrencyLogo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const StyledLogo = styled(Logo)<{ size: string }>`
export default function CurrencyLogo({
currency,
size = '24px',
style
style,
}: {
currency?: Currency
size?: string
Expand Down
2 changes: 1 addition & 1 deletion src/components/DoubleLogo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function DoubleCurrencyLogo({
currency0,
currency1,
size = 16,
margin = false
margin = false,
}: DoubleCurrencyLogoProps) {
return (
<Wrapper sizeraw={size} margin={margin}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormattedCurrencyAmount/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const CURRENCY_AMOUNT_MIN = new Fraction(JSBI.BigInt(1), JSBI.BigInt(1000000))

export default function FormattedCurrencyAmount({
currencyAmount,
significantDigits = 4
significantDigits = 4,
}: {
currencyAmount: CurrencyAmount
significantDigits?: number
Expand Down
8 changes: 4 additions & 4 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const UniIcon = styled.div`
const activeClassName = 'ACTIVE'

const StyledNavLink = styled(NavLink).attrs({
activeClassName
activeClassName,
})`
${({ theme }) => theme.flexRowNoWrap}
align-items: left;
Expand All @@ -228,7 +228,7 @@ const StyledNavLink = styled(NavLink).attrs({
`

const StyledExternalLink = styled(ExternalLink).attrs({
activeClassName
activeClassName,
})<{ isActive?: boolean }>`
${({ theme }) => theme.flexRowNoWrap}
align-items: left;
Expand Down Expand Up @@ -291,7 +291,7 @@ const NETWORK_LABELS: { [chainId in ChainId]?: string } = {
[ChainId.RINKEBY]: 'Rinkeby',
[ChainId.ROPSTEN]: 'Ropsten',
[ChainId.GÖRLI]: 'Görli',
[ChainId.KOVAN]: 'Kovan'
[ChainId.KOVAN]: 'Kovan',
}

export default function Header() {
Expand Down Expand Up @@ -380,7 +380,7 @@ export default function Header() {
<HideSmall>
<TYPE.white
style={{
paddingRight: '.4rem'
paddingRight: '.4rem',
}}
>
<CountUp
Expand Down
2 changes: 1 addition & 1 deletion src/components/LineChart/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ export const dummyData = [
{ time: '2019-05-22', value: 43.3 },
{ time: '2019-05-23', value: 42.73 },
{ time: '2019-05-24', value: 42.67 },
{ time: '2019-05-28', value: 42.75 }
{ time: '2019-05-28', value: 42.75 },
]
28 changes: 14 additions & 14 deletions src/components/LineChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,59 +78,59 @@ const LineChart = ({
layout: {
backgroundColor: 'transparent',
textColor: textColor,
fontFamily: 'Inter'
fontFamily: 'Inter',
},
rightPriceScale: {
scaleMargins: {
top: 0.1,
bottom: 0.1
bottom: 0.1,
},
borderVisible: false
borderVisible: false,
},
timeScale: {
borderVisible: false
borderVisible: false,
},
watermark: {
color: 'rgba(0, 0, 0, 0)'
color: 'rgba(0, 0, 0, 0)',
},
grid: {
horzLines: {
visible: false
visible: false,
},
vertLines: {
visible: false
}
visible: false,
},
},
crosshair: {
horzLine: {
visible: true,
style: 3,
width: 1,
color: '#505050',
labelBackgroundColor: color
labelBackgroundColor: color,
},
vertLine: {
visible: true,
style: 3,
width: 1,
color: '#505050',
labelBackgroundColor: color
}
}
labelBackgroundColor: color,
},
},
})

const series = chart.addAreaSeries({
lineColor: color,
topColor: darken(0.4, color),
bottomColor: theme.bg1,
lineWidth: 2,
priceLineVisible: false
priceLineVisible: false,
})

series.setData(data)

// update the title when hovering on the chart
chart.subscribeCrosshairMove(function(param) {
chart.subscribeCrosshairMove(function (param) {
if (
chartRef?.current &&
(param === undefined ||
Expand Down
2 changes: 1 addition & 1 deletion src/components/ListLogo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function ListLogo({
logoURI,
style,
size = '24px',
alt
alt,
}: {
logoURI: string
size?: string
Expand Down
4 changes: 2 additions & 2 deletions src/components/Logo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface LogoProps extends Pick<ImageProps, 'style' | 'alt' | 'className
export default function Logo({ srcs, alt, ...rest }: LogoProps) {
const [, refresh] = useState<number>(0)

const src: string | undefined = srcs.find(src => !BAD_SRCS[src])
const src: string | undefined = srcs.find((src) => !BAD_SRCS[src])

if (src) {
return (
Expand All @@ -24,7 +24,7 @@ export default function Logo({ srcs, alt, ...rest }: LogoProps) {
src={src}
onError={() => {
if (src) BAD_SRCS[src] = true
refresh(i => i + 1)
refresh((i) => i + 1)
}}
/>
)
Expand Down
20 changes: 11 additions & 9 deletions src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const AnimatedDialogContent = animated(DialogContent)
const StyledDialogContent = styled(({ minHeight, maxHeight, mobile, isOpen, ...rest }) => (
<AnimatedDialogContent {...rest} />
)).attrs({
'aria-label': 'dialog'
'aria-label': 'dialog',
})`
overflow-y: ${({ mobile }) => (mobile ? 'scroll' : 'hidden')};
Expand Down Expand Up @@ -63,13 +63,15 @@ const StyledDialogContent = styled(({ minHeight, maxHeight, mobile, isOpen, ...r
`}
${({ theme, mobile }) => theme.mediaWidth.upToSmall`
width: 85vw;
${mobile &&
${
mobile &&
css`
width: 100vw;
border-radius: 20px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
`}
`
}
`}
}
`
Expand All @@ -89,25 +91,25 @@ export default function Modal({
minHeight = false,
maxHeight = 90,
initialFocusRef,
children
children,
}: ModalProps) {
const fadeTransition = useTransition(isOpen, null, {
config: { duration: 200 },
from: { opacity: 0 },
enter: { opacity: 1 },
leave: { opacity: 0 }
leave: { opacity: 0 },
})

const [{ y }, set] = useSpring(() => ({ y: 0, config: { mass: 1, tension: 210, friction: 20 } }))
const bind = useGesture({
onDrag: state => {
onDrag: (state) => {
set({
y: state.down ? state.movement[1] : 0
y: state.down ? state.movement[1] : 0,
})
if (state.movement[1] > 300 || (state.velocity > 3 && state.direction[1] > 0)) {
onDismiss()
}
}
},
})

return (
Expand All @@ -120,7 +122,7 @@ export default function Modal({
{...(isMobile
? {
...bind(),
style: { transform: y.interpolate(y => `translateY(${y > 0 ? y : 0}px)`) }
style: { transform: y.interpolate((y) => `translateY(${y > 0 ? y : 0}px)`) },
}
: {})}
aria-label="dialog content"
Expand Down
2 changes: 1 addition & 1 deletion src/components/ModalViews/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function LoadingView({ children, onDismiss }: { children: any; onDismiss:
export function SubmittedView({
children,
onDismiss,
hash
hash,
}: {
children: any
onDismiss: () => void
Expand Down
2 changes: 1 addition & 1 deletion src/components/NavigationTabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Tabs = styled.div`
const activeClassName = 'ACTIVE'

const StyledNavLink = styled(NavLink).attrs({
activeClassName
activeClassName,
})`
${({ theme }) => theme.flexRowNoWrap}
align-items: center;
Expand Down
2 changes: 1 addition & 1 deletion src/components/NumericalInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const Input = React.memo(function InnerInput({
<StyledInput
{...rest}
value={value}
onChange={event => {
onChange={(event) => {
// replace commas with periods, because uniswap exclusively uses period as the decimal separator
enforcer(event.target.value.replace(/,/g, '.'))
}}
Expand Down
Loading

0 comments on commit 9d9b57d

Please sign in to comment.