Skip to content

Commit 0f1c85b

Browse files
committed
fix: include missing propTypes definitions and fix eslint warnings
1 parent 591bf71 commit 0f1c85b

14 files changed

+64
-1
lines changed

demo/FormExamples.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function FormExamples() {
5555
options={(formData) => {
5656
return Object.entries(formData)
5757
.filter(([key]) => key !== 'selectField3')
58-
.map(([_, value]) => value);
58+
.map(([, value]) => value);
5959
}}
6060
placeholder="Select one value"
6161
/>

demo/demo.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ ReactDOM.render(
2626
document.getElementById('root')
2727
);
2828

29+
// eslint-disable-next-line no-undef
2930
module.hot.accept();

src/forms/FormCheckbox.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ FormCheckbox.propTypes = {
2626
id: PropTypes.string.isRequired,
2727
name: PropTypes.string.isRequired,
2828
valueLabel: PropTypes.string,
29+
required: PropTypes.any,
2930
};

src/forms/FormGroup.jsx

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ function FormGroup({ children, ...props }) {
1717
);
1818
}
1919

20+
FormGroup.propTypes = {
21+
children: PropTypes.element,
22+
};
23+
2024
export function FormGroupCheckbox(props) {
2125
return (
2226
<FormGroup {...props}>
@@ -56,6 +60,7 @@ FormGroupRadio.defaultProps = {
5660
};
5761

5862
FormGroupRadio.propTypes = {
63+
id: PropTypes.string,
5964
options: PropTypes.arrayOf(PropTypes.object),
6065
inline: PropTypes.bool,
6166
};

src/forms/FormInput.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ FormInput.propTypes = {
2424
type: PropTypes.string,
2525
name: PropTypes.string.isRequired,
2626
placeholder: PropTypes.string,
27+
required: PropTypes.any,
2728
};

src/forms/FormLabel.jsx

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import React from 'react';
2+
import PropTypes from 'prop-types';
23

34
export function FormLabel({ id, label }) {
45
return <label htmlFor={id}>{label}</label>;
56
}
7+
8+
FormLabel.propTypes = {
9+
id: PropTypes.string,
10+
label: PropTypes.string,
11+
};

src/forms/FormRadio.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ FormRadio.propTypes = {
3232
name: PropTypes.string.isRequired,
3333
valueLabel: PropTypes.string,
3434
inline: PropTypes.bool,
35+
required: PropTypes.any,
36+
checkedValue: PropTypes.any,
3537
};

src/forms/FormSelect.jsx

+12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useContext } from 'react';
2+
import PropTypes from 'prop-types';
23
import { FormContext, handleInputChange } from './form-helpers';
34

45
export function FormSelect({ id, name, options, required, placeholder }) {
@@ -18,6 +19,17 @@ export function FormSelect({ id, name, options, required, placeholder }) {
1819
);
1920
}
2021

22+
FormSelect.propTypes = {
23+
id: PropTypes.string,
24+
options: PropTypes.oneOfType([
25+
PropTypes.func,
26+
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
27+
]),
28+
name: PropTypes.string.isRequired,
29+
placeholder: PropTypes.string,
30+
required: PropTypes.any,
31+
};
32+
2133
function renderOptions(options, formData) {
2234
let _options = typeof options === 'function' ? options(formData) : options;
2335

src/forms/FormSwitch.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ FormSwitch.propTypes = {
2727
name: PropTypes.string.isRequired,
2828
trueLabel: PropTypes.string,
2929
falseLabel: PropTypes.string,
30+
required: PropTypes.any,
3031
};

src/forms/FormTextarea.jsx

+3
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ FormTextarea.defaultProps = {
2222
FormTextarea.propTypes = {
2323
id: PropTypes.string,
2424
name: PropTypes.string.isRequired,
25+
required: PropTypes.any,
26+
placeholder: PropTypes.string,
27+
rows: PropTypes.number,
2528
};

src/table/Table.jsx

+15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import PropTypes from 'prop-types';
23
import { TableHead } from './TableHead';
34
import { TableBody } from './TableBody';
45
import { normalizeColumns } from './table-helpers';
@@ -47,3 +48,17 @@ Table.defaultProps = {
4748
actionLabel: 'Actions',
4849
rowClass: () => '',
4950
};
51+
52+
Table.propTypes = {
53+
actions: PropTypes.arrayOf(PropTypes.object),
54+
columns: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
55+
docs: PropTypes.arrayOf(PropTypes.object),
56+
rowClass: PropTypes.func,
57+
striped: PropTypes.bool,
58+
bordered: PropTypes.bool,
59+
hover: PropTypes.bool,
60+
small: PropTypes.bool,
61+
dark: PropTypes.bool,
62+
caption: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
63+
actionLabel: PropTypes.string,
64+
};

src/table/TableBody.jsx

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import PropTypes from 'prop-types';
23
import { getColumnClass } from './table-helpers';
34

45
export function TableBody({ columns, docs, rowClass, actions }) {
@@ -32,6 +33,13 @@ export function TableBody({ columns, docs, rowClass, actions }) {
3233
);
3334
}
3435

36+
TableBody.propTypes = {
37+
actions: PropTypes.arrayOf(PropTypes.object),
38+
columns: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
39+
docs: PropTypes.arrayOf(PropTypes.object),
40+
rowClass: PropTypes.func,
41+
};
42+
3543
function getColumnValue(doc, column, docIndex) {
3644
let rawValue = doc[column.attribute];
3745

src/table/TableHead.jsx

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import PropTypes from 'prop-types';
23
import { getColumnClass } from './table-helpers';
34

45
export function TableHead({ columns, actions, actionLabel }) {
@@ -15,3 +16,9 @@ export function TableHead({ columns, actions, actionLabel }) {
1516
</thead>
1617
);
1718
}
19+
20+
TableHead.propTypes = {
21+
actionLabel: PropTypes.string,
22+
actions: PropTypes.arrayOf(PropTypes.object),
23+
columns: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
24+
};

src/tabs/Tabs.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ Tabs.propTypes = {
5656
activeTab: PropTypes.number,
5757
onlyRenderActiveTab: PropTypes.bool,
5858
bordered: PropTypes.bool,
59+
onSelect: PropTypes.func,
5960
};

0 commit comments

Comments
 (0)