Skip to content

Commit d05c93f

Browse files
committed
Misc eslint and typescript fixes
1 parent e3fc1f7 commit d05c93f

38 files changed

+216
-258
lines changed

.eslintrc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
"react/no-string-refs": 2,
4242
"react/no-typos": 1,
4343
"react/no-unknown-property": 1,
44-
"react/no-unused-prop-types": 1,
44+
"react/no-unused-prop-types": 0,
4545
"react/no-unused-state": 1,
4646
"react/prefer-stateless-function": 1,
4747
"react/prop-types": 2,
48-
"react/require-default-props": 1,
48+
"react/require-default-props": 0,
4949
"react/require-render-return": 2,
5050
"react/self-closing-comp": 1,
5151
"react/sort-comp": 1,
@@ -73,7 +73,10 @@
7373
"rules": {
7474
"no-undef": 0,
7575
"no-unused-vars": 0,
76-
"@typescript-eslint/no-unused-vars": 2,
76+
"@typescript-eslint/no-unused-vars": [
77+
"warn",
78+
{ "argsIgnorePattern": "^_" }
79+
],
7780
"no-unused-expressions": 0,
7881
"@typescript-eslint/no-unused-expressions": ["error"]
7982
}

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ format:
3030
$(info Task: format:check)
3131
$(EXEC) sh -c 'npm run format:check:app || exit 255'
3232

