diff options
author | MCMXC <16797721+mcmxcdev@users.noreply.github.com> | 2024-04-18 08:18:36 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 08:18:36 -0600 |
commit | c49723056acec489765acb54bae3889ac07f25af (patch) | |
tree | 58bea705d61a728b060e615ce514b8d4a7936c9e /src/components/ui | |
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/ui')
-rw-r--r-- | src/components/ui/FAB.tsx | 1 | ||||
-rw-r--r-- | src/components/ui/SearchInput.tsx | 1 | ||||
-rw-r--r-- | src/components/ui/Tabs/Tabs.tsx | 7 | ||||
-rw-r--r-- | src/components/ui/button/index.tsx | 2 | ||||
-rw-r--r-- | src/components/ui/imageUpload/index.tsx | 2 | ||||
-rw-r--r-- | src/components/ui/input/index.tsx | 2 | ||||
-rw-r--r-- | src/components/ui/select/index.tsx | 2 | ||||
-rw-r--r-- | src/components/ui/textarea/index.tsx | 7 |
8 files changed, 16 insertions, 8 deletions
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 | ||