aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2023-12-04 08:52:48 -0700
committerLibravatar GitHub <noreply@github.com>2023-12-04 08:52:48 -0700
commit3fc8706007d896dcbde69c0ce924a6a5eb66aba6 (patch)
tree008bbcfc14d819cd2f744eb16607b6aa9c4ad0bf /src
parentchore: project maintenance (#1466) (diff)
downloadferdium-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')
-rw-r--r--src/components/auth/SetupAssistant.tsx7
-rw-r--r--src/components/auth/Welcome.tsx2
-rw-r--r--src/components/layout/Sidebar.tsx1
-rw-r--r--src/components/services/tabs/TabItem.tsx2
-rw-r--r--src/components/settings/services/ServiceItem.tsx30
-rw-r--r--src/components/ui/Link.tsx1
-rw-r--r--src/components/ui/Radio.tsx1
-rw-r--r--src/components/ui/button/index.tsx1
-rw-r--r--src/components/ui/input/index.tsx1
-rw-r--r--src/components/ui/select/index.tsx1
-rw-r--r--src/components/ui/textarea/index.tsx2
-rw-r--r--src/components/ui/toggle/index.tsx1
-rw-r--r--src/features/workspaces/components/WorkspaceDrawerItem.tsx3
-rw-r--r--src/internal-server/app/Controllers/Http/RecipeController.js8
-rw-r--r--src/internal-server/app/Controllers/Http/ServiceController.js7
-rw-r--r--src/internal-server/start/migrate.js3
16 files changed, 28 insertions, 43 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
42const transition = 42const 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
47const styles = theme => ({ 46const 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';
80let polledTransition = 'none'; 80let polledTransition = 'none';
81let pollAnsweredTransition = 'none'; 81let pollAnsweredTransition = 'none';
82 82
83if (window && window.matchMedia('(prefers-reduced-motion: no-preference)')) { 83if (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';
2import { observer } from 'mobx-react'; 2import { observer } from 'mobx-react';
3import classnames from 'classnames'; 3import classnames from 'classnames';
4import FieldInterface from 'mobx-react-form/lib/models/FieldInterface'; 4import FieldInterface from 'mobx-react-form/lib/models/FieldInterface';
5// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
5import Error from './error'; 6import Error from './error';
6 7
7type Props = { 8type 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';
14import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; 14import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl';
15import Icon from '../icon'; 15import Icon from '../icon';
16import { IFormField } from '../typings/generic'; 16import { IFormField } from '../typings/generic';
17// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
17import Error from '../error'; 18import Error from '../error';
18import Label from '../label'; 19import Label from '../label';
19import Wrapper from '../wrapper'; 20import 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';
10import { noop } from 'lodash'; 10import { noop } from 'lodash';
11import { Theme } from '../../../themes'; 11import { Theme } from '../../../themes';
12import { IFormField } from '../typings/generic'; 12import { IFormField } from '../typings/generic';
13// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
13import Error from '../error'; 14import Error from '../error';
14import Label from '../label'; 15import Label from '../label';
15import Wrapper from '../wrapper'; 16import 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';
5import { noop } from 'lodash'; 5import { noop } from 'lodash';
6import { IFormField } from '../typings/generic'; 6import { IFormField } from '../typings/generic';
7 7
8// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
8import Error from '../error'; 9import Error from '../error';
9import Label from '../label'; 10import Label from '../label';
10import Wrapper from '../wrapper'; 11import 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';
4import { Component, InputHTMLAttributes, ReactElement } from 'react'; 4import { Component, InputHTMLAttributes, ReactElement } from 'react';
5import withStyles, { WithStylesProps } from 'react-jss'; 5import withStyles, { WithStylesProps } from 'react-jss';
6import { Theme } from '../../../themes'; 6import { Theme } from '../../../themes';
7// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
7import Error from '../error'; 8import Error from '../error';
8import Label from '../label'; 9import Label from '../label';
9import { IFormField } from '../typings/generic'; 10import { IFormField } from '../typings/generic';
diff --git a/src/features/workspaces/components/WorkspaceDrawerItem.tsx b/src/features/workspaces/components/WorkspaceDrawerItem.tsx
index 4fd7662f5..85ed4c38c 100644
--- a/src/features/workspaces/components/WorkspaceDrawerItem.tsx
+++ b/src/features/workspaces/components/WorkspaceDrawerItem.tsx
@@ -72,8 +72,7 @@ interface IProps extends WithStylesProps<typeof styles>, WrappedComponentProps {
72 name: string; 72 name: string;
73 onClick: MouseEventHandler<HTMLInputElement>; 73 onClick: MouseEventHandler<HTMLInputElement>;
74 services: string[]; 74 services: string[];
75 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type 75 onContextMenuEditClick?: (() => void) | null;
76 onContextMenuEditClick?: () => void | null;
77 shortcutIndex: number; 76 shortcutIndex: number;
78} 77}
79 78
diff --git a/src/internal-server/app/Controllers/Http/RecipeController.js b/src/internal-server/app/Controllers/Http/RecipeController.js
index 3e54ab65b..48d3ce7e5 100644
--- a/src/internal-server/app/Controllers/Http/RecipeController.js
+++ b/src/internal-server/app/Controllers/Http/RecipeController.js
@@ -59,8 +59,8 @@ class RecipeController {
59 })); 59 }));
60 } else { 60 } else {
61 let remoteResults = []; 61 let remoteResults = [];
62 // eslint-disable-next-line eqeqeq 62
63 if (Env.get('CONNECT_WITH_FRANZ') == 'true') { 63 if (Env.get('CONNECT_WITH_FRANZ') === 'true') {
64 const recipesUrlFetch = await fetch( 64 const recipesUrlFetch = await fetch(
65 `${RECIPES_URL}/search?needle=${encodeURIComponent(needle)}`, 65 `${RECIPES_URL}/search?needle=${encodeURIComponent(needle)}`,
66 ); 66 );
@@ -123,8 +123,8 @@ class RecipeController {
123 if (await Drive.exists(`${service}.tar.gz`)) { 123 if (await Drive.exists(`${service}.tar.gz`)) {
124 return response.send(await Drive.get(`${service}.tar.gz`)); 124 return response.send(await Drive.get(`${service}.tar.gz`));
125 } 125 }
126 // eslint-disable-next-line eqeqeq 126
127 if (Env.get('CONNECT_WITH_FRANZ') == 'true') { 127 if (Env.get('CONNECT_WITH_FRANZ') === 'true') {
128 return response.redirect(`${RECIPES_URL}/download/${service}`); 128 return response.redirect(`${RECIPES_URL}/download/${service}`);
129 } 129 }
130 return response.status(400).send({ 130 return response.status(400).send({
diff --git a/src/internal-server/app/Controllers/Http/ServiceController.js b/src/internal-server/app/Controllers/Http/ServiceController.js
index 940cac065..8e8aa97a8 100644
--- a/src/internal-server/app/Controllers/Http/ServiceController.js
+++ b/src/internal-server/app/Controllers/Http/ServiceController.js
@@ -126,10 +126,9 @@ class ServiceController {
126 const newSettings = { 126 const newSettings = {
127 ...settings, 127 ...settings,
128 iconId, 128 iconId,
129 customIconVersion: 129 customIconVersion: settings?.customIconVersion
130 settings && settings.customIconVersion 130 ? settings.customIconVersion + 1
131 ? settings.customIconVersion + 1 131 : 1,
132 : 1,
133 }; 132 };
134 133
135 // Update data in database 134 // Update data in database
diff --git a/src/internal-server/start/migrate.js b/src/internal-server/start/migrate.js
index 4cd502c3f..67533ed9e 100644
--- a/src/internal-server/start/migrate.js
+++ b/src/internal-server/start/migrate.js
@@ -35,8 +35,7 @@ module.exports = async () => {
35 !settings.db_version || 35 !settings.db_version ||
36 settings.db_version !== ferdiumVersion 36 settings.db_version !== ferdiumVersion
37 ) { 37 ) {
38 const srcVersion = 38 const srcVersion = settings?.db_version || '5.4.0-beta.2';
39 settings && settings.db_version ? settings.db_version : '5.4.0-beta.2';
40 migrateLog(`🔮 Migrating table from ${srcVersion} to ${ferdiumVersion}`); 39 migrateLog(`🔮 Migrating table from ${srcVersion} to ${ferdiumVersion}`);
41 40
42 // Migrate database to current Ferdium version 41 // Migrate database to current Ferdium version