Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit ac77ad0

Browse files
eslint fix added
1 parent 8ef2b60 commit ac77ad0

32 files changed

+141
-261
lines changed

.prettierrc.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

public/my-serviceworker.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ self.addEventListener('install', (event) => {
2424
// Listen for requests
2525
self.addEventListener('fetch', (event) => {
2626
event.respondWith(
27-
caches.match(event.request).then(() => {
28-
return fetch(event.request).catch(() =>
29-
caches.match('offline.html')
30-
);
31-
})
27+
caches
28+
.match(event.request)
29+
.then(() => fetch(event.request).catch(() => caches.match('offline.html')))
3230
);
3331
});
3432

src/__tests__/example.test.js

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,29 @@ import { add, dateChange } from '../helpers/example';
33
const DATE = '2019/06/01';
44

55
describe('testing math add function', () => {
6+
beforeAll(() => {
7+
console.log('Math test started');
8+
});
69

7-
beforeAll(() => {
8-
console.log('Math test started');
9-
})
10+
test('Adding 1 + 23 equals 24', () => {
11+
expect(add(1, 23)).toBe(24);
12+
});
1013

11-
test('Adding 1 + 23 equals 24', () => {
12-
expect(add(1, 23)).toBe(24);
13-
});
14-
15-
test('Adding 1 + "1" equals 13', () => {
16-
expect(add(1, '3')).toBe('13');
17-
});
14+
test('Adding 1 + "1" equals 13', () => {
15+
expect(add(1, '3')).toBe('13');
16+
});
1817

19-
test('Adding "6" + 5 equals 65', () => {
20-
expect(add('6', 5)).toBe('65');
21-
});
18+
test('Adding "6" + 5 equals 65', () => {
19+
expect(add('6', 5)).toBe('65');
20+
});
2221

23-
test('Adding 7 equals 8', () => {
24-
expect(add(7)).toBe(8);
25-
});
26-
27-
test('Adding -1 + 6 equals 5', () => {
28-
expect(add(-1, 6)).toBe(5);
29-
});
22+
test('Adding 7 equals 8', () => {
23+
expect(add(7)).toBe(8);
24+
});
3025

26+
test('Adding -1 + 6 equals 5', () => {
27+
expect(add(-1, 6)).toBe(5);
28+
});
3129
});
3230

3331
test('Date modification', () => {

src/components/common/ErrorBoundary.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ export default class ErrorBoundary extends Component {
2323
// You can render any custom fallback UI
2424
return (
2525
<div className="center">
26-
<h1 className="center p-20 warn gr-bc">
27-
Sorry something went wrong.
28-
</h1>
26+
<h1 className="center p-20 warn gr-bc">Sorry something went wrong.</h1>
2927
{/* <Link to="/logout">Logout</Link> */}
3028
</div>
3129
);

src/components/common/HeadNavbar.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ export default function HeadNavbar() {
1717
<Row justify="end" align="center">
1818
<Col span={24}>
1919
<Menu onClick={handleClick} mode="horizontal">
20-
<SubMenu
21-
icon={<UserOutlined />}
22-
title="Profile"
23-
style={{ float: 'right' }}
24-
>
20+
<SubMenu icon={<UserOutlined />} title="Profile" style={{ float: 'right' }}>
2521
<Menu.Item icon={<LogoutOutlined />} key="logout">
2622
Logout
2723
</Menu.Item>

src/components/common/Loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function Loader() {
99
const defaultOptions = {
1010
loop: true,
1111
autoplay: true,
12-
animationData: animationData,
12+
animationData,
1313
rendererSettings: {
1414
preserveAspectRatio: 'xMidYMid slice',
1515
},

src/components/routes/AuthRoute.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ function AuthRoute({ children, ...rest }) {
1111
}}
1212
/>
1313
);
14-
} else {
15-
return <Route {...rest}>{children}</Route>;
1614
}
15+
return <Route {...rest}>{children}</Route>;
1716
}
1817

1918
export default AuthRoute;

src/components/routes/PrivateRoute.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ function PrivateRoute({ children, location, ...rest }) {
1212
const dispatch = useDispatch();
1313
const { pathname } = location;
1414

15-
useEffect(() => {
16-
return () => {
15+
useEffect(
16+
() => () => {
1717
/**
1818
* to set last visited page url in redux store
1919
*/
2020
dispatch({
2121
type: 'SET_HISTORY_RECENT',
2222
payload: pathname,
2323
});
24-
};
24+
},
2525
// eslint-disable-next-line react-hooks/exhaustive-deps
26-
}, [pathname]);
26+
[pathname]
27+
);
2728

2829
if (SESSION.isLoggedIn()) {
2930
return (
@@ -37,9 +38,8 @@ function PrivateRoute({ children, location, ...rest }) {
3738
</Content>
3839
</Layout>
3940
);
40-
} else {
41-
SESSION.logout();
4241
}
42+
SESSION.logout();
4343
}
4444

4545
export default PrivateRoute;

src/components/sidebar/Sidebar.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function Sidebar(props) {
1111
const [key, setKey] = useState();
1212

1313
useEffect(() => {
14-
let path = props.location.pathname;
14+
const path = props.location.pathname;
1515
const pathId = findUrlPathId(path);
1616
setKey(pathId);
1717
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -24,12 +24,7 @@ function Sidebar(props) {
2424
return (
2525
<Sider collapsible collapsed={collapsed} onCollapse={onCollapse}>
2626
<>
27-
<Menu
28-
theme="dark"
29-
mode="inline"
30-
defaultSelectedKeys={[key]}
31-
selectedKeys={[key]}
32-
>
27+
<Menu theme="dark" mode="inline" defaultSelectedKeys={[key]} selectedKeys={[key]}>
3328
<Menu.Item key="1">
3429
<NavLink to="/todo" />
3530
<HighlightOutlined />

src/components/todo/TodoActionControls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { TodoStatusChange, TodoDelete, TodoEdit } from '../todo';
2+
import { TodoStatusChange, TodoDelete, TodoEdit } from '.';
33

44
export default function TodoActionControls(props) {
55
return (

src/components/todo/TodoBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { TodoDate, TodoActionControls, TodoLabel } from '../todo';
2+
import { TodoDate, TodoActionControls, TodoLabel } from '.';
33

44
export default function TodoBox(props) {
55
const { data } = props;

src/components/todo/TodoDate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function TodoDate({ data }) {
77
const [date, setDate] = useState('Date not available');
88
useEffect(() => {
99
if (data.dueDate) {
10-
let date = moment(data.dueDate).format('DD MMM YYYY');
10+
const date = moment(data.dueDate).format('DD MMM YYYY');
1111
setDate(date);
1212
}
1313
}, [data]);

src/components/todo/TodoLabel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function TodoLabel({ data }) {
1010

1111
useEffect(() => {
1212
if (data) {
13-
let obj = TODO_LABEL.find((status) => status.id === data.label);
13+
const obj = TODO_LABEL.find((status) => status.id === data.label);
1414
if (obj) {
1515
setState(obj);
1616
}

src/components/todo/TodoList.js

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React, { useState, useEffect } from 'react';
22
import { useSelector } from 'react-redux';
33
import { Checkbox } from 'antd';
4-
import { API } from '../../services';
5-
import { TodoBox, TodoStatus } from '../todo';
64
import { mapValues, groupBy } from 'lodash';
5+
import { API } from '../../services';
6+
import { TodoBox, TodoStatus } from '.';
77
import { TODO_STATUS, TODO_LABEL } from '../../helpers/constants';
88

99
const CheckboxGroup = Checkbox.Group;
@@ -41,29 +41,27 @@ export default function TodoList() {
4141
/**
4242
* find label id from selected label checkboxes
4343
*/
44-
const labels = TODO_LABEL.filter((label) =>
45-
state.checkedList.includes(label.key)
46-
).map((todo) => todo.id);
44+
const labels = TODO_LABEL.filter((label) => state.checkedList.includes(label.key)).map(
45+
(todo) => todo.id
46+
);
4747

4848
/**
4949
* filter out todo based on selected labels
5050
*/
51-
let filtered = todos.filter((todo) => labels.includes(todo.label));
51+
const filtered = todos.filter((todo) => labels.includes(todo.label));
5252

5353
/**
5454
* Group the todos based on status (New, inprogress, completed)
5555
*/
56-
let grouped = mapValues(groupBy(filtered, 'status'));
56+
const grouped = mapValues(groupBy(filtered, 'status'));
5757
setGrouped(grouped);
5858
}, [todos, state]);
5959

6060
const onChange = (checkedList) => {
6161
setState({
6262
...state,
6363
checkedList,
64-
indeterminate:
65-
!!checkedList.length &&
66-
checkedList.length < plainOptions.length,
64+
indeterminate: !!checkedList.length && checkedList.length < plainOptions.length,
6765
checkAll: checkedList.length === plainOptions.length,
6866
});
6967
};
@@ -86,23 +84,14 @@ export default function TodoList() {
8684
>
8785
Select all labels
8886
</Checkbox>
89-
<CheckboxGroup
90-
options={plainOptions}
91-
value={state.checkedList}
92-
onChange={onChange}
93-
/>
87+
<CheckboxGroup options={plainOptions} value={state.checkedList} onChange={onChange} />
9488

9589
<div className="kanban">
9690
{TODO_STATUS.map((data) => (
97-
<div
98-
key={data.id}
99-
className={`kanban__group ${data.className}`}
100-
>
91+
<div key={data.id} className={`kanban__group ${data.className}`}>
10192
<TodoStatus data={data} />
10293
{grouped[data.id] &&
103-
grouped[data.id].map((todo) => (
104-
<TodoBox key={todo._id} data={todo} />
105-
))}
94+
grouped[data.id].map((todo) => <TodoBox key={todo._id} data={todo} />)}
10695
</div>
10796
))}
10897
</div>

src/components/todo/TodoStatusChange.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ export default function TodoStatusChange({ data }) {
2525

2626
const menu = (
2727
<Menu onClick={handleStatusEdit}>
28-
{TODO_STATUS.filter((todo) => todo.id !== data.status).map(
29-
(todo) => (
30-
<Menu.Item key={todo.id}>{todo.key}</Menu.Item>
31-
)
32-
)}
28+
{TODO_STATUS.filter((todo) => todo.id !== data.status).map((todo) => (
29+
<Menu.Item key={todo.id}>{todo.key}</Menu.Item>
30+
))}
3331
</Menu>
3432
);
3533

src/forms/Debug.js

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,43 @@
11
import React from 'react';
22
import { FormikConsumer } from 'formik';
33

4-
export const Debug = () => (
5-
<div
6-
style={{
7-
margin: '3rem 0',
8-
borderRadius: 4,
9-
background: '#f6f8fa',
10-
boxShadow: '0 0 1px #eee inset',
11-
}}
12-
>
4+
export function Debug() {
5+
return (
136
<div
147
style={{
15-
textTransform: 'uppercase',
16-
fontSize: 11,
17-
borderTopLeftRadius: 4,
18-
borderTopRightRadius: 4,
19-
fontWeight: 500,
20-
padding: '.5rem',
21-
background: '#555',
22-
color: '#fff',
23-
letterSpacing: '1px',
8+
margin: '3rem 0',
9+
borderRadius: 4,
10+
background: '#f6f8fa',
11+
boxShadow: '0 0 1px #eee inset',
2412
}}
25-
>
26-
Formik State
27-
</div>
28-
<FormikConsumer>
29-
{({ validationSchema, validate, onSubmit, ...rest }) => (
30-
<pre
31-
style={{
32-
fontSize: '.65rem',
33-
padding: '.25rem .5rem',
34-
overflowX: 'scroll',
35-
}}
36-
>
37-
{JSON.stringify(rest, null, 2)}
38-
</pre>
39-
)}
40-
</FormikConsumer>
41-
</div>
42-
);
13+
>
14+
<div
15+
style={{
16+
textTransform: 'uppercase',
17+
fontSize: 11,
18+
borderTopLeftRadius: 4,
19+
borderTopRightRadius: 4,
20+
fontWeight: 500,
21+
padding: '.5rem',
22+
background: '#555',
23+
color: '#fff',
24+
letterSpacing: '1px',
25+
}}
26+
>
27+
Formik State
28+
</div>
29+
<FormikConsumer>
30+
{({ validationSchema, validate, onSubmit, ...rest }) => (
31+
<pre
32+
style={{
33+
fontSize: '.65rem',
34+
padding: '.25rem .5rem',
35+
overflowX: 'scroll',
36+
}}
37+
>
38+
{JSON.stringify(rest, null, 2)}
39+
</pre>
40+
)}
41+
</FormikConsumer>
42+
</div>
43+
}

src/forms/todo/drawer.form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
22
import { useSelector, useDispatch } from 'react-redux';
33
import { Drawer, Button } from 'antd';
44
import { isEmpty } from 'lodash';
5-
import { TodoForm } from '../todo';
5+
import { TodoForm } from '.';
66
import { editTodo } from '../../store/actions/api.actions';
77

88
export default function DrawerForm() {

0 commit comments

Comments
 (0)