diff options
author | 2024-04-18 08:18:36 -0600 | |
---|---|---|
committer | 2024-04-18 08:18:36 -0600 | |
commit | c49723056acec489765acb54bae3889ac07f25af (patch) | |
tree | 58bea705d61a728b060e615ce514b8d4a7936c9e /src/components/settings | |
parent | feat: hide all services workspace (#1713) (diff) | |
download | ferdium-app-c49723056acec489765acb54bae3889ac07f25af.tar.gz ferdium-app-c49723056acec489765acb54bae3889ac07f25af.tar.zst ferdium-app-c49723056acec489765acb54bae3889ac07f25af.zip |
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`
Diffstat (limited to 'src/components/settings')
5 files changed, 41 insertions, 36 deletions
diff --git a/src/components/settings/SettingsLayout.tsx b/src/components/settings/SettingsLayout.tsx index 17f8c3e33..a5fa13d71 100644 --- a/src/components/settings/SettingsLayout.tsx +++ b/src/components/settings/SettingsLayout.tsx | |||
@@ -41,7 +41,7 @@ class SettingsLayout extends Component<PropsWithChildren<IProps>> { | |||
41 | } | 41 | } |
42 | 42 | ||
43 | handleKeyDown(e: KeyboardEvent): void { | 43 | handleKeyDown(e: KeyboardEvent): void { |
44 | if (isEscKeyPress(e.keyCode)) { | 44 | if (isEscKeyPress(e.key)) { |
45 | this.props.closeSettings(); | 45 | this.props.closeSettings(); |
46 | } | 46 | } |
47 | } | 47 | } |
diff --git a/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx b/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx index e874b4469..e2867ab8e 100644 --- a/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx +++ b/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx | |||
@@ -49,6 +49,7 @@ class ReleaseNotesDashboard extends Component<IProps, IState> { | |||
49 | intl, | 49 | intl, |
50 | ); | 50 | ); |
51 | 51 | ||
52 | // eslint-disable-next-line @eslint-react/no-set-state-in-component-did-mount | ||
52 | this.setState({ | 53 | this.setState({ |
53 | data, | 54 | data, |
54 | }); | 55 | }); |
diff --git a/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx b/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx index 23db7141e..4fb31d053 100644 --- a/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx +++ b/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx | |||
@@ -43,8 +43,8 @@ class ReleaseNotesLayout extends Component<IProps> { | |||
43 | ); | 43 | ); |
44 | } | 44 | } |
45 | 45 | ||
46 | handleKeyDown(e) { | 46 | handleKeyDown(e: KeyboardEvent) { |
47 | if (isEscKeyPress(e.keyCode)) { | 47 | if (isEscKeyPress(e.key)) { |
48 | this.props.actions!.ui.closeSettings(); | 48 | this.props.actions!.ui.closeSettings(); |
49 | } | 49 | } |
50 | } | 50 | } |
diff --git a/src/components/settings/settings/EditSettingsForm.tsx b/src/components/settings/settings/EditSettingsForm.tsx index 84057091d..c3e8d46a0 100644 --- a/src/components/settings/settings/EditSettingsForm.tsx +++ b/src/components/settings/settings/EditSettingsForm.tsx | |||
@@ -1087,34 +1087,34 @@ class EditSettingsForm extends Component<IProps, IState> { | |||
1087 | <H3> | 1087 | <H3> |
1088 | {intl.formatMessage(messages.subheadlineFerdiumProfile)} | 1088 | {intl.formatMessage(messages.subheadlineFerdiumProfile)} |
1089 | </H3> | 1089 | </H3> |
1090 | <p> | 1090 | |
1091 | <div className="settings__open-settings-file-container"> | 1091 | <div className="settings__open-settings-file-container"> |
1092 | <Button | 1092 | <Button |
1093 | buttonType="secondary" | 1093 | buttonType="secondary" |
1094 | label={intl.formatMessage( | 1094 | label={intl.formatMessage( |
1095 | messages.buttonOpenFerdiumProfileFolder, | 1095 | messages.buttonOpenFerdiumProfileFolder, |
1096 | )} | 1096 | )} |
1097 | className="settings__open-settings-file-button" | 1097 | className="settings__open-settings-file-button" |
1098 | onClick={() => openPath(profileFolder)} | 1098 | onClick={() => openPath(profileFolder)} |
1099 | /> | 1099 | /> |
1100 | <Button | 1100 | <Button |
1101 | buttonType="secondary" | 1101 | buttonType="secondary" |
1102 | label={intl.formatMessage( | 1102 | label={intl.formatMessage( |
1103 | messages.buttonOpenFerdiumServiceRecipesFolder, | 1103 | messages.buttonOpenFerdiumServiceRecipesFolder, |
1104 | )} | 1104 | )} |
1105 | className="settings__open-settings-file-button" | 1105 | className="settings__open-settings-file-button" |
1106 | onClick={() => openPath(recipeFolder)} | 1106 | onClick={() => openPath(recipeFolder)} |
1107 | /> | 1107 | /> |
1108 | <Button | 1108 | <Button |
1109 | buttonType="secondary" | 1109 | buttonType="secondary" |
1110 | label={intl.formatMessage( | 1110 | label={intl.formatMessage( |
1111 | messages.buttonOpenImportExport, | 1111 | messages.buttonOpenImportExport, |
1112 | )} | 1112 | )} |
1113 | className="settings__open-settings-file-button" | 1113 | className="settings__open-settings-file-button" |
1114 | onClick={() => openExternalUrl(serverURL, true)} | 1114 | onClick={() => openExternalUrl(serverURL, true)} |
1115 | /> | 1115 | /> |
1116 | </div> | 1116 | </div> |
1117 | </p> | 1117 | |
1118 | <p className="settings__help"> | 1118 | <p className="settings__help"> |
1119 | {intl.formatMessage(messages.serverHelp, { | 1119 | {intl.formatMessage(messages.serverHelp, { |
1120 | serverURL, | 1120 | serverURL, |
diff --git a/src/components/settings/supportFerdium/SupportFerdiumDashboard.tsx b/src/components/settings/supportFerdium/SupportFerdiumDashboard.tsx index 065690fb5..3a4592666 100644 --- a/src/components/settings/supportFerdium/SupportFerdiumDashboard.tsx +++ b/src/components/settings/supportFerdium/SupportFerdiumDashboard.tsx | |||
@@ -33,7 +33,7 @@ const SupportFerdiumDashboard = () => { | |||
33 | <a | 33 | <a |
34 | href="https://twitter.com/ferdiumteam/" | 34 | href="https://twitter.com/ferdiumteam/" |
35 | target="_blank" | 35 | target="_blank" |
36 | rel="noreferrer" | 36 | rel="noreferrer noopener" |
37 | > | 37 | > |
38 | <img | 38 | <img |
39 | alt="Twitter Follow" | 39 | alt="Twitter Follow" |
@@ -43,14 +43,18 @@ const SupportFerdiumDashboard = () => { | |||
43 | <a | 43 | <a |
44 | href="https://github.com/ferdium/ferdium-app" | 44 | href="https://github.com/ferdium/ferdium-app" |
45 | target="_blank" | 45 | target="_blank" |
46 | rel="noreferrer" | 46 | rel="noreferrer noopener" |
47 | > | 47 | > |
48 | <img | 48 | <img |
49 | alt="GitHub Stars" | 49 | alt="GitHub Stars" |
50 | src="https://img.shields.io/github/stars/ferdium/ferdium-app?style=social" | 50 | src="https://img.shields.io/github/stars/ferdium/ferdium-app?style=social" |
51 | /> | 51 | /> |
52 | </a> | 52 | </a> |
53 | <a target="_blank" href={FERDIUM_TRANSLATION} rel="noreferrer"> | 53 | <a |
54 | target="_blank" | ||
55 | href={FERDIUM_TRANSLATION} | ||
56 | rel="noreferrer noopener" | ||
57 | > | ||
54 | <img | 58 | <img |
55 | src="https://badges.crowdin.net/ferdium-app/localized.svg" | 59 | src="https://badges.crowdin.net/ferdium-app/localized.svg" |
56 | alt="Crowdin" | 60 | alt="Crowdin" |
@@ -59,7 +63,7 @@ const SupportFerdiumDashboard = () => { | |||
59 | <a | 63 | <a |
60 | href="https://opencollective.com/ferdium#section-contributors" | 64 | href="https://opencollective.com/ferdium#section-contributors" |
61 | target="_blank" | 65 | target="_blank" |
62 | rel="noreferrer" | 66 | rel="noreferrer noopener" |
63 | > | 67 | > |
64 | <img | 68 | <img |
65 | alt="Open Collective backers" | 69 | alt="Open Collective backers" |
@@ -72,7 +76,7 @@ const SupportFerdiumDashboard = () => { | |||
72 | <a | 76 | <a |
73 | href="https://github.com/ferdium/ferdium-app#contributors-" | 77 | href="https://github.com/ferdium/ferdium-app#contributors-" |
74 | target="_blank" | 78 | target="_blank" |
75 | rel="noreferrer" | 79 | rel="noreferrer noopener" |
76 | > | 80 | > |
77 | <img | 81 | <img |
78 | alt="GitHub contributors (non-exhaustive)" | 82 | alt="GitHub contributors (non-exhaustive)" |