Skip to content

Commit 87f62ba

Browse files
committed
(chore) - lint
1 parent a524ede commit 87f62ba

File tree

10 files changed

+85
-88
lines changed

10 files changed

+85
-88
lines changed

src/components/App.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React from 'react'
2-
import LinkList from './LinkList'
3-
import CreateLink from './CreateLink'
4-
import Header from './Header'
5-
import { Switch, Route, Redirect } from 'react-router-dom'
6-
import Login from './Login'
7-
import Search from './Search'
1+
import React from 'react';
2+
import { Switch, Route, Redirect } from "react-router-dom";
3+
import LinkList from './LinkList';
4+
import CreateLink from './CreateLink';
5+
import Header from './Header';
6+
import Login from './Login';
7+
import Search from './Search';
88

9-
const Fetching = () => <p>Fetcing</p>
9+
const Fetching = () => <p>Fetcing</p>;
1010
const App = () => (
1111
<div className="center w85">
1212
<Header />
@@ -25,4 +25,4 @@ const App = () => (
2525
</div>
2626
);
2727

28-
export default App
28+
export default App;

src/components/CreateLink.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react'
2-
import { useMutation } from 'urql'
3-
import gql from 'graphql-tag'
1+
import React from 'react';
2+
import { useMutation } from 'urql';
3+
import gql from 'graphql-tag';
44
import usePreviousValue from '../hooks/usePreviousValue';
55

66
const POST_MUTATION = gql`
@@ -22,7 +22,7 @@ const CreateLink = ({ history }) => {
2222

2323
React.useEffect(() => {
2424
if (state.fetching === false && prevFetching === true) {
25-
history.push('/new/1')
25+
history.push('/new/1');
2626
}
2727
}, [state.fetching, prevFetching, history]);
2828

@@ -53,4 +53,4 @@ const CreateLink = ({ history }) => {
5353
);
5454
}
5555

56-
export default CreateLink
56+
export default CreateLink;

src/components/Header.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from 'react'
2-
import { Link } from 'react-router-dom'
3-
import { withRouter } from 'react-router'
4-
import { AUTH_TOKEN } from '../constants'
1+
import React from 'react';
2+
import { Link } from 'react-router-dom';
3+
import { withRouter } from 'react-router';
4+
import { AUTH_TOKEN } from '../constants';
55

66
const Header = ({ history }) => {
7-
const authToken = localStorage.getItem(AUTH_TOKEN)
7+
const authToken = localStorage.getItem(AUTH_TOKEN);
88
return (
99
<div className="flex pa1 justify-between nowrap orange">
1010
<div className="flex flex-fixed black">
@@ -47,7 +47,7 @@ const Header = ({ history }) => {
4747
)}
4848
</div>
4949
</div>
50-
)
50+
);
5151
}
5252

53-
export default withRouter(Header)
53+
export default withRouter(Header);

src/components/Link.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React from 'react'
2-
import { AUTH_TOKEN } from '../constants'
3-
import { timeDifferenceForDate } from '../utils'
4-
import { useMutation } from 'urql'
5-
import gql from 'graphql-tag'
1+
import React from 'react';
2+
import { useMutation } from 'urql';
3+
import gql from 'graphql-tag';
4+
import { timeDifferenceForDate } from "../utils";
5+
import { AUTH_TOKEN } from "../constants";
66

77
const VOTE_MUTATION = gql`
88
mutation VoteMutation($linkId: ID!) {
@@ -21,14 +21,14 @@ const VOTE_MUTATION = gql`
2121
}
2222
}
2323
}
24-
`
24+
`;
2525

2626
const Link = ({ link, index }) => {
2727
const authToken = localStorage.getItem(AUTH_TOKEN);
2828
const [, executeMutation] = useMutation(VOTE_MUTATION);
2929

3030
const voteMutation = React.useCallback(() => {
31-
executeMutation({ linkId: link.id })
31+
executeMutation({ linkId: link.id });
3232
}, [link, executeMutation]);
3333

3434
return (
@@ -54,7 +54,7 @@ const Link = ({ link, index }) => {
5454
</div>
5555
</div>
5656
</div>
57-
)
57+
);
5858
}
5959

60-
export default Link
60+
export default Link;

src/components/LinkList.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React, { Fragment } from 'react'
2-
import Link from './Link'
3-
import { useQuery, useSubscription } from 'urql'
4-
import gql from 'graphql-tag'
5-
import { LINKS_PER_PAGE } from '../constants'
1+
import React, { Fragment } from 'react';
2+
import { useQuery, useSubscription } from 'urql';
3+
import gql from 'graphql-tag';
4+
import { LINKS_PER_PAGE } from '../constants';
5+
import Link from "./Link";
66

77
export const FEED_QUERY = gql`
88
query FeedQuery($first: Int, $skip: Int, $orderBy: LinkOrderByInput) {
@@ -26,7 +26,7 @@ export const FEED_QUERY = gql`
2626
count
2727
}
2828
}
29-
`
29+
`;
3030

3131
const NEW_LINKS_SUBSCRIPTION = gql`
3232
subscription {
@@ -47,7 +47,7 @@ const NEW_LINKS_SUBSCRIPTION = gql`
4747
}
4848
}
4949
}
50-
`
50+
`;
5151

5252
const NEW_VOTES_SUBSCRIPTION = gql`
5353
subscription {
@@ -74,7 +74,7 @@ const NEW_VOTES_SUBSCRIPTION = gql`
7474
}
7575
}
7676
}
77-
`
77+
`;
7878

7979
const LinkList = ({ location, match, history }) => {
8080
const isNewPage = location.pathname.includes("new");
@@ -92,12 +92,8 @@ const LinkList = ({ location, match, history }) => {
9292
variables: getQueryVariables(),
9393
});
9494

95-
useSubscription({
96-
query: NEW_VOTES_SUBSCRIPTION
97-
});
98-
useSubscription({
99-
query: NEW_LINKS_SUBSCRIPTION
100-
});
95+
useSubscription({ query: NEW_VOTES_SUBSCRIPTION });
96+
useSubscription({ query: NEW_LINKS_SUBSCRIPTION });
10197

10298
const linksToRender = React.useMemo(() => {
10399
if (fetching) return [];
@@ -153,4 +149,4 @@ const LinkList = ({ location, match, history }) => {
153149
);
154150
}
155151

156-
export default LinkList
152+
export default LinkList;

src/components/Login.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import React from 'react'
2-
import { AUTH_TOKEN } from '../constants'
3-
import { useMutation } from 'urql'
4-
import gql from 'graphql-tag'
1+
import React from 'react';
2+
import { useMutation } from 'urql';
3+
import gql from 'graphql-tag';
54
import usePreviousValue from '../hooks/usePreviousValue';
5+
import { AUTH_TOKEN } from "../constants";
66

77
const SIGNUP_MUTATION = gql`
88
mutation SignupMutation($email: String!, $password: String!, $name: String!) {
99
signup(email: $email, password: $password, name: $name) {
1010
token
1111
}
1212
}
13-
`
13+
`;
1414

1515
const LOGIN_MUTATION = gql`
1616
mutation LoginMutation($email: String!, $password: String!) {
1717
login(email: $email, password: $password) {
1818
token
1919
}
2020
}
21-
`
21+
`;
2222

2323
const Login = ({ history }) => {
2424
const [login, setLogin] = React.useState(true);
@@ -81,4 +81,4 @@ const Login = ({ history }) => {
8181
);
8282
}
8383

84-
export default Login
84+
export default Login;

src/components/Search.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React from 'react'
2-
import { useQuery } from 'urql'
3-
import gql from 'graphql-tag'
4-
import Link from './Link'
1+
import React from 'react';
2+
import { useQuery } from 'urql';
3+
import gql from 'graphql-tag';
4+
import Link from './Link';
55

66
const FEED_SEARCH_QUERY = gql`
77
query FeedSearchQuery($filter: String!) {
@@ -24,7 +24,7 @@ const FEED_SEARCH_QUERY = gql`
2424
}
2525
}
2626
}
27-
`
27+
`;
2828

2929
const Search = () => {
3030
const [filter, setFilter] = React.useState('');
@@ -43,7 +43,7 @@ const Search = () => {
4343
<Link key={link.id} link={link} index={index} />
4444
))}
4545
</div>
46-
)
46+
);
4747
}
4848

49-
export default Search
49+
export default Search;

src/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export const AUTH_TOKEN = 'auth-token'
2-
export const LINKS_PER_PAGE = 5
1+
export const AUTH_TOKEN = 'auth-token';
2+
export const LINKS_PER_PAGE = 5;

src/index.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import React from 'react'
2-
import ReactDOM from 'react-dom'
3-
import './styles/index.css'
4-
import App from './components/App'
5-
import * as serviceWorker from './serviceWorker'
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
63
import { SubscriptionClient } from "subscriptions-transport-ws";
74
import {
85
Provider,
96
createClient,
107
fetchExchange,
118
dedupExchange,
129
subscriptionExchange
13-
} from "urql";
14-
import { cacheExchange } from '@urql/exchange-graphcache'
15-
// import { suspenseExchange } from '@urql/exchange-suspense'
16-
import { BrowserRouter } from 'react-router-dom'
10+
} from "urql";;
11+
import { cacheExchange } from '@urql/exchange-graphcache';
12+
// import { suspenseExchange } from '@urql/exchange-suspense';
13+
import { BrowserRouter } from 'react-router-dom';
14+
import "./styles/index.css";
15+
import App from "./components/App";
1716
import { AUTH_TOKEN, LINKS_PER_PAGE } from './constants'
1817
import { FEED_QUERY } from './components/LinkList';
18+
import * as serviceWorker from "./serviceWorker";
1919

2020
const cache = cacheExchange({
2121
keys: {
@@ -82,5 +82,6 @@ ReactDOM.render(
8282
</Provider>
8383
</BrowserRouter>,
8484
document.getElementById('root'),
85-
)
86-
serviceWorker.unregister()
85+
);
86+
87+
serviceWorker.unregister();

src/utils.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
function timeDifference(current, previous) {
2-
const milliSecondsPerMinute = 60 * 1000
3-
const milliSecondsPerHour = milliSecondsPerMinute * 60
4-
const milliSecondsPerDay = milliSecondsPerHour * 24
5-
const milliSecondsPerMonth = milliSecondsPerDay * 30
6-
const milliSecondsPerYear = milliSecondsPerDay * 365
2+
const milliSecondsPerMinute = 60 * 1000;
3+
const milliSecondsPerHour = milliSecondsPerMinute * 60;
4+
const milliSecondsPerDay = milliSecondsPerHour * 24;
5+
const milliSecondsPerMonth = milliSecondsPerDay * 30;
6+
const milliSecondsPerYear = milliSecondsPerDay * 365;
77

8-
const elapsed = current - previous
8+
const elapsed = current - previous;
99

1010
if (elapsed < milliSecondsPerMinute / 3) {
11-
return 'just now'
11+
return 'just now';
1212
}
1313

1414
if (elapsed < milliSecondsPerMinute) {
15-
return 'less than 1 min ago'
15+
return 'less than 1 min ago';
1616
} else if (elapsed < milliSecondsPerHour) {
17-
return Math.round(elapsed / milliSecondsPerMinute) + ' min ago'
17+
return Math.round(elapsed / milliSecondsPerMinute) + ' min ago';
1818
} else if (elapsed < milliSecondsPerDay) {
19-
return Math.round(elapsed / milliSecondsPerHour) + ' h ago'
19+
return Math.round(elapsed / milliSecondsPerHour) + ' h ago';
2020
} else if (elapsed < milliSecondsPerMonth) {
21-
return Math.round(elapsed / milliSecondsPerDay) + ' days ago'
21+
return Math.round(elapsed / milliSecondsPerDay) + ' days ago';
2222
} else if (elapsed < milliSecondsPerYear) {
23-
return Math.round(elapsed / milliSecondsPerMonth) + ' mo ago'
23+
return Math.round(elapsed / milliSecondsPerMonth) + ' mo ago';
2424
} else {
25-
return Math.round(elapsed / milliSecondsPerYear) + ' years ago'
25+
return Math.round(elapsed / milliSecondsPerYear) + ' years ago';
2626
}
2727
}
2828

2929
export function timeDifferenceForDate(date) {
30-
const now = new Date().getTime()
31-
const updated = new Date(date).getTime()
32-
return timeDifference(now, updated)
30+
const now = new Date().getTime();
31+
const updated = new Date(date).getTime();
32+
return timeDifference(now, updated);
3333
}

0 commit comments

Comments
 (0)