Skip to content

Commit f6ff605

Browse files
committed
2321: Added max-warnings to check coding standards
1 parent bb5a05e commit f6ff605

File tree

11 files changed

+41
-12
lines changed

11 files changed

+41
-12
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
"vite": "^5.2.11"
4949
},
5050
"scripts": {
51-
"lint:js": "eslint --ext .js --ext .jsx ./src",
51+
"lint:js": "eslint --ext .js --ext .jsx ./src --max-warnings=0",
5252
"lint:js:fix": "eslint --ext .js --ext .jsx --fix ./src",
53-
"lint:scss": "stylelint \"./src/**/*.scss\"",
53+
"lint:scss": "stylelint \"./src/**/*.scss\" --max-warnings=0",
5454
"lint:scss:fix": "stylelint --fix \"./src/**/*.scss\"",
5555
"check-coding-standards": "yarn lint:js && yarn lint:scss",
5656
"apply-coding-standards": "yarn lint:js:fix && yarn lint:scss:fix",

src/components/feed-sources/templates/calendar-api-feed-type.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { React, useEffect, useState } from "react";
22
import PropTypes from "prop-types";
33
import { useTranslation } from "react-i18next";
4-
import MultiselectFromEndpoint from "../../slide/content/multiselect-from-endpoint";
54
import { Alert } from "react-bootstrap";
5+
import MultiselectFromEndpoint from "../../slide/content/multiselect-from-endpoint";
66
import ConfigLoader from "../../../config-loader";
77

88
const CalendarApiFeedType = ({

src/components/slide/content/poster-selector.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ function PosterSelector({
338338
setSingleSelectedOccurrence(null);
339339
};
340340

341+
/* eslint-disable jsx-a11y/control-has-associated-label */
341342
return (
342343
<Card className="mb-3">
343344
<Card.Body>
@@ -886,6 +887,7 @@ function PosterSelector({
886887
</Card.Body>
887888
</Card>
888889
);
890+
/* eslint-enable jsx-a11y/control-has-associated-label */
889891
}
890892

891893
PosterSelector.propTypes = {

src/components/slide/content/station/station-selector.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ function StationSelector({
4848
const onFilter = (filter) => {
4949
setSearchText(filter);
5050
};
51+
5152
/**
52-
* Map the data recieved from the midttrafik api.
53+
* Map the data received from the midttrafik api.
5354
*
54-
* @param {object} locationData
55+
* @param {Array} locationData The input location data.
5556
* @returns {Array} The mapped data.
5657
*/
5758
const mapLocationData = (locationData) => {
@@ -63,6 +64,7 @@ function StationSelector({
6364

6465
useEffect(() => {
6566
if (!config?.rejseplanenApiKey) {
67+
// eslint-disable-next-line no-console
6668
console.error("rejseplanenApiKey not set.");
6769
return;
6870
}

src/components/util/date-value.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { React } from "react";
21
import PropTypes from "prop-types";
32
import dayjs from "dayjs";
43

src/components/util/drag-and-drop-table/drag-and-drop-table.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ function DragAndDropTable({
106106
});
107107

108108
/* eslint-disable react/jsx-props-no-spreading */
109+
/* eslint-disable jsx-a11y/control-has-associated-label */
109110
return (
110111
<div className="table-responsive">
111112
<Table id="drag-and-drop-table">
@@ -168,6 +169,8 @@ function DragAndDropTable({
168169
<small id="aria-label-for-drag-and-drop">{t("help-text")}</small>
169170
</div>
170171
);
172+
/* eslint-enable react/jsx-props-no-spreading */
173+
/* eslint-enable jsx-a11y/control-has-associated-label */
171174
}
172175

173176
DragAndDropTable.propTypes = {

src/components/util/forms/checkbox-options.jsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { React } from "react";
2+
import PropTypes from "prop-types";
23

34
/**
4-
* @param root0
5-
* @param root0.formData
6-
* @param root0.data
7-
* @param root0.onChange
5+
* @param {object} props The props.
6+
* @param {object} props.formData The form data.
7+
* @param {object} props.data The data.
8+
* @param {Function} props.onChange On change callback.
9+
* @returns {React.JSX} The component.
810
*/
911
function CheckboxOptions({ formData, data, onChange }) {
1012
const values = data[formData.name] ?? [];
@@ -47,4 +49,19 @@ function CheckboxOptions({ formData, data, onChange }) {
4749
);
4850
}
4951

52+
CheckboxOptions.propTypes = {
53+
formData: PropTypes.shape({
54+
name: PropTypes.string,
55+
formGroupClasses: PropTypes.string,
56+
options: PropTypes.arrayOf(
57+
PropTypes.shape({
58+
value: PropTypes.string.isRequired,
59+
title: PropTypes.string.isRequired,
60+
})
61+
),
62+
}),
63+
onChange: PropTypes.func.isRequired,
64+
data: PropTypes.shape({}),
65+
};
66+
5067
export default CheckboxOptions;

src/components/util/forms/form-input-area.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function FormInputArea({
4343

4444
FormInputArea.propTypes = {
4545
name: PropTypes.string.isRequired,
46+
formGroupClasses: PropTypes.string,
4647
label: PropTypes.string.isRequired,
4748
placeholder: PropTypes.string,
4849
value: PropTypes.string,

src/components/util/forms/multiselect-dropdown/multi-dropdown.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import "./multi-dropdown.scss";
2626
* @param {Function} props.filterCallback - The callback on search filter.
2727
* @param {boolean} props.singleSelect - If the dropdown is single select.
2828
* @param {boolean} props.disableSearch - Disable search option.
29-
* @param props.error
29+
* @param {boolean} props.error - Error.
3030
* @returns {object} - The multidropdown
3131
*/
3232
function MultiSelectComponent({

src/components/util/forms/select.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Tooltip } from "react-tooltip";
2020
* @param {boolean} props.isRequired If the select is required.
2121
* @param {boolean} props.allowNull Add null option.
2222
* @param {string | null} props.tooltip Tooltip text. Does not display if null.
23-
* @param props.disabled
23+
* @param {boolean | null} props.disabled Disable the select.
2424
* @returns {object} The select component.
2525
*/
2626
function Select({
@@ -104,6 +104,7 @@ function Select({
104104
{error && <div className="invalid-feedback">{textOnError}</div>}
105105
</FormGroup>
106106
);
107+
/* eslint-enable jsx-a11y/anchor-is-valid */
107108
}
108109

109110
Select.propTypes = {
@@ -113,6 +114,8 @@ Select.propTypes = {
113114
title: PropTypes.string.isRequired,
114115
})
115116
).isRequired,
117+
disabled: PropTypes.bool,
118+
tooltip: PropTypes.string,
116119
errors: PropTypes.arrayOf(PropTypes.string),
117120
label: PropTypes.string.isRequired,
118121
name: PropTypes.string.isRequired,

0 commit comments

Comments
 (0)