From c49723056acec489765acb54bae3889ac07f25af Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Thu, 18 Apr 2024 08:18:36 -0600 Subject: refactor: bring down eslint warnings to zero (#1714) - install `@eslint-react/eslint-plugin` dependency - configure `@eslint-react/eslint-plugin` in eslint config - modernize `lint` command in `package.json` - disable or fix various reported lint issues - fix `div` being nested in `p` for settings - replace deprecated `event.keyCode` with `event.key` - update isEscKeyPress method and unit tests which used deprecated `event.keyCode` - allow `eslint` v8 as peer dependency for `@eslint-react/eslint-plugin` --- src/containers/auth/AuthReleaseNotesScreen.tsx | 1 + .../download-manager/DownloadManagerScreen.tsx | 17 +++++++---------- src/containers/settings/EditServiceScreen.tsx | 4 ++++ src/containers/settings/ReleaseNotesScreen.tsx | 18 +++++++----------- src/containers/settings/SupportScreen.tsx | 18 +++++++----------- 5 files changed, 26 insertions(+), 32 deletions(-) (limited to 'src/containers') diff --git a/src/containers/auth/AuthReleaseNotesScreen.tsx b/src/containers/auth/AuthReleaseNotesScreen.tsx index 3191ba139..eac537ad6 100644 --- a/src/containers/auth/AuthReleaseNotesScreen.tsx +++ b/src/containers/auth/AuthReleaseNotesScreen.tsx @@ -43,6 +43,7 @@ class AuthReleaseNotesScreen extends Component { intl, ); + // eslint-disable-next-line @eslint-react/no-set-state-in-component-did-mount this.setState({ data, }); diff --git a/src/containers/download-manager/DownloadManagerScreen.tsx b/src/containers/download-manager/DownloadManagerScreen.tsx index cd9686f4d..3413be37a 100644 --- a/src/containers/download-manager/DownloadManagerScreen.tsx +++ b/src/containers/download-manager/DownloadManagerScreen.tsx @@ -1,15 +1,12 @@ -import { Component, type ReactElement } from 'react'; import DownloadManager from '../../components/downloadManager/DownloadManagerDashboard'; import ErrorBoundary from '../../components/util/ErrorBoundary'; -class DownloadManagerScreen extends Component { - render(): ReactElement { - return ( - - - - ); - } -} +const DownloadManagerScreen = ({ ...props }) => { + return ( + + + + ); +}; export default DownloadManagerScreen; diff --git a/src/containers/settings/EditServiceScreen.tsx b/src/containers/settings/EditServiceScreen.tsx index dde69ef2d..f3b9b0857 100644 --- a/src/containers/settings/EditServiceScreen.tsx +++ b/src/containers/settings/EditServiceScreen.tsx @@ -141,13 +141,17 @@ class EditServiceScreen extends Component { const { action } = this.props.params; const { recipes, services } = this.props.stores; const { createService, updateService } = this.props.actions.service; + // eslint-disable-next-line no-param-reassign data.darkReaderSettings = { brightness: data.darkReaderBrightness, contrast: data.darkReaderContrast, sepia: data.darkReaderSepia, }; + // eslint-disable-next-line no-param-reassign delete data.darkReaderContrast; + // eslint-disable-next-line no-param-reassign delete data.darkReaderBrightness; + // eslint-disable-next-line no-param-reassign delete data.darkReaderSepia; const serviceData = data; diff --git a/src/containers/settings/ReleaseNotesScreen.tsx b/src/containers/settings/ReleaseNotesScreen.tsx index 482364817..3a7b8d0e9 100644 --- a/src/containers/settings/ReleaseNotesScreen.tsx +++ b/src/containers/settings/ReleaseNotesScreen.tsx @@ -1,16 +1,12 @@ -import { Component, type ReactElement } from 'react'; - import ReleaseNotes from '../../components/settings/releaseNotes/ReleaseNotesDashboard'; import ErrorBoundary from '../../components/util/ErrorBoundary'; -class ReleaseNotesScreen extends Component { - render(): ReactElement { - return ( - - - - ); - } -} +const ReleaseNotesScreen = () => { + return ( + + + + ); +}; export default ReleaseNotesScreen; diff --git a/src/containers/settings/SupportScreen.tsx b/src/containers/settings/SupportScreen.tsx index 4c50869bb..3fdb0b4df 100644 --- a/src/containers/settings/SupportScreen.tsx +++ b/src/containers/settings/SupportScreen.tsx @@ -1,16 +1,12 @@ -import { Component, type ReactElement } from 'react'; - import SupportFerdium from '../../components/settings/supportFerdium/SupportFerdiumDashboard'; import ErrorBoundary from '../../components/util/ErrorBoundary'; -class SupportScreen extends Component { - render(): ReactElement { - return ( - - - - ); - } -} +const SupportScreen = () => { + return ( + + + + ); +}; export default SupportScreen; -- cgit v1.2.3-54-g00ecf