Skip to content

Commit 01f9743

Browse files
committed
fix linting issues
1 parent d4ff129 commit 01f9743

File tree

102 files changed

+21093
-23656
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+21093
-23656
lines changed

docs/whats-new.md

Lines changed: 91 additions & 205 deletions
Large diffs are not rendered by default.

src/client/scroll-fix.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
export function onRouteDidUpdate({ location, previousLocation }) {
22
if (!previousLocation && location.hash) {
3-
return;
3+
return
44
}
5-
if (previousLocation &&
6-
location.pathname === previousLocation.pathname &&
7-
location.hash) {
8-
return;
5+
if (previousLocation && location.pathname === previousLocation.pathname && location.hash) {
6+
return
97
}
108
function handleScroll() {
119
const items = document.querySelectorAll('.menu__link--active')

src/components/Accordion/index.tsx

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,33 @@
1-
import React, { useState } from "react";
2-
import clsx from "clsx";
3-
import styles from "./accordion.module.scss";
4-
import CloseImg from "./close.svg";
1+
import React, { useState } from 'react'
2+
import clsx from 'clsx'
3+
import styles from './accordion.module.scss'
4+
import CloseImg from './close.svg'
55

66
interface IAccordion {
7-
children: [React.ReactElement, React.ReactElement];
8-
opened?: boolean;
7+
children: [React.ReactElement, React.ReactElement]
8+
opened?: boolean
99
}
1010

11-
export default function Accordion({
12-
children: [title, body],
13-
opened = false,
14-
}: IAccordion) {
15-
const [isOpened, setIsOpened] = useState(opened);
11+
export default function Accordion({ children: [title, body], opened = false }: IAccordion) {
12+
const [isOpened, setIsOpened] = useState(opened)
1613

1714
const handleToggle = () => {
18-
setIsOpened((value) => !value);
19-
};
15+
setIsOpened(value => !value)
16+
}
2017

2118
return (
2219
<div className={styles.accordion}>
2320
<div
2421
role="button"
2522
data-testid="accordion-title"
2623
onClick={handleToggle}
27-
className={styles.header}
28-
>
24+
className={styles.header}>
2925
{title}
30-
<span
31-
role="button"
32-
data-testid="accordion-button-x"
33-
className={styles.closeButton}
34-
>
26+
<span role="button" data-testid="accordion-button-x" className={styles.closeButton}>
3527
<CloseImg className={clsx(styles.image, isOpened && styles.opened)} />
3628
</span>
3729
</div>
38-
<div className={clsx(styles.content, isOpened && styles.opened)}>
39-
{body}
40-
</div>
30+
<div className={clsx(styles.content, isOpened && styles.opened)}>{body}</div>
4131
</div>
42-
);
32+
)
4333
}

src/components/Alert/index.tsx

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import React from "react";
2-
import { positions, types } from "react-alert";
3-
import clsx from "clsx";
4-
import CloseImg from "./close.svg";
5-
import InfoImg from "./info.svg";
6-
import SuccessImg from "./success.svg";
7-
import ErrorImg from "./error.svg";
8-
import Text from "@site/src/components/Text";
9-
import styles from "./alert.module.scss";
1+
import React from 'react'
2+
import { positions, types } from 'react-alert'
3+
import clsx from 'clsx'
4+
import CloseImg from './close.svg'
5+
import InfoImg from './info.svg'
6+
import SuccessImg from './success.svg'
7+
import ErrorImg from './error.svg'
8+
import Text from '@site/src/components/Text'
9+
import styles from './alert.module.scss'
1010

1111
export const options = {
1212
position: positions.TOP_CENTER,
1313
timeout: 10000,
14-
offset: "5px",
14+
offset: '5px',
1515
containerStyle: {
1616
zIndex: 1000,
1717
marginTop: 64,
1818
},
19-
};
19+
}
2020

2121
export const AlertTemplate = ({ style, options, message, close }) => {
2222
const handleCloseAlert = () => {
23-
close();
24-
};
23+
close()
24+
}
2525

2626
return (
2727
<div
@@ -30,9 +30,8 @@ export const AlertTemplate = ({ style, options, message, close }) => {
3030
styles.alert,
3131
options.type === types.INFO && styles.info,
3232
options.type === types.SUCCESS && styles.success,
33-
options.type === types.ERROR && styles.error,
34-
)}
35-
>
33+
options.type === types.ERROR && styles.error
34+
)}>
3635
{options.type === types.INFO && <InfoImg className={styles.icon} />}
3736
{options.type === types.SUCCESS && <SuccessImg className={styles.icon} />}
3837
{options.type === types.ERROR && <ErrorImg className={styles.icon} />}
@@ -41,30 +40,21 @@ export const AlertTemplate = ({ style, options, message, close }) => {
4140
role="button"
4241
data-testid="alert-close"
4342
onClick={handleCloseAlert}
44-
className={styles.closeButton}
45-
>
43+
className={styles.closeButton}>
4644
<CloseImg className={styles.closeIcon} />
4745
</span>
4846
</div>
49-
);
50-
};
47+
)
48+
}
5149

