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

Commit d3a1243

Browse files
committed
Added ESLint's plugin:react/recommended, enabled no-unused-vars rule and fixed lint errors.
1 parent debf5a3 commit d3a1243

File tree

27 files changed

+196
-57
lines changed

27 files changed

+196
-57
lines changed

.eslintrc

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
{
2-
"extends": ["react-important-stuff", "plugin:prettier/recommended"],
3-
"parser": "babel-eslint"
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:react/recommended",
5+
"react-important-stuff",
6+
"plugin:prettier/recommended"
7+
],
8+
"parser": "babel-eslint",
9+
"rules": {
10+
"no-unused-vars": "warn"
11+
}
412
}

package-lock.json

+129
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"eslint-config-prettier": "^6.7.0",
8080
"eslint-config-react-important-stuff": "^2.0.0",
8181
"eslint-plugin-prettier": "^3.1.1",
82+
"eslint-plugin-react": "^7.23.2",
8283
"file-loader": "^6.2.0",
8384
"identity-obj-proxy": "^3.0.0",
8485
"jest": "^25.2.7",

src/components/Button/index.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Button.propTypes = {
5858
children: PT.node,
5959
className: PT.string,
6060
color: PT.oneOf(["primary"]),
61+
isSelected: PT.bool,
6162
name: PT.string,
6263
onClick: PT.func,
6364
size: PT.oneOf(["medium"]),

src/components/Checkbox/index.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ const Checkbox = ({
4848

4949
Checkbox.propTypes = {
5050
checked: PT.bool,
51+
className: PT.string,
5152
name: PT.string.isRequired,
53+
size: PT.oneOf(["medium", "small"]),
5254
onChange: PT.func.isRequired,
5355
option: PT.shape({
5456
value: PT.string.isRequired,

src/components/IconWrapper/index.jsx

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { memo } from "react";
2+
import PT from "prop-types";
23
import cn from "classnames";
34
import styles from "./styles.module.scss";
45

@@ -15,4 +16,8 @@ const IconWrapper = (props) => (
1516
<span {...props} className={cn(styles.iconWrapper, props.className)} />
1617
);
1718

19+
IconWrapper.propTypes = {
20+
className: PT.string,
21+
};
22+
1823
export default memo(IconWrapper);

src/components/Icons/ArrowSmall/index.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import styles from "./styles.module.scss";
99
*
1010
* @param {Object} props component props
1111
* @param {string} [props.className] class name added to root element
12-
* @param {() => void} props.onClick click handler
12+
* @param {() => void} [props.onClick] click handler
1313
* @param {boolean} props.isActive whether the icon is in active state
1414
* @param {'up'|'down'} [props.direction] arrow direction
1515
* @returns {JSX.Element}
@@ -27,6 +27,9 @@ const ArrowSmall = ({ className, onClick, isActive, direction = "down" }) => (
2727

2828
ArrowSmall.propTypes = {
2929
className: PT.string,
30+
isActive: PT.bool.isRequired,
31+
direction: PT.oneOf(["down", "up"]),
32+
onClick: PT.func,
3033
};
3134

3235
export default ArrowSmall;

src/components/IntegerField/index.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback } from "react";
1+
import React from "react";
22
import PT from "prop-types";
33
import cn from "classnames";
44
import styles from "./styles.module.scss";
@@ -39,6 +39,8 @@ const IntegerField = ({
3939
IntegerField.propTypes = {
4040
className: PT.string,
4141
name: PT.string.isRequired,
42+
maxValue: PT.number,
43+
minValue: PT.string,
4244
onChange: PT.func.isRequired,
4345
value: PT.number.isRequired,
4446
};

src/components/NavLink/index.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback } from "react";
1+
import React from "react";
22
import PT from "prop-types";
33
import cn from "classnames";
44
import { Link, useMatch } from "@reach/router";
@@ -30,10 +30,10 @@ const NavLink = ({ className, exact = false, icon: Icon, label, path }) => {
3030
);
3131
};
3232

33-
NavLink.ptopTypes = {
33+
NavLink.propTypes = {
3434
className: PT.string,
3535
exact: PT.bool,
36-
icon: PT.node.isRequired,
36+
icon: PT.func.isRequired,
3737
label: PT.string.isRequired,
3838
path: PT.string.isRequired,
3939
};

src/components/PageTitle/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const PageTitle = ({ className, text: title }) => (
1717

1818
PageTitle.propTypes = {
1919
className: PT.string,
20-
title: PT.string.isRequired,
20+
text: PT.string.isRequired,
2121
};
2222

2323
export default PageTitle;

src/components/Pagination/index.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,13 @@ const Pagination = ({
107107

108108
Pagination.propTypes = {
109109
className: PT.string,
110+
pageSizeClassName: PT.string,
111+
id: PT.string.isRequired,
112+
label: PT.string,
113+
pageSizeLabel: PT.string,
110114
onPageNumberClick: PT.func.isRequired,
111115
onPageSizeChange: PT.func.isRequired,
112-
options: PT.arrayOf(
116+
pageSizeOptions: PT.arrayOf(
113117
PT.shape({
114118
value: PT.oneOfType([PT.number, PT.string]).isRequired,
115119
label: PT.string.isRequired,

src/components/SearchField/index.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ const SearchField = ({
5050

5151
SearchField.propTypes = {
5252
className: PT.string,
53+
id: PT.string.isRequired,
54+
size: PT.oneOf(["medium", "small"]),
5355
name: PT.string.isRequired,
5456
onChange: PT.func.isRequired,
5557
placeholder: PT.string,

src/components/SelectField/index.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ SelectField.propTypes = {
9292
className: PT.string,
9393
id: PT.string.isRequired,
9494
label: PT.string,
95+
size: PT.oneOf(["medium", "small"]),
9596
onChange: PT.func.isRequired,
9697
options: PT.arrayOf(
9798
PT.shape({

src/components/Sidebar/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback } from "react";
1+
import React from "react";
22
import PT from "prop-types";
33
import cn from "classnames";
44
import NavMenu from "components/NavMenu";

src/components/SortingControl/index.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const SortingControl = ({ className, onChange, sortBy, value }) => {
4848
SortingControl.propTypes = {
4949
className: PT.string,
5050
onChange: PT.func.isRequired,
51+
sortBy: PT.string.isRequired,
5152
value: PT.oneOf([SORT_ORDER.ASC, SORT_ORDER.DESC, null, undefined])
5253
.isRequired,
5354
};

src/components/TextField/index.jsx

-18
This file was deleted.

src/components/TextField/styles.module.scss

-3
This file was deleted.

src/components/WeekPicker/index.jsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { forwardRef, useCallback, useRef, useState } from "react";
1+
import React, { forwardRef, useCallback, useRef } from "react";
22
import PT from "prop-types";
33
import cn from "classnames";
44
import DatePicker from "react-datepicker";
@@ -42,7 +42,7 @@ const WeekPicker = ({
4242
}, []);
4343

4444
// @ts-ignore
45-
const CustomInput = forwardRef(({ value, onClick }, ref) => (
45+
const CustomInput = forwardRef(({ onClick }, ref) => (
4646
<div
4747
ref={ref}
4848
className={styles.customInput}
@@ -89,6 +89,11 @@ const WeekPicker = ({
8989
</Button>
9090
</div>
9191
));
92+
CustomInput.displayName = "CustomInput";
93+
CustomInput.propTypes = {
94+
// @ts-ignore
95+
onClick: PT.func,
96+
};
9297

9398
return (
9499
<div className={cn(styles.container, className)}>

src/constants/workPeriods.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const PAYMENT_STATUS_MAP = {
7272
export const API_PAYMENT_STATUS_MAP = (function () {
7373
const obj = {};
7474
for (let key in PAYMENT_STATUS_MAP) {
75-
if (PAYMENT_STATUS_MAP.hasOwnProperty(key)) {
75+
if (Object.prototype.hasOwnProperty.call(PAYMENT_STATUS_MAP, key)) {
7676
obj[PAYMENT_STATUS_MAP[key]] = key;
7777
}
7878
}

0 commit comments

Comments
 (0)