From 61ff82ca2653d4cdf57b0de4a83820407a547266 Mon Sep 17 00:00:00 2001 From: Aleksandr Gumroian Date: Thu, 6 Jun 2024 16:57:08 +0200 Subject: [PATCH] Fix linting issues --- src/api/hooks.js | 13 ++++-- src/bootstrap/Alert.js | 1 + src/bootstrap/Button.js | 1 + src/bootstrap/CheckBox.js | 1 + src/bootstrap/CopyInput.js | 2 + src/bootstrap/DataTimeInput.js | 7 +-- src/bootstrap/DownloadButton.js | 1 + src/bootstrap/EmailInput.js | 5 ++- src/bootstrap/FileInput.js | 1 + src/bootstrap/Input.js | 7 ++- src/bootstrap/Modal.js | 3 +- src/bootstrap/NumberInput.js | 3 +- src/bootstrap/PasswordInput.js | 1 + src/bootstrap/RadioSet.js | 43 +++++++++---------- src/bootstrap/Select.js | 1 + src/bootstrap/Spinner.js | 1 + src/bootstrap/Switch.js | 1 + src/bootstrap/TextInput.js | 5 ++- src/common/RebootButton.js | 4 +- src/common/WiFiSettings/ResetWiFiSettings.js | 7 +-- src/common/WiFiSettings/WiFiForm.js | 14 +++--- src/common/WiFiSettings/WiFiGuestForm.js | 9 ++-- src/common/WiFiSettings/WiFiQRCode.js | 9 ++-- src/common/WiFiSettings/WiFiSettings.js | 5 ++- src/context/alertContext/AlertContext.js | 1 + .../CustomizationContext.js | 4 +- src/form/components/ForisForm.js | 10 ++--- src/form/components/SubmitButton.js | 1 + src/form/hooks.js | 1 + src/utils/ErrorMessage.js | 1 + src/utils/conditionalHOCs.js | 17 ++++---- src/utils/validations.js | 9 ++-- 32 files changed, 116 insertions(+), 73 deletions(-) diff --git a/src/api/hooks.js b/src/api/hooks.js index 65a0bb1..cd50959 100644 --- a/src/api/hooks.js +++ b/src/api/hooks.js @@ -111,9 +111,7 @@ const useAPIPatch = createAPIHook("PATCH"); const useAPIPut = createAPIHook("PUT"); const useAPIDelete = createAPIHook("DELETE"); -export { useAPIGet, useAPIPost, useAPIPatch, useAPIPut, useAPIDelete }; - -export function useAPIPolling(endpoint, delay = 1000, until) { +function useAPIPolling(endpoint, until, delay = 1000) { // delay ms const [state, setState] = useState({ state: API_STATE.INIT }); const [getResponse, get] = useAPIGet(endpoint); @@ -133,3 +131,12 @@ export function useAPIPolling(endpoint, delay = 1000, until) { return [state]; } + +export { + useAPIGet, + useAPIPost, + useAPIPatch, + useAPIPut, + useAPIDelete, + useAPIPolling, +}; diff --git a/src/bootstrap/Alert.js b/src/bootstrap/Alert.js index b6a4860..7eb7721 100644 --- a/src/bootstrap/Alert.js +++ b/src/bootstrap/Alert.js @@ -6,6 +6,7 @@ */ import React from "react"; + import PropTypes from "prop-types"; export const ALERT_TYPES = Object.freeze({ diff --git a/src/bootstrap/Button.js b/src/bootstrap/Button.js index 5817f3a..f2031e7 100644 --- a/src/bootstrap/Button.js +++ b/src/bootstrap/Button.js @@ -6,6 +6,7 @@ */ import React from "react"; + import PropTypes from "prop-types"; Button.propTypes = { diff --git a/src/bootstrap/CheckBox.js b/src/bootstrap/CheckBox.js index 890e8b7..8bd3be6 100644 --- a/src/bootstrap/CheckBox.js +++ b/src/bootstrap/CheckBox.js @@ -6,6 +6,7 @@ */ import React from "react"; + import PropTypes from "prop-types"; import { useUID } from "react-uid"; diff --git a/src/bootstrap/CopyInput.js b/src/bootstrap/CopyInput.js index c87329b..072ed1a 100644 --- a/src/bootstrap/CopyInput.js +++ b/src/bootstrap/CopyInput.js @@ -6,7 +6,9 @@ */ import React, { useState, useRef } from "react"; + import PropTypes from "prop-types"; + import { Input } from "./Input"; CopyInput.propTypes = { diff --git a/src/bootstrap/DataTimeInput.js b/src/bootstrap/DataTimeInput.js index 558ec17..9b40b9e 100644 --- a/src/bootstrap/DataTimeInput.js +++ b/src/bootstrap/DataTimeInput.js @@ -6,9 +6,10 @@ */ import React from "react"; + +import moment from "moment/moment"; import PropTypes from "prop-types"; import Datetime from "react-datetime"; -import moment from "moment/moment"; import "react-datetime/css/react-datetime.css"; import "./DataTimeInput.css"; @@ -46,13 +47,13 @@ export function DataTimeInput({ children, ...props }) { - function renderInput(datetimeProps) { + const renderInput = (datetimeProps) => { return ( {children} ); - } + }; return ( ; +export function EmailInput({ ...props }) { + return ; +} EmailInput.propTypes = { /** Field label. */ diff --git a/src/bootstrap/FileInput.js b/src/bootstrap/FileInput.js index f40daed..1fe34ae 100644 --- a/src/bootstrap/FileInput.js +++ b/src/bootstrap/FileInput.js @@ -8,6 +8,7 @@ import React from "react"; import PropTypes from "prop-types"; + import { Input } from "./Input"; FileInput.propTypes = { diff --git a/src/bootstrap/Input.js b/src/bootstrap/Input.js index 32adc66..c0a52fb 100644 --- a/src/bootstrap/Input.js +++ b/src/bootstrap/Input.js @@ -6,11 +6,12 @@ */ import React, { forwardRef } from "react"; -import { useUID } from "react-uid"; + import PropTypes from "prop-types"; +import { useUID } from "react-uid"; /** Base bootstrap input component. */ -export const Input = forwardRef( +const Input = forwardRef( ( { type, @@ -73,3 +74,5 @@ Input.propTypes = { labelClassName: PropTypes.string, groupClassName: PropTypes.string, }; + +export { Input }; diff --git a/src/bootstrap/Modal.js b/src/bootstrap/Modal.js index 6ba1d7c..0c1a049 100644 --- a/src/bootstrap/Modal.js +++ b/src/bootstrap/Modal.js @@ -6,10 +6,11 @@ */ import React, { useRef, useEffect } from "react"; + import PropTypes from "prop-types"; -import { Portal } from "../utils/Portal"; import { useClickOutside } from "../utils/hooks"; +import { Portal } from "../utils/Portal"; import "./Modal.css"; Modal.propTypes = { diff --git a/src/bootstrap/NumberInput.js b/src/bootstrap/NumberInput.js index 9ba90da..69bb6d2 100644 --- a/src/bootstrap/NumberInput.js +++ b/src/bootstrap/NumberInput.js @@ -6,10 +6,11 @@ */ import React from "react"; + import PropTypes from "prop-types"; -import { useConditionalTimeout } from "../utils/hooks"; import { Input } from "./Input"; +import { useConditionalTimeout } from "../utils/hooks"; import "./NumberInput.css"; NumberInput.propTypes = { diff --git a/src/bootstrap/PasswordInput.js b/src/bootstrap/PasswordInput.js index 81525f4..a6ba557 100644 --- a/src/bootstrap/PasswordInput.js +++ b/src/bootstrap/PasswordInput.js @@ -6,6 +6,7 @@ */ import React, { useState } from "react"; + import PropTypes from "prop-types"; import { Input } from "./Input"; diff --git a/src/bootstrap/RadioSet.js b/src/bootstrap/RadioSet.js index e549ebc..0dc58d1 100644 --- a/src/bootstrap/RadioSet.js +++ b/src/bootstrap/RadioSet.js @@ -6,6 +6,7 @@ */ import React from "react"; + import PropTypes from "prop-types"; import { useUID } from "react-uid"; @@ -94,27 +95,25 @@ Radio.propTypes = { export function Radio({ label, id, helpText, inline, ...props }) { return ( - <> -
- - -
- +
+ + +
); } diff --git a/src/bootstrap/Select.js b/src/bootstrap/Select.js index b79297e..ea1cf57 100644 --- a/src/bootstrap/Select.js +++ b/src/bootstrap/Select.js @@ -6,6 +6,7 @@ */ import React from "react"; + import PropTypes from "prop-types"; import { useUID } from "react-uid"; diff --git a/src/bootstrap/Spinner.js b/src/bootstrap/Spinner.js index 0042154..dd9162d 100644 --- a/src/bootstrap/Spinner.js +++ b/src/bootstrap/Spinner.js @@ -6,6 +6,7 @@ */ import React from "react"; + import PropTypes from "prop-types"; import "./Spinner.css"; diff --git a/src/bootstrap/Switch.js b/src/bootstrap/Switch.js index de10cc8..10925ea 100644 --- a/src/bootstrap/Switch.js +++ b/src/bootstrap/Switch.js @@ -6,6 +6,7 @@ */ import React from "react"; + import PropTypes from "prop-types"; import { useUID } from "react-uid"; diff --git a/src/bootstrap/TextInput.js b/src/bootstrap/TextInput.js index be60bb6..3c79670 100644 --- a/src/bootstrap/TextInput.js +++ b/src/bootstrap/TextInput.js @@ -6,11 +6,14 @@ */ import React from "react"; + import PropTypes from "prop-types"; import { Input } from "./Input"; -export const TextInput = ({ ...props }) => ; +export function TextInput({ ...props }) { + return ; +} TextInput.propTypes = { /** Field label. */ diff --git a/src/common/RebootButton.js b/src/common/RebootButton.js index 4dceb46..d91a10f 100644 --- a/src/common/RebootButton.js +++ b/src/common/RebootButton.js @@ -6,15 +6,15 @@ */ import React, { useState, useEffect } from "react"; + import PropTypes from "prop-types"; import { useAPIPost } from "../api/hooks"; import { API_STATE } from "../api/utils"; -import { ForisURLs } from "../utils/forisUrls"; - import { Button } from "../bootstrap/Button"; import { Modal, ModalHeader, ModalBody, ModalFooter } from "../bootstrap/Modal"; import { useAlert } from "../context/alertContext/AlertContext"; +import { ForisURLs } from "../utils/forisUrls"; export function RebootButton(props) { const [triggered, setTriggered] = useState(false); diff --git a/src/common/WiFiSettings/ResetWiFiSettings.js b/src/common/WiFiSettings/ResetWiFiSettings.js index 1002922..fcff371 100644 --- a/src/common/WiFiSettings/ResetWiFiSettings.js +++ b/src/common/WiFiSettings/ResetWiFiSettings.js @@ -6,14 +6,15 @@ */ import React, { useEffect, useState } from "react"; + import PropTypes from "prop-types"; -import { Button } from "../../bootstrap/Button"; -import { useAlert } from "../../context/alertContext/AlertContext"; -import { ALERT_TYPES } from "../../bootstrap/Alert"; import { useAPIPost } from "../../api/hooks"; import { API_STATE } from "../../api/utils"; +import { ALERT_TYPES } from "../../bootstrap/Alert"; +import { Button } from "../../bootstrap/Button"; import { formFieldsSize } from "../../bootstrap/constants"; +import { useAlert } from "../../context/alertContext/AlertContext"; ResetWiFiSettings.propTypes = { ws: PropTypes.object.isRequired, diff --git a/src/common/WiFiSettings/WiFiForm.js b/src/common/WiFiSettings/WiFiForm.js index 8445c7f..035e149 100644 --- a/src/common/WiFiSettings/WiFiForm.js +++ b/src/common/WiFiSettings/WiFiForm.js @@ -6,15 +6,17 @@ */ import React from "react"; + import PropTypes from "prop-types"; -import { Switch } from "../../bootstrap/Switch"; + +import { HELP_TEXTS, HTMODES, HWMODES, ENCRYPTIONMODES } from "./constants"; +import WifiGuestForm from "./WiFiGuestForm"; +import WiFiQRCode from "./WiFiQRCode"; import { PasswordInput } from "../../bootstrap/PasswordInput"; import { RadioSet } from "../../bootstrap/RadioSet"; import { Select } from "../../bootstrap/Select"; +import { Switch } from "../../bootstrap/Switch"; import { TextInput } from "../../bootstrap/TextInput"; -import WiFiQRCode from "./WiFiQRCode"; -import WifiGuestForm from "./WiFiGuestForm"; -import { HELP_TEXTS, HTMODES, HWMODES, ENCRYPTIONMODES } from "./constants"; WiFiForm.propTypes = { formData: PropTypes.shape({ devices: PropTypes.arrayOf(PropTypes.object) }) @@ -267,8 +269,8 @@ function getChannelChoices(device) { channelChoices[availableChannel.number.toString()] = ` ${availableChannel.number} (${availableChannel.frequency} MHz ${ - availableChannel.radar ? " ,DFS" : "" - }) + availableChannel.radar ? " ,DFS" : "" + }) `; }); }); diff --git a/src/common/WiFiSettings/WiFiGuestForm.js b/src/common/WiFiSettings/WiFiGuestForm.js index 7ae88c0..9c4de8d 100644 --- a/src/common/WiFiSettings/WiFiGuestForm.js +++ b/src/common/WiFiSettings/WiFiGuestForm.js @@ -6,13 +6,14 @@ */ import React from "react"; + import PropTypes from "prop-types"; -import { TextInput } from "../../bootstrap/TextInput"; -import { Switch } from "../../bootstrap/Switch"; -import { PasswordInput } from "../../bootstrap/PasswordInput"; -import WiFiQRCode from "./WiFiQRCode"; import { HELP_TEXTS } from "./constants"; +import WiFiQRCode from "./WiFiQRCode"; +import { PasswordInput } from "../../bootstrap/PasswordInput"; +import { Switch } from "../../bootstrap/Switch"; +import { TextInput } from "../../bootstrap/TextInput"; WifiGuestForm.propTypes = { formData: PropTypes.shape({ diff --git a/src/common/WiFiSettings/WiFiQRCode.js b/src/common/WiFiSettings/WiFiQRCode.js index 24519c4..319e0ae 100644 --- a/src/common/WiFiSettings/WiFiQRCode.js +++ b/src/common/WiFiSettings/WiFiQRCode.js @@ -6,10 +6,11 @@ */ import React, { useState } from "react"; -import QRCode from "qrcode.react"; -import PropTypes from "prop-types"; -import { ForisURLs } from "../../utils/forisUrls"; +import PropTypes from "prop-types"; +import QRCode from "qrcode.react"; + +import { createAndDownloadPdf, toQRCodeContent } from "./qrCodeHelpers"; import { Button } from "../../bootstrap/Button"; import { Modal, @@ -17,7 +18,7 @@ import { ModalFooter, ModalHeader, } from "../../bootstrap/Modal"; -import { createAndDownloadPdf, toQRCodeContent } from "./qrCodeHelpers"; +import { ForisURLs } from "../../utils/forisUrls"; WiFiQRCode.propTypes = { SSID: PropTypes.string.isRequired, diff --git a/src/common/WiFiSettings/WiFiSettings.js b/src/common/WiFiSettings/WiFiSettings.js index 217e242..8a95352 100644 --- a/src/common/WiFiSettings/WiFiSettings.js +++ b/src/common/WiFiSettings/WiFiSettings.js @@ -6,11 +6,12 @@ */ import React from "react"; + import PropTypes from "prop-types"; -import { ForisForm } from "../../form/components/ForisForm"; -import WiFiForm from "./WiFiForm"; import { ResetWiFiSettings } from "./ResetWiFiSettings"; +import WiFiForm from "./WiFiForm"; +import { ForisForm } from "../../form/components/ForisForm"; WiFiSettings.propTypes = { ws: PropTypes.object.isRequired, diff --git a/src/context/alertContext/AlertContext.js b/src/context/alertContext/AlertContext.js index 82f18de..23d092a 100644 --- a/src/context/alertContext/AlertContext.js +++ b/src/context/alertContext/AlertContext.js @@ -6,6 +6,7 @@ */ import React, { useState, useContext, useCallback } from "react"; + import PropTypes from "prop-types"; import { Alert, ALERT_TYPES } from "../../bootstrap/Alert"; diff --git a/src/context/customizationContext/CustomizationContext.js b/src/context/customizationContext/CustomizationContext.js index 9b7bc12..6dffe15 100644 --- a/src/context/customizationContext/CustomizationContext.js +++ b/src/context/customizationContext/CustomizationContext.js @@ -6,12 +6,12 @@ */ import React, { useContext, useEffect } from "react"; + import PropTypes from "prop-types"; import { useAPIGet } from "../../api/hooks"; -import { ForisURLs } from "../../utils/forisUrls"; - import { Spinner } from "../../bootstrap/Spinner"; +import { ForisURLs } from "../../utils/forisUrls"; CustomizationContextProvider.propTypes = { children: PropTypes.oneOfType([ diff --git a/src/form/components/ForisForm.js b/src/form/components/ForisForm.js index 3a36961..40ae6d9 100644 --- a/src/form/components/ForisForm.js +++ b/src/form/components/ForisForm.js @@ -6,19 +6,19 @@ */ import React, { useEffect } from "react"; + import PropTypes from "prop-types"; import { Prompt } from "react-router-dom"; -import { ALERT_TYPES } from "../../bootstrap/Alert"; +import { STATES as SUBMIT_BUTTON_STATES, SubmitButton } from "./SubmitButton"; +import { useAPIPost } from "../../api/hooks"; import { API_STATE } from "../../api/utils"; +import { ALERT_TYPES } from "../../bootstrap/Alert"; import { formFieldsSize } from "../../bootstrap/constants"; import { Spinner } from "../../bootstrap/Spinner"; import { useAlert } from "../../context/alertContext/AlertContext"; -import { useAPIPost } from "../../api/hooks"; - -import { useForisModule, useForm } from "../hooks"; -import { STATES as SUBMIT_BUTTON_STATES, SubmitButton } from "./SubmitButton"; import { ErrorMessage } from "../../utils/ErrorMessage"; +import { useForisModule, useForm } from "../hooks"; ForisForm.propTypes = { /** Optional WebSocket object. See `scr/common/WebSockets.js`. diff --git a/src/form/components/SubmitButton.js b/src/form/components/SubmitButton.js index 1f4f150..7a8f168 100644 --- a/src/form/components/SubmitButton.js +++ b/src/form/components/SubmitButton.js @@ -6,6 +6,7 @@ */ import React from "react"; + import PropTypes from "prop-types"; import { Button } from "../../bootstrap/Button"; diff --git a/src/form/hooks.js b/src/form/hooks.js index 23c436a..c53c5a9 100644 --- a/src/form/hooks.js +++ b/src/form/hooks.js @@ -6,6 +6,7 @@ */ import { useCallback, useEffect, useReducer } from "react"; + import update from "immutability-helper"; import { useAPIGet } from "../api/hooks"; diff --git a/src/utils/ErrorMessage.js b/src/utils/ErrorMessage.js index acb5c97..1b394d8 100644 --- a/src/utils/ErrorMessage.js +++ b/src/utils/ErrorMessage.js @@ -6,6 +6,7 @@ */ import React from "react"; + import PropTypes from "prop-types"; ErrorMessage.propTypes = { diff --git a/src/utils/conditionalHOCs.js b/src/utils/conditionalHOCs.js index 3298f81..4ad6d83 100644 --- a/src/utils/conditionalHOCs.js +++ b/src/utils/conditionalHOCs.js @@ -7,17 +7,18 @@ import React from "react"; -import { Spinner } from "../bootstrap/Spinner"; -import { API_STATE } from "../api/utils"; import { ErrorMessage } from "./ErrorMessage"; +import { API_STATE } from "../api/utils"; +import { Spinner } from "../bootstrap/Spinner"; function withEither(conditionalFn, Either) { - return (Component) => (props) => { - if (conditionalFn(props)) { - return ; - } - return ; - }; + return (Component) => + function (props) { + if (conditionalFn(props)) { + return ; + } + return ; + }; } // Loading diff --git a/src/utils/validations.js b/src/utils/validations.js index fb358a4..cffe21d 100644 --- a/src/utils/validations.js +++ b/src/utils/validations.js @@ -23,12 +23,15 @@ export const ERROR_MESSAGES = { const REs = { IPv4: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, IPv6: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, - IPv6Prefix: /^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.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)*$/i, DUID: /^([0-9a-fA-F]{2}){4}([0-9a-fA-F]{2})*$/, MAC: /^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/, - MultipleEmails: /^([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+ *)( *, *[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+ *)*$/, + MultipleEmails: + /^([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+ *)( *, *[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+ *)*$/, }; const createValidator = (fieldType) => (value) => {