52-
export const AlertTitle = ({
53-
children,
54-
}: {
55-
children: string | React.ReactElement;
56-
}) => (
50+
export const AlertTitle = ({ children }: { children: string | React.ReactElement }) => (
5751
<Text as="p" className={styles.alertTitle}>
5852
{children}
5953
</Text>
60-
);
54+
)
6155

62-
export const AlertText = ({
63-
children,
64-
}: {
65-
children: string | React.ReactElement;
66-
}) => (
56+
export const AlertText = ({ children }: { children: string | React.ReactElement }) => (
6757
<Text as="p" className={styles.alertText}>
6858
{children}
6959
</Text>
70-
);
60+
)
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
import React, { useEffect, useState } from "react";
2-
import { Redirect, useLocation } from "@docusaurus/router";
3-
import useUser from "@site/src/hooks/useUser";
4-
import { NO_FOUND_PAGE, AUTH_ROUTES } from "@site/src/lib/constants";
1+
import React, { useEffect, useState } from 'react'
2+
import { Redirect, useLocation } from '@docusaurus/router'
3+
import useUser from '@site/src/hooks/useUser'
4+
import { NO_FOUND_PAGE, AUTH_ROUTES } from '@site/src/lib/constants'
55

66
const AuthRedirect = () => {
7-
const location = useLocation();
8-
const { user, loading } = useUser();
9-
const [currentPage, setCurrentPage] = useState(location.pathname);
7+
const location = useLocation()
8+
const { user, loading } = useUser()
9+
const [currentPage, setCurrentPage] = useState(location.pathname)
1010

1111
useEffect(() => {
12-
const authRoute = location.pathname.includes(AUTH_ROUTES.GAS_API);
13-
const isAuth = user && user?.email.includes("@consensys.net");
12+
const authRoute = location.pathname.includes(AUTH_ROUTES.GAS_API)
13+
const isAuth = user && user?.email.includes('@consensys.net')
1414
if (authRoute) {
1515
if (!isAuth && !loading) {
16-
setCurrentPage(NO_FOUND_PAGE);
17-
document.body.setAttribute("links", "");
16+
setCurrentPage(NO_FOUND_PAGE)
17+
document.body.setAttribute('links', '')
1818
}
1919
if (isAuth && !loading) {
20-
setCurrentPage(location.pathname);
21-
document.body.setAttribute("links", "visible");
20+
setCurrentPage(location.pathname)
21+
document.body.setAttribute('links', 'visible')
2222
}
2323
} else {
24-
setCurrentPage(location.pathname);
24+
setCurrentPage(location.pathname)
2525
if (isAuth) {
26-
document.body.setAttribute("links", "visible");
26+
document.body.setAttribute('links', 'visible')
2727
}
2828
}
29-
}, [location.pathname, loading, user]);
29+
}, [location.pathname, loading, user])
3030

31-
return <Redirect to={currentPage} />;
32-
};
31+
return <Redirect to={currentPage} />
32+
}
3333

34-
export default AuthRedirect;
34+
export default AuthRedirect

src/components/Badge/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import React from "react";
2-
import styles from "./badge.module.scss";
3-
import clsx from "clsx";
1+
import React from 'react'
2+
import styles from './badge.module.scss'
3+
import clsx from 'clsx'
44

5-
type variant = "error" | "success" | "default";
5+
type variant = 'error' | 'success' | 'default'
66

77
interface IBadge {
8-
variant?: variant;
9-
label: string;
8+
variant?: variant
9+
label: string
1010
}
1111

