Skip to content
This repository was archived by the owner on Mar 28, 2024. It is now read-only.

Commit e7d683c

Browse files
committed
refactor: apply changes according to eslint
1 parent 69e05df commit e7d683c

19 files changed

+151
-125
lines changed

packages/client/.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*.js

packages/client/.eslintrc.js

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
module.exports = {
2-
parser: '@typescript-eslint/parser',
2+
parser: "@typescript-eslint/parser",
33
parserOptions: {
4-
project: 'tsconfig.json',
5-
sourceType: 'module',
4+
project: "./packages/client/tsconfig.json",
5+
sourceType: "module",
66
},
77
plugins: [
8-
'@typescript-eslint/eslint-plugin',
9-
'import',
10-
'react',
11-
'react-hooks',
12-
'jsx',
13-
'jsx-a11y',
8+
"@typescript-eslint/eslint-plugin",
9+
"import",
10+
"react",
11+
"react-hooks",
12+
"jsx",
13+
"jsx-a11y",
14+
"prettier",
1415
],
1516
extends: [
16-
'plugin:@typescript-eslint/eslint-recommended',
17-
'plugin:@typescript-eslint/recommended',
18-
'prettier',
19-
'prettier/react',
20-
'prettier/@typescript-eslint',
21-
'airbnb-typescript',
17+
"plugin:@typescript-eslint/eslint-recommended",
18+
"plugin:@typescript-eslint/recommended",
19+
"airbnb-typescript",
20+
"plugin:prettier/recommended",
21+
"prettier/react",
22+
"prettier/@typescript-eslint",
2223
],
2324
root: true,
2425
env: {
2526
node: true,
2627
jest: true,
2728
},
2829
rules: {
29-
'@typescript-eslint/interface-name-prefix': 'off',
30-
'@typescript-eslint/explicit-function-return-type': 'off',
31-
'@typescript-eslint/no-explicit-any': 'off',
30+
"@typescript-eslint/interface-name-prefix": "off",
31+
"@typescript-eslint/explicit-function-return-type": "off",
32+
"@typescript-eslint/no-explicit-any": "off",
3233
},
3334
};

packages/client/.prettierrc

-4
This file was deleted.

packages/client/package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
"@babel/preset-react": "^7.9.4",
1717
"@babel/preset-typescript": "^7.9.0",
1818
"@types/html-webpack-plugin": "^3.2.2",
19-
"@types/node": "^13.13.5",
20-
"@types/react": "^16.9.34",
21-
"@types/react-dom": "^16.9.7",
19+
"@types/node": "^14.0.1",
20+
"@types/react": "^16.9.35",
21+
"@types/react-dom": "^16.9.8",
2222
"@types/react-html-parser": "^2.0.1",
2323
"@types/react-router": "^5.1.7",
2424
"@types/react-router-dom": "^5.1.5",
25-
"@types/webpack": "^4.41.12",
25+
"@types/webpack": "^4.41.13",
2626
"@types/webpack-dev-server": "^3.10.1",
27-
"@typescript-eslint/eslint-plugin": "^2.31.0",
28-
"@typescript-eslint/parser": "^2.31.0",
27+
"@typescript-eslint/eslint-plugin": "^2.33.0",
28+
"@typescript-eslint/parser": "^2.33.0",
2929
"babel-loader": "^8.1.0",
3030
"babel-plugin-import": "^1.13.0",
3131
"cross-env": "^7.0.2",
@@ -36,16 +36,16 @@
3636
"eslint-plugin-import": "^2.20.2",
3737
"eslint-plugin-jsx": "^0.1.0",
3838
"eslint-plugin-jsx-a11y": "^6.2.3",
39-
"eslint-plugin-react": "^7.19.0",
40-
"eslint-plugin-react-hooks": "^4.0.0",
39+
"eslint-plugin-prettier": "^3.1.3",
40+
"eslint-plugin-react": "^7.20.0",
41+
"eslint-plugin-react-hooks": "^4.0.2",
4142
"html-webpack-plugin": "^4.3.0",
4243
"path": "^0.12.7",
4344
"prettier": "^2.0.5",
4445
"style-loader": "^1.2.1",
45-
"ts-loader": "^7.0.3",
4646
"ts-node": "^8.10.1",
4747
"tsconfig-paths": "^3.9.0",
48-
"typescript": "^3.8.3",
48+
"typescript": "^3.9.2",
4949
"webpack": "^4.43.0",
5050
"webpack-cli": "^3.3.11",
5151
"webpack-dev-server": "^3.11.0"

