aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2024-04-18 08:18:36 -0600
committerLibravatar GitHub <noreply@github.com>2024-04-18 08:18:36 -0600
commitc49723056acec489765acb54bae3889ac07f25af (patch)
tree58bea705d61a728b060e615ce514b8d4a7936c9e /src/components
parentfeat: hide all services workspace (#1713) (diff)
downloadferdium-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')
-rw-r--r--src/components/auth/AuthLayout.tsx1
-rw-r--r--src/components/downloadManager/DownloadManagerDashboard.tsx1
-rw-r--r--src/components/downloadManager/DownloadManagerLayout.tsx4
-rw-r--r--src/components/settings/SettingsLayout.tsx2
-rw-r--r--src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx1
-rw-r--r--src/components/settings/releaseNotes/ReleaseNotesLayout.tsx4
-rw-r--r--src/components/settings/settings/EditSettingsForm.tsx56
-rw-r--r--src/components/settings/supportFerdium/SupportFerdiumDashboard.tsx14
-rw-r--r--src/components/ui/FAB.tsx1
-rw-r--r--src/components/ui/SearchInput.tsx1
-rw-r--r--src/components/ui/Tabs/Tabs.tsx7
-rw-r--r--src/components/ui/button/index.tsx2
-rw-r--r--src/components/ui/imageUpload/index.tsx2
-rw-r--r--src/components/ui/input/index.tsx2
-rw-r--r--src/components/ui/select/index.tsx2
-rw-r--r--src/components/ui/textarea/index.tsx7
16 files changed, 60 insertions, 47 deletions
diff --git a/src/components/auth/AuthLayout.tsx b/src/components/auth/AuthLayout.tsx
index 67e898318..3952045b2 100644
--- a/src/components/auth/AuthLayout.tsx
+++ b/src/components/auth/AuthLayout.tsx
@@ -106,6 +106,7 @@ class AuthLayout extends Component<IProps, IState> {
106 )} 106 )}
107 <div className="auth__layout"> 107 <div className="auth__layout">
108 {/* Inject globalError into children */} 108 {/* Inject globalError into children */}
109 {/* eslint-disable-next-line @eslint-react/no-clone-element */}
109 {cloneElement(children, { error })} 110 {cloneElement(children, { error })}
110 </div> 111 </div>
111 {/* </div> */} 112 {/* </div> */}
diff --git a/src/components/downloadManager/DownloadManagerDashboard.tsx b/src/components/downloadManager/DownloadManagerDashboard.tsx
index 490be269d..aeaa94634 100644
--- a/src/components/downloadManager/DownloadManagerDashboard.tsx
+++ b/src/components/downloadManager/DownloadManagerDashboard.tsx
@@ -47,7 +47,6 @@ interface IState {
47 data: string; 47 data: string;
48} 48}
49 49
50// eslint-disable-next-line react/prefer-stateless-function
51class DownloadManagerDashboard extends Component<IProps, IState> { 50class DownloadManagerDashboard extends Component<IProps, IState> {
52 render() { 51 render() {
53 const { intl, stores, actions } = this.props; 52 const { intl, stores, actions } = this.props;
diff --git a/src/components/downloadManager/DownloadManagerLayout.tsx b/src/components/downloadManager/DownloadManagerLayout.tsx
index 08c0ace1e..43670355c 100644
--- a/src/components/downloadManager/DownloadManagerLayout.tsx
+++ b/src/components/downloadManager/DownloadManagerLayout.tsx
@@ -44,8 +44,8 @@ class DownloadManagerLayout extends Component<IProps> {
44 ); 44 );
45 } 45 }
46 46
47 handleKeyDown(e) { 47 handleKeyDown(e: KeyboardEvent) {
48 if (isEscKeyPress(e.keyCode)) { 48 if (isEscKeyPress(e.key)) {
49 this.props.actions!.ui.closeSettings(); 49 this.props.actions!.ui.closeSettings();
50 } 50 }
51 } 51 }
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)"
diff --git a/src/components/ui/FAB.tsx b/src/components/ui/FAB.tsx
index b4eeace8b..1e9ff9022 100644
--- a/src/components/ui/FAB.tsx
+++ b/src/components/ui/FAB.tsx
@@ -36,6 +36,7 @@ class Button extends Component<IProps> {
36 }; 36 };
37 37
38 return ( 38 return (
39 // eslint-disable-next-line @eslint-react/dom/no-missing-button-type
39 <button {...buttonProps} type="button"> 40 <button {...buttonProps} type="button">
40 {children} 41 {children}
41 </button> 42 </button>
diff --git a/src/components/ui/SearchInput.tsx b/src/components/ui/SearchInput.tsx
index 2e70d1b35..d31463010 100644
--- a/src/components/ui/SearchInput.tsx
+++ b/src/components/ui/SearchInput.tsx
@@ -98,6 +98,7 @@ class SearchInput extends Component<IProps, IState> {
98 /> 98 />
99 </label> 99 </label>
100 {value.length > 0 && ( 100 {value.length > 0 && (
101 // eslint-disable-next-line jsx-a11y/no-static-element-interactions
101 <span onClick={() => this.reset()} onKeyDown={noop}> 102 <span onClick={() => this.reset()} onKeyDown={noop}>
102 <Icon icon={mdiCloseCircleOutline} /> 103 <Icon icon={mdiCloseCircleOutline} />
103 </span> 104 </span>
diff --git a/src/components/ui/Tabs/Tabs.tsx b/src/components/ui/Tabs/Tabs.tsx
index a5ec148aa..d1e397122 100644
--- a/src/components/ui/Tabs/Tabs.tsx
+++ b/src/components/ui/Tabs/Tabs.tsx
@@ -35,6 +35,7 @@ class Tab extends Component<IProps, IState> {
35 35
36 render(): ReactElement { 36 render(): ReactElement {
37 const { children: childElements } = this.props; 37 const { children: childElements } = this.props;
38 // eslint-disable-next-line @eslint-react/no-children-to-array
38 const children = Children.toArray(childElements); // removes all null values 39 const children = Children.toArray(childElements); // removes all null values
39 40
40 if (children.length === 1) { 41 if (children.length === 1) {
@@ -44,9 +45,10 @@ class Tab extends Component<IProps, IState> {
44 return ( 45 return (
45 <div className="content-tabs"> 46 <div className="content-tabs">
46 <div className="content-tabs__tabs"> 47 <div className="content-tabs__tabs">
48 {/* eslint-disable-next-line @eslint-react/no-children-map */}
47 {Children.map(children, (child, i) => ( 49 {Children.map(children, (child, i) => (
48 <button 50 <button
49 // eslint-disable-next-line react/no-array-index-key 51 // eslint-disable-next-line react/no-array-index-key, @eslint-react/no-array-index-key
50 key={i} 52 key={i}
51 className={classnames({ 53 className={classnames({
52 'content-tabs__item': true, 54 'content-tabs__item': true,
@@ -60,9 +62,10 @@ class Tab extends Component<IProps, IState> {
60 ))} 62 ))}
61 </div> 63 </div>
62 <div className="content-tabs__content"> 64 <div className="content-tabs__content">
65 {/* eslint-disable-next-line @eslint-react/no-children-map */}
63 {Children.map(children, (child, i) => ( 66 {Children.map(children, (child, i) => (
64 <div 67 <div
65 // eslint-disable-next-line react/no-array-index-key 68 // eslint-disable-next-line react/no-array-index-key, @eslint-react/no-array-index-key
66 key={i} 69 key={i}
67 className={classnames({ 70 className={classnames({
68 'content-tabs__item': true, 71 'content-tabs__item': true,
diff --git a/src/components/ui/button/index.tsx b/src/components/ui/button/index.tsx
index 5c606f274..ba4353dae 100644
--- a/src/components/ui/button/index.tsx
+++ b/src/components/ui/button/index.tsx
@@ -223,7 +223,7 @@ class ButtonComponent extends Component<IProps, IState> {
223 ) : ( 223 ) : (
224 <button 224 <button
225 id={id} 225 id={id}
226 // eslint-disable-next-line react/button-has-type 226 // eslint-disable-next-line react/button-has-type, @eslint-react/dom/no-missing-button-type
227 type={type} 227 type={type}
228 onClick={onClick} 228 onClick={onClick}
229 className={classnames({ 229 className={classnames({
diff --git a/src/components/ui/imageUpload/index.tsx b/src/components/ui/imageUpload/index.tsx
index 876572484..092271ab0 100644
--- a/src/components/ui/imageUpload/index.tsx
+++ b/src/components/ui/imageUpload/index.tsx
@@ -129,7 +129,9 @@ class ImageUpload extends Component<IProps, IState> {
129 </> 129 </>
130 ) : ( 130 ) : (
131 <Dropzone 131 <Dropzone
132 // eslint-disable-next-line react/jsx-no-bind
132 onDropAccepted={this.onDropAccepted.bind(this)} 133 onDropAccepted={this.onDropAccepted.bind(this)}
134 // eslint-disable-next-line react/jsx-no-bind
133 onDropRejected={this.onDropRejected.bind(this)} 135 onDropRejected={this.onDropRejected.bind(this)}
134 multiple={multiple} 136 multiple={multiple}
135 accept={{ 137 accept={{
diff --git a/src/components/ui/input/index.tsx b/src/components/ui/input/index.tsx
index c61efe570..225517ba8 100644
--- a/src/components/ui/input/index.tsx
+++ b/src/components/ui/input/index.tsx
@@ -172,7 +172,7 @@ class Input extends Component<IProps, IState> {
172 onFocus={onFocus} 172 onFocus={onFocus}
173 onBlur={onBlur} 173 onBlur={onBlur}
174 disabled={disabled} 174 disabled={disabled}
175 onKeyPress={this.onInputKeyPress.bind(this)} 175 onKeyUp={this.onInputKeyPress.bind(this)}
176 min={min} 176 min={min}
177 max={max} 177 max={max}
178 step={step} 178 step={step}
diff --git a/src/components/ui/select/index.tsx b/src/components/ui/select/index.tsx
index 2716ebc2d..397fd97ed 100644
--- a/src/components/ui/select/index.tsx
+++ b/src/components/ui/select/index.tsx
@@ -197,6 +197,7 @@ class SelectComponent extends Component<IProps, IState> {
197 this.arrowKeysHandler = this.arrowKeysHandler.bind(this); 197 this.arrowKeysHandler = this.arrowKeysHandler.bind(this);
198 } 198 }
199 199
200 // eslint-disable-next-line @eslint-react/no-unsafe-component-will-mount
200 UNSAFE_componentWillMount(): void { 201 UNSAFE_componentWillMount(): void {
201 const { value } = this.props; 202 const { value } = this.props;
202 203
@@ -417,6 +418,7 @@ class SelectComponent extends Component<IProps, IState> {
417 ref={this.scrollContainerRef} 418 ref={this.scrollContainerRef}
418 > 419 >
419 {Object.keys(options!).map((key, i) => ( 420 {Object.keys(options!).map((key, i) => (
421 // eslint-disable-next-line jsx-a11y/no-static-element-interactions
420 <div 422 <div
421 key={key} 423 key={key}
422 onClick={() => this.select(key)} 424 onClick={() => this.select(key)}
diff --git a/src/components/ui/textarea/index.tsx b/src/components/ui/textarea/index.tsx
index 4a0e77afe..e332f7a47 100644
--- a/src/components/ui/textarea/index.tsx
+++ b/src/components/ui/textarea/index.tsx
@@ -40,10 +40,9 @@ class TextareaComponent extends Component<IProps> {
40 const { data } = this.props; 40 const { data } = this.props;
41 41
42 if (this.textareaRef?.current && data) { 42 if (this.textareaRef?.current && data) {
43 Object.keys(data).map( 43 Object.keys(data).forEach(key => {
44 // biome-ignore lint/suspicious/noAssignInExpressions: <explanation> 44 this.textareaRef.current!.dataset[key] = data[key];
45 key => (this.textareaRef.current!.dataset[key] = data[key]), 45 });
46 );
47 } 46 }
48 } 47 }
49 48