fix lint warnings

This commit is contained in:
Proddy
2023-04-22 10:05:13 +02:00
parent 19e8e4a7a1
commit 209afc87bb
19 changed files with 37 additions and 40 deletions

View File

@@ -1,13 +1,13 @@
import { useEffect, useState } from 'react';
import { ToastContainer, Slide } from 'react-toastify';
import type { FC } from 'react';
import 'react-toastify/dist/ReactToastify.min.css';
import { localStorageDetector } from 'typesafe-i18n/detectors';
import type { FC } from 'react';
import AppRouting from 'AppRouting';
import CustomTheme from 'CustomTheme';
import { localStorageDetector } from 'typesafe-i18n/detectors';
import TypesafeI18n from 'i18n/i18n-react';
import { detectLocale } from 'i18n/i18n-util';
import { loadLocaleAsync } from 'i18n/i18n-util.async';
@@ -18,7 +18,7 @@ const App: FC = () => {
const [wasLoaded, setWasLoaded] = useState(false);
useEffect(() => {
loadLocaleAsync(detectedLocale).then(() => setWasLoaded(true));
void loadLocaleAsync(detectedLocale).then(() => setWasLoaded(true));
}, []);
if (!wasLoaded) return null;

View File

@@ -14,12 +14,12 @@ import { ValidatedTextField } from 'components';
import { AuthenticationContext } from 'contexts/authentication';
import { ReactComponent as DEflag } from 'i18n/DE.svg';
import { ReactComponent as FRflag } from 'i18n/FR.svg';
import { ReactComponent as GBflag } from 'i18n/GB.svg';
import { ReactComponent as NLflag } from 'i18n/NL.svg';
import { ReactComponent as NOflag } from 'i18n/NO.svg';
import { ReactComponent as PLflag } from 'i18n/PL.svg';
import { ReactComponent as SVflag } from 'i18n/SV.svg';
import { ReactComponent as FRflag } from 'i18n/FR.svg';
import { ReactComponent as TRflag } from 'i18n/TR.svg';
import { I18nContext } from 'i18n/i18n-react';
import { loadLocaleAsync } from 'i18n/i18n-util.async';
@@ -63,7 +63,7 @@ const SignIn: FC = () => {
});
try {
await validate(SIGN_IN_REQUEST_VALIDATOR, signInRequest);
signIn();
void signIn();
} catch (errors: any) {
setFieldErrors(errors);
setProcessing(false);

View File

@@ -57,7 +57,7 @@ const Authentication: FC<RequiredChildrenProps> = ({ children }) => {
}, []);
useEffect(() => {
refresh();
void refresh();
}, [refresh]);
if (initialized) {

View File

@@ -23,7 +23,7 @@ const FeaturesLoader: FC<RequiredChildrenProps> = (props) => {
}, []);
useEffect(() => {
loadFeatures();
void loadFeatures();
}, [loadFeatures]);
if (features) {

View File

@@ -49,7 +49,7 @@ const APSettingsForm: FC = () => {
try {
setFieldErrors(undefined);
await validate(createAPSettingsValidator(data), data);
saveData();
void saveData();
} catch (errors: any) {
setFieldErrors(errors);
}

View File

@@ -43,7 +43,7 @@ const MqttSettingsForm: FC = () => {
try {
setFieldErrors(undefined);
await validate(createMqttSettingsValidator(data), data);
saveData();
void saveData();
} catch (errors: any) {
setFieldErrors(errors);
}

View File

@@ -19,10 +19,12 @@ import {
} from '@mui/material';
import { useContext, useEffect, useState } from 'react';
import { toast } from 'react-toastify';
import RestartMonitor from '../system/RestartMonitor';
import { WiFiConnectionContext } from './WiFiConnectionContext';
import { isNetworkOpen, networkSecurityMode } from './WiFiNetworkSelector';
import type { ValidateFieldsError } from 'async-validator';
import type { FC } from 'react';
import type { NetworkSettings } from 'types';
import * as NetworkApi from 'api/network';
import {
@@ -39,14 +41,9 @@ import { useI18nContext } from 'i18n/i18n-react';
import * as EMSESP from 'project/api';
import { numberValue, updateValueDirty, useRest } from 'utils';
import { WiFiConnectionContext } from './WiFiConnectionContext';
import { isNetworkOpen, networkSecurityMode } from './WiFiNetworkSelector';
import type { ValidateFieldsError } from 'async-validator';
import { validate } from 'validators';
import { createNetworkSettingsValidator } from 'validators/network';
import RestartMonitor from '../system/RestartMonitor';
const WiFiSettingsForm: FC = () => {
const { LL } = useI18nContext();
@@ -107,7 +104,7 @@ const WiFiSettingsForm: FC = () => {
try {
setFieldErrors(undefined);
await validate(createNetworkSettingsValidator(data), data);
saveData();
void saveData();
} catch (errors: any) {
setFieldErrors(errors);
}

View File

@@ -75,7 +75,7 @@ const WiFiNetworkScanner: FC = () => {
}, [finishedWithError, pollNetworkList, LL]);
useEffect(() => {
startNetworkScan();
void startNetworkScan();
}, [startNetworkScan]);
const renderNetworkScanner = () => {

View File

@@ -43,7 +43,7 @@ const NTPSettingsForm: FC = () => {
try {
setFieldErrors(undefined);
await validate(NTP_SETTINGS_VALIDATOR, data);
saveData();
void saveData();
} catch (errors: any) {
setFieldErrors(errors);
}

View File

@@ -90,7 +90,7 @@ const NTPStatusForm: FC = () => {
});
toast.success(LL.TIME_SET());
setSettingTime(false);
loadData();
void loadData();
} catch (error) {
toast.error(extractErrorMessage(error, LL.PROBLEM_UPDATING()));
} finally {

View File

@@ -42,7 +42,7 @@ const GenerateToken: FC<GenerateTokenProps> = ({ username, onClose }) => {
useEffect(() => {
if (open) {
getToken();
void getToken();
}
}, [open, getToken]);

View File

@@ -123,7 +123,7 @@ const ManageUsersForm: FC = () => {
const onSubmit = async () => {
await saveData();
authenticatedContext.refresh();
void authenticatedContext.refresh();
};
const user_table = data.users.map((u) => ({ ...u, id: u.username }));

View File

@@ -45,7 +45,7 @@ const OTASettingsForm: FC = () => {
try {
setFieldErrors(undefined);
await validate(OTA_SETTINGS_VALIDATOR, data);
saveData();
void saveData();
} catch (errors: any) {
setFieldErrors(errors);
}

View File

@@ -31,7 +31,7 @@ const RestartMonitor: FC = () => {
});
useEffect(() => {
poll.current();
void poll.current();
}, []);
useEffect(() => () => timeoutId && clearTimeout(timeoutId), [timeoutId]);

View File

@@ -117,7 +117,7 @@ const SystemLog: FC = () => {
...data,
level: parseInt(event.target.value)
});
sendSettings(data.max_messages, parseInt(event.target.value));
void sendSettings(data.max_messages, parseInt(event.target.value));
}
};
@@ -163,7 +163,7 @@ const SystemLog: FC = () => {
}, [LL]);
useEffect(() => {
fetchLog();
void fetchLog();
}, [fetchLog]);
useEffect(() => {

View File

@@ -1,16 +1,16 @@
import AppsIcon from '@mui/icons-material/Apps';
import RefreshIcon from '@mui/icons-material/Refresh';
import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNew';
import SettingsBackupRestoreIcon from '@mui/icons-material/SettingsBackupRestore';
import BuildIcon from '@mui/icons-material/Build';
import TimerIcon from '@mui/icons-material/Timer';
import CancelIcon from '@mui/icons-material/Cancel';
import DevicesIcon from '@mui/icons-material/Devices';
import FolderIcon from '@mui/icons-material/Folder';
import MemoryIcon from '@mui/icons-material/Memory';
import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNew';
import RefreshIcon from '@mui/icons-material/Refresh';
import SdCardAlertIcon from '@mui/icons-material/SdCardAlert';
import SdStorageIcon from '@mui/icons-material/SdStorage';
import SettingsBackupRestoreIcon from '@mui/icons-material/SettingsBackupRestore';
import ShowChartIcon from '@mui/icons-material/ShowChart';
import TimerIcon from '@mui/icons-material/Timer';
import {
Avatar,
Box,
@@ -34,11 +34,11 @@ import { toast } from 'react-toastify';
import RestartMonitor from './RestartMonitor';
import type { FC } from 'react';
import { useI18nContext } from 'i18n/i18n-react';
import type { SystemStatus, Version } from 'types';
import * as SystemApi from 'api/system';
import { ButtonRow, FormLoader, SectionContent, MessageBox } from 'components';
import { AuthenticatedContext } from 'contexts/authentication';
import { useI18nContext } from 'i18n/i18n-react';
import { extractErrorMessage, useRest } from 'utils';
export const VERSIONCHECK_ENDPOINT = 'https://api.github.com/repos/emsesp/EMS-ESP32/releases/latest';
@@ -64,14 +64,14 @@ const SystemStatusForm: FC = () => {
const [latestDevVersion, setLatestDevVersion] = useState<Version>();
useEffect(() => {
axios.get(VERSIONCHECK_ENDPOINT).then((response) => {
void axios.get(VERSIONCHECK_ENDPOINT).then((response) => {
setLatestVersion({
version: response.data.name,
url: response.data.assets[1].browser_download_url,
changelog: response.data.assets[0].browser_download_url
});
});
axios.get(VERSIONCHECK_DEV_ENDPOINT).then((response) => {
void axios.get(VERSIONCHECK_DEV_ENDPOINT).then((response) => {
setLatestDevVersion({
version: response.data.name.split(/\s+/).splice(-1),
url: response.data.assets[1].browser_download_url,

View File

@@ -95,7 +95,7 @@ const SettingsApplication: FC = () => {
try {
setFieldErrors(undefined);
await validate(createSettingsValidator(data), data);
saveData();
void saveData();
} catch (errors: any) {
setFieldErrors(errors);
}
@@ -110,12 +110,12 @@ const SettingsApplication: FC = () => {
board_profile: boardProfile
});
} else {
updateBoardProfile(boardProfile);
void updateBoardProfile(boardProfile);
}
};
const restart = async () => {
validateAndSubmit();
void validateAndSubmit();
try {
await EMSESP.restart();
setRestarting(true);

View File

@@ -190,7 +190,7 @@ const SettingsCustomization: FC = () => {
};
useEffect(() => {
fetchDevices();
void fetchDevices();
}, [fetchDevices]);
function formatValue(value: any) {
@@ -266,7 +266,7 @@ const SettingsCustomization: FC = () => {
const selected_device = parseInt(event.target.value, 10);
setSelectedDevice(selected_device);
setNumChanges(0);
fetchDeviceEntities(devices?.devices[selected_device].i);
void fetchDeviceEntities(devices?.devices[selected_device].i);
setRestartNeeded(false);
}
};

View File

@@ -72,7 +72,7 @@ export const useRest = <D>({ read, update }: RestRequestOptions<D>) => {
const saveData = () => data && save(data);
useEffect(() => {
loadData();
void loadData();
}, [loadData]);
return {