packages/client/src/components/App.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import React from 'react';
2-
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
3-
import ApolloClient from 'apollo-boost';
4-
import { ApolloProvider } from '@apollo/react-hooks';
5-
import { CssBaseline } from '@material-ui/core';
6-
import { Home } from './Home';
1+
import React from "react";
2+
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
3+
import ApolloClient from "apollo-boost";
4+
import { ApolloProvider } from "@apollo/react-hooks";
5+
import { CssBaseline } from "@material-ui/core";
6+
import Home from "./Home";
77

8-
export function App() {
8+
export default function App() {
99
const client = new ApolloClient({
10-
uri: 'http://localhost:3000/graphql',
10+
uri: "http://localhost:3000/graphql",
1111
});
1212

1313
return (

packages/client/src/components/Home.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React from 'react';
2-
import { makeStyles, Theme } from '@material-ui/core/styles';
3-
import { AppBar, Container, Toolbar, Typography } from '@material-ui/core';
4-
import { AddPodcastFab, PodcastList } from './podcast';
1+
import React from "react";
2+
import { makeStyles, Theme } from "@material-ui/core/styles";
3+
import { AppBar, Container, Toolbar, Typography } from "@material-ui/core";
4+
import { AddPodcastFab, PodcastList } from "./podcast";
55

66
const useStyles = makeStyles((theme: Theme) => ({
77
appbar: {
@@ -12,7 +12,7 @@ const useStyles = makeStyles((theme: Theme) => ({
1212
},
1313
}));
1414

15-
export function Home() {
15+
export default function Home() {
1616
const classes = useStyles();
1717

1818
return (

packages/client/src/components/episodes/EpisodeItem.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import React from 'react';
2-
import { Episode } from '../../interfaces';
3-
import { Grid, Typography } from '@material-ui/core';
4-
import parse from 'html-react-parser';
1+
import React from "react";
2+
import { Grid, Typography } from "@material-ui/core";
3+
import parse from "html-react-parser";
4+
import { Episode } from "../../interfaces";
55

66
interface EpisodeItemProps {
77
episode: Episode;
88
}
99

10-
export function EpisodeItem(props: EpisodeItemProps) {
10+
export default function EpisodeItem(props: EpisodeItemProps) {
1111
const { episode } = props;
1212

1313
return (

packages/client/src/components/episodes/EpisodeList.tsx

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React from 'react';
2-
import { EpisodeConnection } from '../../interfaces';
3-
import { Grid, GridProps } from '@material-ui/core';
4-
import { EpisodeItem } from './EpisodeItem';
5-
import { makeStyles, Theme } from '@material-ui/core/styles';
1+
import React from "react";
2+
import { Grid, GridProps } from "@material-ui/core";
3+
import { makeStyles } from "@material-ui/core/styles";
4+
import { EpisodeConnection } from "../../interfaces";
5+
import EpisodeItem from "./EpisodeItem";
66

77
interface EpisodeListProps {
88
episodes: EpisodeConnection;
@@ -12,21 +12,21 @@ interface StyleProps {
1212
backgroundImage: string;
1313
}
1414

15-
const useStyles = makeStyles((theme: Theme) => ({
15+
const useStyles = makeStyles(() => ({
1616
episode: {
1717
flexGrow: 1,
18-
'&:before': {
19-
content: ' ',
20-
display: 'block',
21-
position: 'absolute',
18+
"&:before": {
19+
content: " ",
20+
display: "block",
21+
position: "absolute",
2222
top: 0,
2323
left: 0,
24-
height: '100%',
25-
width: '100%',
24+
height: "100%",
25+
width: "100%",
2626
backgroundImage: (props: StyleProps) => `url(${props.backgroundImage})`,
27-
backgroundRepeat: 'no-repeat',
28-
backgroundSize: 'cover',
29-
backgroundPosition: '50% 0',
27+
backgroundRepeat: "no-repeat",
28+
backgroundSize: "cover",
29+
backgroundPosition: "50% 0",
3030
opacity: 0.6,
3131
zIndex: 1,
3232
},
@@ -35,16 +35,17 @@ const useStyles = makeStyles((theme: Theme) => ({
3535

3636
function GridBackground(props: StyleProps & Omit<GridProps, keyof StyleProps>) {
3737
const { backgroundImage, children, ...other } = props;
38-
const classes = useStyles({ backgroundImage: backgroundImage });
38+
const classes = useStyles({ backgroundImage });
3939

4040
return (
41+
// eslint-disable-next-line react/jsx-props-no-spreading
4142
<Grid className={classes.episode} {...other}>
4243
{children}
4344
</Grid>
4445
);
4546
}
4647

47-
export function EpisodeList(props: EpisodeListProps) {
48+
export default function EpisodeList(props: EpisodeListProps) {
4849
const { episodes } = props;
4950

5051
return (
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
export { EpisodeList } from './EpisodeList';
1+
import EpisodeList from "./EpisodeList";
2+
3+
export default EpisodeList;

packages/client/src/components/podcast/AddPodcastFab.tsx

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React, { useState } from "react";
22
import {
33
Fab,
44
Dialog,
@@ -7,26 +7,26 @@ import {
77
DialogContent,
88
DialogActions,
99
Button,
10-
} from '@material-ui/core';
11-
import { Add as AddIcon } from '@material-ui/icons';
12-
import { makeStyles, Theme } from '@material-ui/core/styles';
13-
import { useForm } from 'react-hook-form';
14-
import { gql } from 'apollo-boost';
15-
import { useMutation } from '@apollo/react-hooks';
10+
} from "@material-ui/core";
11+
import { Add as AddIcon } from "@material-ui/icons";
12+
import { makeStyles } from "@material-ui/core/styles";
13+
import { useForm } from "react-hook-form";
14+
import { gql } from "apollo-boost";
15+
import { useMutation } from "@apollo/react-hooks";
1616

17-
const useStyles = makeStyles((theme: Theme) => ({
17+
const useStyles = makeStyles(() => ({
1818
fab: {
1919
margin: 0,
20-
top: 'auto',
21-
left: 'auto',
20+
top: "auto",
21+
left: "auto",
2222
bottom: 20,
2323
right: 20,
24-
position: 'fixed',
24+
position: "fixed",
2525
},
2626
}));
2727

2828
type FormData = {
29-
podcastUrl: String;
29+
podcastUrl: string;
3030
};
3131

3232
const ADD_PODCAST = gql`
@@ -38,18 +38,18 @@ const ADD_PODCAST = gql`
3838
`;
3939

4040
interface Queue {
41-
url: String;
41+
url: string;
4242
}
4343

4444
interface CreateOneQueueInput {
4545
queue: Queue;
4646
}
4747

48-
export function AddPodcastFab() {
48+
export default function AddPodcastFab() {
4949
const classes = useStyles();
5050
const [open, setOpen] = useState(false);
5151
const { register, handleSubmit } = useForm<FormData>();
52-
const [addPodcast, {}] = useMutation<
52+
const [addPodcast] = useMutation<
5353
{ createOneQueue: Queue },
5454
{ input: CreateOneQueueInput }
5555
>(ADD_PODCAST);

0 commit comments

Comments
 (0)