12-
export default function Badge({ variant = "default", label }: IBadge) {
13-
return <span className={clsx(styles.badge, styles[variant])}>{label}</span>;
12+
export default function Badge({ variant = 'default', label }: IBadge) {
13+
return <span className={clsx(styles.badge, styles[variant])}>{label}</span>
1414
}

src/components/Button/index.tsx

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
import React from "react";
2-
import LoadingImg from "./loading.svg";
3-
import clsx from "clsx";
1+
import React from 'react'
2+
import LoadingImg from './loading.svg'
3+
import clsx from 'clsx'
44

5-
import styles from "./button.module.scss";
5+
import styles from './button.module.scss'
66

77
interface IButton {
8-
testId?: string;
9-
onClick?: VoidFunction;
10-
children: string | React.ReactElement;
11-
disabled?: boolean;
12-
isLoading?: boolean;
13-
className?: string;
14-
href?: string;
15-
target?: string;
16-
thin?: boolean;
17-
type?: "default" | "danger";
18-
variant?: "primary" | "secondary";
19-
wrapText?: boolean;
20-
textColor?: "dark" | "light",
8+
testId?: string
9+
onClick?: VoidFunction
10+
children: string | React.ReactElement
11+
disabled?: boolean
12+
isLoading?: boolean
13+
className?: string
14+
href?: string
15+
target?: string
16+
thin?: boolean
17+
type?: 'default' | 'danger'
18+
variant?: 'primary' | 'secondary'
19+
wrapText?: boolean
20+
textColor?: 'dark' | 'light'
2121
}
2222

2323
export const Button = ({
@@ -28,47 +28,37 @@ export const Button = ({
2828
disabled = false,
2929
isLoading,
3030
href,
31-
target = "_blank",
31+
target = '_blank',
3232
thin = false,
33-
type = "default",
34-
variant="primary",
33+
type = 'default',
34+
variant = 'primary',
3535
wrapText = true,
36-
textColor = "dark"
36+
textColor = 'dark',
3737
}: IButton) => {
3838
const buttonRootClass = clsx(
3939
styles.button,
4040
thin && styles.thin,
41-
type === "danger" && styles.danger,
42-
variant === "primary" ? styles.primary : styles.secondary,
41+
type === 'danger' && styles.danger,
42+
variant === 'primary' ? styles.primary : styles.secondary,
4343
!wrapText && styles.nowrap,
44-
textColor === "light" && styles.textLight,
45-
className,
46-
);
47-
const isLoadingChild = !isLoading ? (
48-
children
49-
) : (
50-
<LoadingImg className={styles.isLoading} />
51-
);
44+
textColor === 'light' && styles.textLight,
45+
className
46+
)
47+
const isLoadingChild = !isLoading ? children : <LoadingImg className={styles.isLoading} />
5248

5349
return !href ? (
5450
<button
5551
data-testid={testId}
5652
className={buttonRootClass}
5753
onClick={onClick}
58-
disabled={isLoading || disabled}
59-
>
54+
disabled={isLoading || disabled}>
6055
{isLoadingChild}
6156
</button>
6257
) : (
63-
<a
64-
data-testid={testId}
65-
className={buttonRootClass}
66-
href={href}
67-
target={target}
68-
>
58+
<a data-testid={testId} className={buttonRootClass} href={href} target={target}>
6959
{isLoadingChild}
7060
</a>
71-
);
72-
};
61+
)
62+
}
7363

74-
export default Button;
64+
export default Button

src/components/Card.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ export type CardItem = {
1818
buttonIcon?: 'arrow-right' | 'external-arrow'
1919
}
2020

21-
export default function Card({ title, href, description, theme, buttonIcon = "arrow-right" }: CardItem) {
21+
export default function Card({
22+
title,
23+
href,
24+
description,
25+
theme,
26+
buttonIcon = 'arrow-right',
27+
}: CardItem) {
2228
const [isHovered, setIsHovered] = useState(false)
2329

2430
return (

src/components/CardSection.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ export default function CardSection({
3838
style={
3939
colorPalette
4040
? ({
41-
'--color-palette': `var(--developer-${colorPalette})`,
42-
} as CSSProperties)
41+
'--color-palette': `var(--developer-${colorPalette})`,
42+
} as CSSProperties)
4343
: {}
44-
}
45-
>
44+
}>
4645
{/* Title and Description Column */}
4746
{(title || description) && (
4847
<div className={styles['content-column']}>

0 commit comments

Comments
 (0)