diff options
author | MCMXC <16797721+mcmxcdev@users.noreply.github.com> | 2023-12-04 08:52:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 08:52:48 -0700 |
commit | 3fc8706007d896dcbde69c0ce924a6a5eb66aba6 (patch) | |
tree | 008bbcfc14d819cd2f744eb16607b6aa9c4ad0bf /src/components | |
parent | chore: project maintenance (#1466) (diff) | |
download | ferdium-app-3fc8706007d896dcbde69c0ce924a6a5eb66aba6.tar.gz ferdium-app-3fc8706007d896dcbde69c0ce924a6a5eb66aba6.tar.zst ferdium-app-3fc8706007d896dcbde69c0ce924a6a5eb66aba6.zip |
refactor: implement biome (#1467)
- add `biome.json`
- add `biome:check` and `biome:check:fix` commands to `package.json`
- add `biome:check:fix` command to run as part of `prepare-code` command
- install `@biomejs/biome` dependency
- add `@npmcli/move-file` v2.0.1 to `pnpm.allowedDeprecatedVersions`
- fix or comment out various reported lint issues
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/auth/SetupAssistant.tsx | 7 | ||||
-rw-r--r-- | src/components/auth/Welcome.tsx | 2 | ||||
-rw-r--r-- | src/components/layout/Sidebar.tsx | 1 | ||||
-rw-r--r-- | src/components/services/tabs/TabItem.tsx | 2 | ||||
-rw-r--r-- | src/components/settings/services/ServiceItem.tsx | 30 | ||||
-rw-r--r-- | src/components/ui/Link.tsx | 1 | ||||
-rw-r--r-- | src/components/ui/Radio.tsx | 1 | ||||
-rw-r--r-- | src/components/ui/button/index.tsx | 1 | ||||
-rw-r--r-- | src/components/ui/input/index.tsx | 1 | ||||
-rw-r--r-- | src/components/ui/select/index.tsx | 1 | ||||
-rw-r--r-- | src/components/ui/textarea/index.tsx | 2 | ||||
-rw-r--r-- | src/components/ui/toggle/index.tsx | 1 |
12 files changed, 19 insertions, 31 deletions
diff --git a/src/components/auth/SetupAssistant.tsx b/src/components/auth/SetupAssistant.tsx index fdcbba45e..c25495471 100644 --- a/src/components/auth/SetupAssistant.tsx +++ b/src/components/auth/SetupAssistant.tsx | |||
@@ -39,10 +39,9 @@ const messages = defineMessages({ | |||
39 | }, | 39 | }, |
40 | }); | 40 | }); |
41 | 41 | ||
42 | const transition = | 42 | const transition = window?.matchMedia('(prefers-reduced-motion: no-preference)') |
43 | window && window.matchMedia('(prefers-reduced-motion: no-preference)') | 43 | ? 'all 0.25s' |
44 | ? 'all 0.25s' | 44 | : 'none'; |
45 | : 'none'; | ||
46 | 45 | ||
47 | const styles = theme => ({ | 46 | const styles = theme => ({ |
48 | root: { | 47 | root: { |
diff --git a/src/components/auth/Welcome.tsx b/src/components/auth/Welcome.tsx index 259e3c335..c1a2db386 100644 --- a/src/components/auth/Welcome.tsx +++ b/src/components/auth/Welcome.tsx | |||
@@ -91,8 +91,8 @@ class Welcome extends Component<IProps> { | |||
91 | className="settings__hr-sections" | 91 | className="settings__hr-sections" |
92 | style={{ marginTop: 24, marginBottom: 24, borderStyle: 'solid' }} | 92 | style={{ marginTop: 24, marginBottom: 24, borderStyle: 'solid' }} |
93 | /> | 93 | /> |
94 | {/* eslint-disable-next-line react/button-has-type */} | ||
95 | <button | 94 | <button |
95 | type="button" | ||
96 | className="button" | 96 | className="button" |
97 | onClick={this.useLocalServer.bind(this)} | 97 | onClick={this.useLocalServer.bind(this)} |
98 | onKeyDown={noop} | 98 | onKeyDown={noop} |
diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index 7904d7653..e423e408b 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx | |||
@@ -352,6 +352,7 @@ class Sidebar extends Component<IProps, IState> { | |||
352 | type="button" | 352 | type="button" |
353 | onClick={() => openDownloads({ path: '/downloadmanager' })} | 353 | onClick={() => openDownloads({ path: '/downloadmanager' })} |
354 | className={ | 354 | className={ |
355 | // biome-ignore lint/style/useTemplate: <explanation> | ||
355 | 'sidebar__button' + | 356 | 'sidebar__button' + |
356 | `${isDownloading ? ' sidebar__button--downloading' : ''}` + | 357 | `${isDownloading ? ' sidebar__button--downloading' : ''}` + |
357 | `${justFinishedDownloading ? ' sidebar__button--done' : ''}` | 358 | `${justFinishedDownloading ? ' sidebar__button--done' : ''}` |
diff --git a/src/components/services/tabs/TabItem.tsx b/src/components/services/tabs/TabItem.tsx index 287dedfcb..804efe8a5 100644 --- a/src/components/services/tabs/TabItem.tsx +++ b/src/components/services/tabs/TabItem.tsx | |||
@@ -80,7 +80,7 @@ let pollIndicatorTransition = 'none'; | |||
80 | let polledTransition = 'none'; | 80 | let polledTransition = 'none'; |
81 | let pollAnsweredTransition = 'none'; | 81 | let pollAnsweredTransition = 'none'; |
82 | 82 | ||
83 | if (window && window.matchMedia('(prefers-reduced-motion: no-preference)')) { | 83 | if (window?.matchMedia('(prefers-reduced-motion: no-preference)')) { |
84 | pollIndicatorTransition = 'background 0.5s'; | 84 | pollIndicatorTransition = 'background 0.5s'; |
85 | polledTransition = 'background 0.1s'; | 85 | polledTransition = 'background 0.1s'; |
86 | pollAnsweredTransition = 'background 0.1s'; | 86 | pollAnsweredTransition = 'background 0.1s'; |
diff --git a/src/components/settings/services/ServiceItem.tsx b/src/components/settings/services/ServiceItem.tsx index babe06b5a..35b63b160 100644 --- a/src/components/settings/services/ServiceItem.tsx +++ b/src/components/settings/services/ServiceItem.tsx | |||
@@ -44,11 +44,7 @@ class ServiceItem extends Component<IProps> { | |||
44 | 'service-table__row--disabled': !service.isEnabled, | 44 | 'service-table__row--disabled': !service.isEnabled, |
45 | })} | 45 | })} |
46 | > | 46 | > |
47 | <td | 47 | <td className="service-table__column-icon" onClick={goToServiceForm}> |
48 | className="service-table__column-icon" | ||
49 | onClick={goToServiceForm} | ||
50 | role="gridcell" | ||
51 | > | ||
52 | <img | 48 | <img |
53 | src={service.icon} | 49 | src={service.icon} |
54 | className={classnames({ | 50 | className={classnames({ |
@@ -58,18 +54,10 @@ class ServiceItem extends Component<IProps> { | |||
58 | alt="" | 54 | alt="" |
59 | /> | 55 | /> |
60 | </td> | 56 | </td> |
61 | <td | 57 | <td className="service-table__column-name" onClick={goToServiceForm}> |
62 | className="service-table__column-name" | ||
63 | onClick={goToServiceForm} | ||
64 | role="gridcell" | ||
65 | > | ||
66 | {service.name === '' ? service.recipe.name : service.name} | 58 | {service.name === '' ? service.recipe.name : service.name} |
67 | </td> | 59 | </td> |
68 | <td | 60 | <td className="service-table__column-info" onClick={goToServiceForm}> |
69 | className="service-table__column-info" | ||
70 | onClick={goToServiceForm} | ||
71 | role="gridcell" | ||
72 | > | ||
73 | {service.isMuted && ( | 61 | {service.isMuted && ( |
74 | <Icon | 62 | <Icon |
75 | icon={mdiBellOff} | 63 | icon={mdiBellOff} |
@@ -78,11 +66,7 @@ class ServiceItem extends Component<IProps> { | |||
78 | /> | 66 | /> |
79 | )} | 67 | )} |
80 | </td> | 68 | </td> |
81 | <td | 69 | <td className="service-table__column-info" onClick={goToServiceForm}> |
82 | className="service-table__column-info" | ||
83 | onClick={goToServiceForm} | ||
84 | role="gridcell" | ||
85 | > | ||
86 | {!service.isEnabled && ( | 70 | {!service.isEnabled && ( |
87 | <Icon | 71 | <Icon |
88 | icon={mdiPower} | 72 | icon={mdiPower} |
@@ -93,11 +77,7 @@ class ServiceItem extends Component<IProps> { | |||
93 | /> | 77 | /> |
94 | )} | 78 | )} |
95 | </td> | 79 | </td> |
96 | <td | 80 | <td className="service-table__column-info" onClick={goToServiceForm}> |
97 | className="service-table__column-info" | ||
98 | onClick={goToServiceForm} | ||
99 | role="gridcell" | ||
100 | > | ||
101 | {!service.isNotificationEnabled && ( | 81 | {!service.isNotificationEnabled && ( |
102 | <Icon | 82 | <Icon |
103 | icon={mdiMessageBulletedOff} | 83 | icon={mdiMessageBulletedOff} |
diff --git a/src/components/ui/Link.tsx b/src/components/ui/Link.tsx index a9a429d3a..f9fdd57f9 100644 --- a/src/components/ui/Link.tsx +++ b/src/components/ui/Link.tsx | |||
@@ -54,6 +54,7 @@ class Link extends Component<IProps> { | |||
54 | }); | 54 | }); |
55 | 55 | ||
56 | return ( | 56 | return ( |
57 | // biome-ignore lint/a11y/useValidAnchor: <explanation> | ||
57 | <a | 58 | <a |
58 | href={router.history.createHref(to)} | 59 | href={router.history.createHref(to)} |
59 | className={linkClasses} | 60 | className={linkClasses} |
diff --git a/src/components/ui/Radio.tsx b/src/components/ui/Radio.tsx index 1f41deedc..901958c78 100644 --- a/src/components/ui/Radio.tsx +++ b/src/components/ui/Radio.tsx | |||
@@ -2,6 +2,7 @@ import { Component } from 'react'; | |||
2 | import { observer } from 'mobx-react'; | 2 | import { observer } from 'mobx-react'; |
3 | import classnames from 'classnames'; | 3 | import classnames from 'classnames'; |
4 | import FieldInterface from 'mobx-react-form/lib/models/FieldInterface'; | 4 | import FieldInterface from 'mobx-react-form/lib/models/FieldInterface'; |
5 | // biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation> | ||
5 | import Error from './error'; | 6 | import Error from './error'; |
6 | 7 | ||
7 | type Props = { | 8 | type Props = { |
diff --git a/src/components/ui/button/index.tsx b/src/components/ui/button/index.tsx index f8bcf76b2..a2194e34d 100644 --- a/src/components/ui/button/index.tsx +++ b/src/components/ui/button/index.tsx | |||
@@ -205,6 +205,7 @@ class ButtonComponent extends Component<IProps, IState> { | |||
205 | ); | 205 | ); |
206 | 206 | ||
207 | const wrapperComponent = href ? ( | 207 | const wrapperComponent = href ? ( |
208 | // biome-ignore lint/a11y/useValidAnchor: <explanation> | ||
208 | <a | 209 | <a |
209 | href={href} | 210 | href={href} |
210 | target={target} | 211 | target={target} |
diff --git a/src/components/ui/input/index.tsx b/src/components/ui/input/index.tsx index 064c1807f..68cc9ee22 100644 --- a/src/components/ui/input/index.tsx +++ b/src/components/ui/input/index.tsx | |||
@@ -14,6 +14,7 @@ import { observer } from 'mobx-react'; | |||
14 | import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; | 14 | import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; |
15 | import Icon from '../icon'; | 15 | import Icon from '../icon'; |
16 | import { IFormField } from '../typings/generic'; | 16 | import { IFormField } from '../typings/generic'; |
17 | // biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation> | ||
17 | import Error from '../error'; | 18 | import Error from '../error'; |
18 | import Label from '../label'; | 19 | import Label from '../label'; |
19 | import Wrapper from '../wrapper'; | 20 | import Wrapper from '../wrapper'; |
diff --git a/src/components/ui/select/index.tsx b/src/components/ui/select/index.tsx index 650600fb3..c06ac59b0 100644 --- a/src/components/ui/select/index.tsx +++ b/src/components/ui/select/index.tsx | |||
@@ -10,6 +10,7 @@ import withStyles, { WithStylesProps } from 'react-jss'; | |||
10 | import { noop } from 'lodash'; | 10 | import { noop } from 'lodash'; |
11 | import { Theme } from '../../../themes'; | 11 | import { Theme } from '../../../themes'; |
12 | import { IFormField } from '../typings/generic'; | 12 | import { IFormField } from '../typings/generic'; |
13 | // biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation> | ||
13 | import Error from '../error'; | 14 | import Error from '../error'; |
14 | import Label from '../label'; | 15 | import Label from '../label'; |
15 | import Wrapper from '../wrapper'; | 16 | import Wrapper from '../wrapper'; |
diff --git a/src/components/ui/textarea/index.tsx b/src/components/ui/textarea/index.tsx index fbdef7fc6..0967c4c25 100644 --- a/src/components/ui/textarea/index.tsx +++ b/src/components/ui/textarea/index.tsx | |||
@@ -5,6 +5,7 @@ import injectSheet, { WithStylesProps } from 'react-jss'; | |||
5 | import { noop } from 'lodash'; | 5 | import { noop } from 'lodash'; |
6 | import { IFormField } from '../typings/generic'; | 6 | import { IFormField } from '../typings/generic'; |
7 | 7 | ||
8 | // biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation> | ||
8 | import Error from '../error'; | 9 | import Error from '../error'; |
9 | import Label from '../label'; | 10 | import Label from '../label'; |
10 | import Wrapper from '../wrapper'; | 11 | import Wrapper from '../wrapper'; |
@@ -40,6 +41,7 @@ class TextareaComponent extends Component<IProps> { | |||
40 | 41 | ||
41 | if (this.textareaRef?.current && data) { | 42 | if (this.textareaRef?.current && data) { |
42 | Object.keys(data).map( | 43 | Object.keys(data).map( |
44 | // biome-ignore lint/suspicious/noAssignInExpressions: <explanation> | ||
43 | key => (this.textareaRef.current!.dataset[key] = data[key]), | 45 | key => (this.textareaRef.current!.dataset[key] = data[key]), |
44 | ); | 46 | ); |
45 | } | 47 | } |
diff --git a/src/components/ui/toggle/index.tsx b/src/components/ui/toggle/index.tsx index 275d28bf6..878ffecdc 100644 --- a/src/components/ui/toggle/index.tsx +++ b/src/components/ui/toggle/index.tsx | |||
@@ -4,6 +4,7 @@ import { noop } from 'lodash'; | |||
4 | import { Component, InputHTMLAttributes, ReactElement } from 'react'; | 4 | import { Component, InputHTMLAttributes, ReactElement } from 'react'; |
5 | import withStyles, { WithStylesProps } from 'react-jss'; | 5 | import withStyles, { WithStylesProps } from 'react-jss'; |
6 | import { Theme } from '../../../themes'; | 6 | import { Theme } from '../../../themes'; |
7 | // biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation> | ||
7 | import Error from '../error'; | 8 | import Error from '../error'; |
8 | import Label from '../label'; | 9 | import Label from '../label'; |
9 | import { IFormField } from '../typings/generic'; | 10 | import { IFormField } from '../typings/generic'; |