33+
.PHONY: types
34+
format:
35+
$(info Task: types)
36+
$(EXEC) sh -c 'npm run types || exit 255'
37+
3338
.PHONY: build
3439
build:
3540
$(info Task: build production)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"lint": "eslint --ext .js,.jsx,.ts,.tsx src",
1212
"start-docker": "docker run -e FLOW_DEBUG=true -e FLOW_SESSIONCOOKIESSECURE=false -p 8080:8080 gcr.io/dl-flow/playground-api:latest ?",
1313
"snyk-protect": "snyk protect",
14-
"tsc": "tsc",
15-
"ci:check": "npm run format:check:app && npm run lint && npm run tsc"
14+
"types": "tsc",
15+
"ci:check": "npm run format:check:app && npm run lint && npm run types"
1616
},
1717
"dependencies": {
1818
"@apollo/react-hooks": "^3.1.3",

src/components/AccountAvatars.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React from 'react';
2-
import { useThemeUI, Flex, Box, Badge } from 'theme-ui';
1+
import Avatar from 'components/Avatar';
32
import { motion } from 'framer-motion';
3+
import React from 'react';
44
import { Account, Project } from 'src/api/apollo/generated/graphql';
5-
import Avatar from 'components/Avatar';
5+
import { Badge, Box, Flex, useThemeUI } from 'theme-ui';
66

77
export const AccountAvatar: React.FC<{
88
onClick: (e: any, i: number) => void;
@@ -11,7 +11,7 @@ export const AccountAvatar: React.FC<{
1111
return (
1212
<motion.div>
1313
<Box
14-
//@ts-ignore
14+
// @ts-expect-error #TODO: switch to button
1515
onClick={onClick}
1616
mx="0.5rem"
1717
sx={{
@@ -105,7 +105,7 @@ const AccountAvatars: React.FC<{
105105
}}
106106
/>
107107
<Badge
108-
px={'5px'}
108+
px="5px"
109109
sx={{
110110
fontSize: 3,
111111
backgroundColor: isSelected
@@ -128,5 +128,3 @@ const AccountAvatars: React.FC<{
128128
};
129129

130130
export default AccountAvatars;
131-
132-
// @ts-ignore-end

src/components/AccountPicker.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React, { useEffect } from 'react';
2-
import { Flex, useThemeUI } from 'theme-ui';
31
import { Account, Project } from 'api/apollo/generated/graphql';
42
import AccountAvatars from 'components/AccountAvatars';
53
import AccountSigners from 'components/AccountSigners';
4+
import React, { useEffect } from 'react';
5+
import { Flex, useThemeUI } from 'theme-ui';
66

77
type AccountPickerProps = {
88
project: Project;
@@ -81,7 +81,7 @@ const AccountPicker: React.FC<AccountPickerProps> = ({
8181
maxSelection={maxSelection}
8282
/>
8383
<Flex
84-
px={'0.5rem'}
84+
px="0.5rem"
8585
sx={{
8686
alignItems: 'center',
8787
}}

src/components/AccountSigners.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import React from 'react';
2-
import { useThemeUI, Flex, Badge, Text } from 'theme-ui';
1+
import { AccountAvatar, AvatarList } from 'components/AccountAvatars';
2+
import Avatar from 'components/Avatar';
33
import { motion } from 'framer-motion';
4+
import React from 'react';
45
import { Account, Project } from 'src/api/apollo/generated/graphql';
5-
import Avatar from 'components/Avatar';
6-
import { AccountAvatar, AvatarList } from 'components/AccountAvatars';
6+
import { Badge, Flex, Text, useThemeUI } from 'theme-ui';
77

88
export const Outline: React.FC = ({ children }) => {
99
const { theme } = useThemeUI();
1010

1111
return (
1212
<motion.div>
1313
<Flex
14-
mx={'0.5rem'}
14+
mx="0.5rem"
1515
sx={{
1616
justifyContent: 'center',
1717
alignItems: 'center',
@@ -100,7 +100,7 @@ const AccountSigners: React.FC<{
100100
}}
101101
/>
102102
<Badge
103-
px={'5px'}
103+
px="5px"
104104
sx={{
105105
fontSize: 3,
106106
backgroundColor: theme.colors.primary,

src/components/ActionButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from 'react';
21
import { motion } from 'framer-motion';
2+
import React from 'react';
33
import { CSSProperties } from 'styled-components';
44
import Button from './Button';
55

66
interface ActionButtonProps {
7-
children?: any;
7+
children?: React.ReactNode;
88
onClick?: any;
99
className?: string;
1010
style?: CSSProperties;

src/components/Arguments/index.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import React, { useEffect, useRef, useState } from 'react';
2-
import { FaRegCheckCircle, FaRegTimesCircle, FaSpinner } from 'react-icons/fa';
3-
import { AiFillCloseCircle } from 'react-icons/ai';
4-
import { motion, AnimatePresence } from 'framer-motion';
5-
import { EntityType } from 'providers/Project';
6-
import { useProject } from 'providers/Project/projectHooks';
7-
import { RemoveToastButton } from 'layout/RemoveToastButton';
8-
import { useThemeUI, Box, Text, Flex } from 'theme-ui';
91
import {
102
Account,
113
ResultType,
124
useSetExecutionResultsMutation,
135
} from 'api/apollo/generated/graphql';
6+
import { AnimatePresence, motion } from 'framer-motion';
7+
import { RemoveToastButton } from 'layout/RemoveToastButton';
8+
import { EntityType } from 'providers/Project';
9+
import { useProject } from 'providers/Project/projectHooks';
10+
import React, { useEffect, useRef, useState } from 'react';
11+
import { AiFillCloseCircle } from 'react-icons/ai';
12+
import { FaRegCheckCircle, FaRegTimesCircle, FaSpinner } from 'react-icons/fa';
13+
import { Box, Flex, Text, useThemeUI } from 'theme-ui';
1414

1515
import { ArgumentsProps } from 'components/Arguments/types';
1616
import { ExecuteCommandRequest } from 'monaco-languageclient';
1717

1818
import {
1919
ControlContainer,
20-
ToastContainer,
2120
HoverPanel,
2221
StatusMessage,
22+
ToastContainer,
2323
} from './styles';
2424

2525
import {
@@ -229,9 +229,9 @@ const Arguments: React.FC<ArgumentsProps> = (props) => {
229229
const [notifications, setNotifications] = useState<{
230230
[identifier: string]: string[];
231231
}>({});
232-
/* eslint-disable */
233232
// compare 'state' field for each account, set 'notifications' state for new data
234-
// @ts-ignore: <- this state is only used to compare and render notifications
233+
// <- this state is only used to compare and render notifications
234+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
235235
const [_, setProjectAccts] = useState(project.accounts);
236236
const [counter, setCounter] = useState(0);
237237
useEffect(() => {

src/components/Avatar.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ const Avatar: React.FC<AvatarProps> = ({ seed, index, style }) => {
1616
}
1717

1818
return (
19-
<img className="avatar" src={avataaar(rng().toString())} style={style} />
19+
<img
20+
className="avatar"
21+
src={avataaar(rng().toString())}
22+
style={style}
23+
alt="Avatar"
24+
/>
2025
);
2126
};
2227

src/components/Button.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React from 'react';
2-
import { Button as ThemedButton } from 'theme-ui';
31
import styled from '@emotion/styled';
42
import { motion } from 'framer-motion';
3+
import React from 'react';
54
import { FaSpinner } from 'react-icons/fa';
65
import { CSSProperties } from 'styled-components';
6+
import { Button as ThemedButton } from 'theme-ui';
77

88
interface StyledButtonProps {
99
style?: CSSProperties;
@@ -58,7 +58,7 @@ const StyledButton: React.FC<StyledButtonProps> = styled(ThemedButton)`
5858
`;
5959

6060
interface ButtonProps {
61-
children?: any;
61+
children?: React.ReactNode;
6262
onClick?: any;
6363
className?: string;
6464
style?: CSSProperties;

0 commit comments

Comments
 (0)