aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
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/features
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/features')
-rw-r--r--src/features/appearance/index.ts1
-rw-r--r--src/features/basicAuth/Component.tsx2
-rw-r--r--src/features/communityRecipes/store.ts1
-rw-r--r--src/features/quickSwitch/Component.tsx2
-rw-r--r--src/features/todos/actions.ts1
-rw-r--r--src/features/todos/components/TodosWebview.tsx3
-rw-r--r--src/features/todos/index.ts1
-rw-r--r--src/features/webControls/containers/WebControlsScreen.tsx2
-rw-r--r--src/features/workspaces/components/CreateWorkspaceForm.tsx2
-rw-r--r--src/features/workspaces/components/EditWorkspaceForm.tsx7
-rw-r--r--src/features/workspaces/components/WorkspaceDrawer.tsx2
-rw-r--r--src/features/workspaces/components/WorkspaceDrawerItem.tsx1
-rw-r--r--src/features/workspaces/components/WorkspaceServiceListItem.tsx1
-rw-r--r--src/features/workspaces/components/WorkspacesDashboard.tsx50
-rw-r--r--src/features/workspaces/index.ts1
15 files changed, 50 insertions, 27 deletions
diff --git a/src/features/appearance/index.ts b/src/features/appearance/index.ts
index 049080505..9b7715a23 100644
--- a/src/features/appearance/index.ts
+++ b/src/features/appearance/index.ts
@@ -46,6 +46,7 @@ function generateAccentStyle(accentColorStr) {
46 try { 46 try {
47 accentColor = color(accentColorStr); 47 accentColor = color(accentColorStr);
48 } catch { 48 } catch {
49 // eslint-disable-next-line no-param-reassign
49 accentColorStr = DEFAULT_APP_SETTINGS.accentColor; 50 accentColorStr = DEFAULT_APP_SETTINGS.accentColor;
50 accentColor = color(accentColorStr); 51 accentColor = color(accentColorStr);
51 } 52 }
diff --git a/src/features/basicAuth/Component.tsx b/src/features/basicAuth/Component.tsx
index 7c901344d..bae38443a 100644
--- a/src/features/basicAuth/Component.tsx
+++ b/src/features/basicAuth/Component.tsx
@@ -61,6 +61,7 @@ class BasicAuthModal extends Component<IProps> {
61 <Modal 61 <Modal
62 isOpen={isModalVisible} 62 isOpen={isModalVisible}
63 className={classes.modal} 63 className={classes.modal}
64 // eslint-disable-next-line react/jsx-no-bind
64 close={this.cancel.bind(this)} 65 close={this.cancel.bind(this)}
65 showClose={false} 66 showClose={false}
66 > 67 >
@@ -86,6 +87,7 @@ class BasicAuthModal extends Component<IProps> {
86 type="button" 87 type="button"
87 label={intl.formatMessage(globalMessages.cancel)} 88 label={intl.formatMessage(globalMessages.cancel)}
88 buttonType="secondary" 89 buttonType="secondary"
90 // eslint-disable-next-line react/jsx-no-bind
89 onClick={this.cancel.bind(this)} 91 onClick={this.cancel.bind(this)}
90 /> 92 />
91 <Button 93 <Button
diff --git a/src/features/communityRecipes/store.ts b/src/features/communityRecipes/store.ts
index 1c21908e2..548867528 100644
--- a/src/features/communityRecipes/store.ts
+++ b/src/features/communityRecipes/store.ts
@@ -27,6 +27,7 @@ export class CommunityRecipesStore extends FeatureStore {
27 return this.stores.recipePreviews.dev.map( 27 return this.stores.recipePreviews.dev.map(
28 (recipePreview: { isDevRecipe: boolean; author: any[] }) => { 28 (recipePreview: { isDevRecipe: boolean; author: any[] }) => {
29 // TODO: Need to figure out if this is even necessary/used 29 // TODO: Need to figure out if this is even necessary/used
30 // eslint-disable-next-line no-param-reassign
30 recipePreview.isDevRecipe = !!recipePreview.author.some( 31 recipePreview.isDevRecipe = !!recipePreview.author.some(
31 (author: { email: string }) => 32 (author: { email: string }) =>
32 author.email === this.stores.user.data.email, 33 author.email === this.stores.user.data.email,
diff --git a/src/features/quickSwitch/Component.tsx b/src/features/quickSwitch/Component.tsx
index 4a48b1e6c..3a7477f62 100644
--- a/src/features/quickSwitch/Component.tsx
+++ b/src/features/quickSwitch/Component.tsx
@@ -302,6 +302,7 @@ class QuickSwitchModal extends Component<IProps, IState> {
302 isOpen={isModalVisible} 302 isOpen={isModalVisible}
303 className={`${classes.modal} quick-switch`} 303 className={`${classes.modal} quick-switch`}
304 shouldCloseOnOverlayClick 304 shouldCloseOnOverlayClick
305 // eslint-disable-next-line react/jsx-no-bind
305 close={this.close.bind(this)} 306 close={this.close.bind(this)}
306 > 307 >
307 <H1 className={classes.headline}> 308 <H1 className={classes.headline}>
@@ -318,6 +319,7 @@ class QuickSwitchModal extends Component<IProps, IState> {
318 319
319 <div className={classes.services}> 320 <div className={classes.services}>
320 {services.map((service, index) => ( 321 {services.map((service, index) => (
322 // eslint-disable-next-line jsx-a11y/no-static-element-interactions
321 <div 323 <div
322 className={`${classes.service} ${ 324 className={`${classes.service} ${
323 this.state.selected === index 325 this.state.selected === index
diff --git a/src/features/todos/actions.ts b/src/features/todos/actions.ts
index c2000752f..27c7e489b 100644
--- a/src/features/todos/actions.ts
+++ b/src/features/todos/actions.ts
@@ -36,6 +36,7 @@ export const todoActions = createActionsFromDefinitions<TodoActionsType>(
36 channel: PropTypes.string.isRequired, 36 channel: PropTypes.string.isRequired,
37 message: PropTypes.shape({ 37 message: PropTypes.shape({
38 action: PropTypes.string.isRequired, 38 action: PropTypes.string.isRequired,
39 // eslint-disable-next-line react/forbid-prop-types
39 data: PropTypes.object, 40 data: PropTypes.object,
40 }), 41 }),
41 }, 42 },
diff --git a/src/features/todos/components/TodosWebview.tsx b/src/features/todos/components/TodosWebview.tsx
index f9493d519..544768bbf 100644
--- a/src/features/todos/components/TodosWebview.tsx
+++ b/src/features/todos/components/TodosWebview.tsx
@@ -92,6 +92,7 @@ class TodosWebview extends Component<IProps, IState> {
92 } 92 }
93 93
94 componentDidMount() { 94 componentDidMount() {
95 // eslint-disable-next-line @eslint-react/no-set-state-in-component-did-mount
95 this.setState({ 96 this.setState({
96 width: this.props.width, 97 width: this.props.width,
97 }); 98 });
@@ -173,6 +174,7 @@ class TodosWebview extends Component<IProps, IState> {
173 } 174 }
174 175
175 return ( 176 return (
177 // eslint-disable-next-line jsx-a11y/no-static-element-interactions
176 <div 178 <div
177 className={classnames({ 179 className={classnames({
178 [classes.root]: true, 180 [classes.root]: true,
@@ -185,6 +187,7 @@ class TodosWebview extends Component<IProps, IState> {
185 ref={this.node} 187 ref={this.node}
186 id="todos-panel" 188 id="todos-panel"
187 > 189 >
190 {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
188 <div 191 <div
189 className={classes.resizeHandler} 192 className={classes.resizeHandler}
190 style={{ 193 style={{
diff --git a/src/features/todos/index.ts b/src/features/todos/index.ts
index 2fa8c3130..5465ed48a 100644
--- a/src/features/todos/index.ts
+++ b/src/features/todos/index.ts
@@ -3,6 +3,7 @@ import TodoStore from './store';
3export const todosStore = new TodoStore(); 3export const todosStore = new TodoStore();
4 4
5export default function initTodos(stores: { todos?: any }, actions: any) { 5export default function initTodos(stores: { todos?: any }, actions: any) {
6 // eslint-disable-next-line no-param-reassign
6 stores.todos = todosStore; 7 stores.todos = todosStore;
7 todosStore.start(stores, actions); 8 todosStore.start(stores, actions);
8} 9}
diff --git a/src/features/webControls/containers/WebControlsScreen.tsx b/src/features/webControls/containers/WebControlsScreen.tsx
index b492264bf..8709fcba5 100644
--- a/src/features/webControls/containers/WebControlsScreen.tsx
+++ b/src/features/webControls/containers/WebControlsScreen.tsx
@@ -118,8 +118,10 @@ class WebControlsScreen extends Component<IProps> {
118 } 118 }
119 119
120 try { 120 try {
121 // eslint-disable-next-line no-param-reassign
121 url = new URL(url).toString(); 122 url = new URL(url).toString();
122 } catch { 123 } catch {
124 // eslint-disable-next-line no-param-reassign
123 url = 125 url =
124 /^((?!-))(xn--)?[\da-z][\d_a-z-]{0,61}[\da-z]{0,1}\.(xn--)?([\da-z-]{1,61}|[\da-z-]{1,30}\.[a-z]{2,})$/.test( 126 /^((?!-))(xn--)?[\da-z][\d_a-z-]{0,61}[\da-z]{0,1}\.(xn--)?([\da-z-]{1,61}|[\da-z-]{1,30}\.[a-z]{2,})$/.test(
125 url, 127 url,
diff --git a/src/features/workspaces/components/CreateWorkspaceForm.tsx b/src/features/workspaces/components/CreateWorkspaceForm.tsx
index 0c365564a..b35ffe4d8 100644
--- a/src/features/workspaces/components/CreateWorkspaceForm.tsx
+++ b/src/features/workspaces/components/CreateWorkspaceForm.tsx
@@ -81,6 +81,7 @@ class CreateWorkspaceForm extends Component<IProps> {
81 className={classes.input} 81 className={classes.input}
82 showLabel={false} 82 showLabel={false}
83 // @ts-expect-error Expected 1 arguments, but got 2. 83 // @ts-expect-error Expected 1 arguments, but got 2.
84 // eslint-disable-next-line react/jsx-no-bind
84 onEnterKey={this.submitForm.bind(this, form)} 85 onEnterKey={this.submitForm.bind(this, form)}
85 focus={workspaceStore.isUserAllowedToUseFeature} 86 focus={workspaceStore.isUserAllowedToUseFeature}
86 /> 87 />
@@ -89,6 +90,7 @@ class CreateWorkspaceForm extends Component<IProps> {
89 type="submit" 90 type="submit"
90 label={intl.formatMessage(messages.submitButton)} 91 label={intl.formatMessage(messages.submitButton)}
91 // @ts-expect-error Expected 1 arguments, but got 2. 92 // @ts-expect-error Expected 1 arguments, but got 2.
93 // eslint-disable-next-line react/jsx-no-bind
92 onClick={this.submitForm.bind(this, form)} 94 onClick={this.submitForm.bind(this, form)}
93 busy={isSubmitting} 95 busy={isSubmitting}
94 buttonType={isSubmitting ? 'secondary' : 'primary'} 96 buttonType={isSubmitting ? 'secondary' : 'primary'}
diff --git a/src/features/workspaces/components/EditWorkspaceForm.tsx b/src/features/workspaces/components/EditWorkspaceForm.tsx
index 18e7c251e..cc7a2b19b 100644
--- a/src/features/workspaces/components/EditWorkspaceForm.tsx
+++ b/src/features/workspaces/components/EditWorkspaceForm.tsx
@@ -92,6 +92,7 @@ class EditWorkspaceForm extends Component<IProps> {
92 this.form = this.prepareWorkspaceForm(this.props.workspace); 92 this.form = this.prepareWorkspaceForm(this.props.workspace);
93 } 93 }
94 94
95 // eslint-disable-next-line @eslint-react/no-unsafe-component-will-receive-props
95 UNSAFE_componentWillReceiveProps(nextProps): void { 96 UNSAFE_componentWillReceiveProps(nextProps): void {
96 const { workspace } = this.props; 97 const { workspace } = this.props;
97 if (workspace.id !== nextProps.workspace.id) { 98 if (workspace.id !== nextProps.workspace.id) {
@@ -178,11 +179,11 @@ class EditWorkspaceForm extends Component<IProps> {
178 <span className="settings__header-item">{workspace.name}</span> 179 <span className="settings__header-item">{workspace.name}</span>
179 </div> 180 </div>
180 <div className="settings__body"> 181 <div className="settings__body">
181 {updateWorkspaceRequest.error && ( 182 {updateWorkspaceRequest.error ? (
182 <Infobox icon="alert" type="danger"> 183 <Infobox icon="alert" type="danger">
183 Error while saving workspace 184 Error while saving workspace
184 </Infobox> 185 </Infobox>
185 )} 186 ) : null}
186 <div className={classes.nameInput}> 187 <div className={classes.nameInput}>
187 <Input {...form.$('name').bind()} /> 188 <Input {...form.$('name').bind()} />
188 <Toggle {...form.$('keepLoaded').bind()} /> 189 <Toggle {...form.$('keepLoaded').bind()} />
@@ -228,6 +229,7 @@ class EditWorkspaceForm extends Component<IProps> {
228 buttonType={isDeleting ? 'secondary' : 'danger'} 229 buttonType={isDeleting ? 'secondary' : 'danger'}
229 className="settings__delete-button" 230 className="settings__delete-button"
230 disabled={isDeleting} 231 disabled={isDeleting}
232 // eslint-disable-next-line react/jsx-no-bind
231 onClick={this.delete.bind(this)} 233 onClick={this.delete.bind(this)}
232 /> 234 />
233 {/* ===== Save Button ===== */} 235 {/* ===== Save Button ===== */}
@@ -237,6 +239,7 @@ class EditWorkspaceForm extends Component<IProps> {
237 busy={isSaving} 239 busy={isSaving}
238 className="franz-form__button" 240 className="franz-form__button"
239 buttonType={isSaving ? 'secondary' : 'primary'} 241 buttonType={isSaving ? 'secondary' : 'primary'}
242 // eslint-disable-next-line react/jsx-no-bind
240 onClick={this.save.bind(this, form)} 243 onClick={this.save.bind(this, form)}
241 // TODO: Need to disable if no services have been added to this workspace 244 // TODO: Need to disable if no services have been added to this workspace
242 disabled={isSaving} 245 disabled={isSaving}
diff --git a/src/features/workspaces/components/WorkspaceDrawer.tsx b/src/features/workspaces/components/WorkspaceDrawer.tsx
index cce333b31..e92bc4b60 100644
--- a/src/features/workspaces/components/WorkspaceDrawer.tsx
+++ b/src/features/workspaces/components/WorkspaceDrawer.tsx
@@ -129,6 +129,7 @@ class WorkspaceDrawer extends Component<IProps> {
129 <div className={`${classes.drawer} workspaces-drawer`}> 129 <div className={`${classes.drawer} workspaces-drawer`}>
130 <H1 className={classes.headline}> 130 <H1 className={classes.headline}>
131 {intl.formatMessage(messages.headline)} 131 {intl.formatMessage(messages.headline)}
132 {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
132 <span 133 <span
133 className={classes.workspacesSettingsButton} 134 className={classes.workspacesSettingsButton}
134 onKeyDown={noop} 135 onKeyDown={noop}
@@ -179,6 +180,7 @@ class WorkspaceDrawer extends Component<IProps> {
179 shortcutIndex={index + 1} 180 shortcutIndex={index + 1}
180 /> 181 />
181 ))} 182 ))}
183 {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
182 <div 184 <div
183 className={classes.addNewWorkspaceLabel} 185 className={classes.addNewWorkspaceLabel}
184 onClick={() => { 186 onClick={() => {
diff --git a/src/features/workspaces/components/WorkspaceDrawerItem.tsx b/src/features/workspaces/components/WorkspaceDrawerItem.tsx
index 1e4b57dba..01a18ffb0 100644
--- a/src/features/workspaces/components/WorkspaceDrawerItem.tsx
+++ b/src/features/workspaces/components/WorkspaceDrawerItem.tsx
@@ -111,6 +111,7 @@ class WorkspaceDrawerItem extends Component<IProps> {
111 const contextMenu = Menu.buildFromTemplate(contextMenuTemplate); 111 const contextMenu = Menu.buildFromTemplate(contextMenuTemplate);
112 112
113 return ( 113 return (
114 // eslint-disable-next-line jsx-a11y/no-static-element-interactions
114 <div 115 <div
115 className={classnames([ 116 className={classnames([
116 classes.item, 117 classes.item,
diff --git a/src/features/workspaces/components/WorkspaceServiceListItem.tsx b/src/features/workspaces/components/WorkspaceServiceListItem.tsx
index 6f61f8a51..a56e5802f 100644
--- a/src/features/workspaces/components/WorkspaceServiceListItem.tsx
+++ b/src/features/workspaces/components/WorkspaceServiceListItem.tsx
@@ -42,6 +42,7 @@ class WorkspaceServiceListItem extends Component<IProps> {
42 const { classes, isInWorkspace, onToggle, service } = this.props; 42 const { classes, isInWorkspace, onToggle, service } = this.props;
43 return ( 43 return (
44 // onclick in below div used to fix bug raised under toggle duplicate component removal 44 // onclick in below div used to fix bug raised under toggle duplicate component removal
45 // eslint-disable-next-line jsx-a11y/no-static-element-interactions
45 <div className={classes.listItem} onClick={onToggle} onKeyDown={noop}> 46 <div className={classes.listItem} onClick={onToggle} onKeyDown={noop}>
46 <ServiceIcon className={classes.serviceIcon} service={service} /> 47 <ServiceIcon className={classes.serviceIcon} service={service} />
47 <span 48 <span
diff --git a/src/features/workspaces/components/WorkspacesDashboard.tsx b/src/features/workspaces/components/WorkspacesDashboard.tsx
index 8fb2cf923..ad54c6682 100644
--- a/src/features/workspaces/components/WorkspacesDashboard.tsx
+++ b/src/features/workspaces/components/WorkspacesDashboard.tsx
@@ -105,33 +105,33 @@ class WorkspacesDashboard extends Component<IProps> {
105 <div className="settings__body"> 105 <div className="settings__body">
106 {/* ===== Workspace updated info ===== */} 106 {/* ===== Workspace updated info ===== */}
107 {updateWorkspaceRequest.wasExecuted && 107 {updateWorkspaceRequest.wasExecuted &&
108 updateWorkspaceRequest.result && ( 108 updateWorkspaceRequest.result ? (
109 <Appear className={classes.appear}> 109 <Appear className={classes.appear}>
110 <Infobox 110 <Infobox
111 type="success" 111 type="success"
112 icon="checkbox-marked-circle-outline" 112 icon="checkbox-marked-circle-outline"
113 dismissible 113 dismissible
114 onUnmount={updateWorkspaceRequest.reset} 114 onUnmount={updateWorkspaceRequest.reset}
115 > 115 >
116 {intl.formatMessage(messages.updatedInfo)} 116 {intl.formatMessage(messages.updatedInfo)}
117 </Infobox> 117 </Infobox>
118 </Appear> 118 </Appear>
119 )} 119 ) : null}
120 120
121 {/* ===== Workspace deleted info ===== */} 121 {/* ===== Workspace deleted info ===== */}
122 {deleteWorkspaceRequest.wasExecuted && 122 {deleteWorkspaceRequest.wasExecuted &&
123 deleteWorkspaceRequest.result && ( 123 deleteWorkspaceRequest.result ? (
124 <Appear className={classes.appear}> 124 <Appear className={classes.appear}>
125 <Infobox 125 <Infobox
126 type="success" 126 type="success"
127 icon="checkbox-marked-circle-outline" 127 icon="checkbox-marked-circle-outline"
128 dismissible 128 dismissible
129 onUnmount={deleteWorkspaceRequest.reset} 129 onUnmount={deleteWorkspaceRequest.reset}
130 > 130 >
131 {intl.formatMessage(messages.deletedInfo)} 131 {intl.formatMessage(messages.deletedInfo)}
132 </Infobox> 132 </Infobox>
133 </Appear> 133 </Appear>
134 )} 134 ) : null}
135 135
136 {/* ===== Create workspace form ===== */} 136 {/* ===== Create workspace form ===== */}
137 <div className={classes.createForm}> 137 <div className={classes.createForm}>
@@ -169,7 +169,7 @@ class WorkspacesDashboard extends Component<IProps> {
169 </p> 169 </p>
170 </div> 170 </div>
171 ) : ( 171 ) : (
172 <table className={classes.table} role="grid"> 172 <table className={classes.table}>
173 {/* ===== Workspaces list ===== */} 173 {/* ===== Workspaces list ===== */}
174 <tbody> 174 <tbody>
175 {workspaces.map(workspace => ( 175 {workspaces.map(workspace => (
diff --git a/src/features/workspaces/index.ts b/src/features/workspaces/index.ts
index 25975936a..cbe5bb5fd 100644
--- a/src/features/workspaces/index.ts
+++ b/src/features/workspaces/index.ts
@@ -3,6 +3,7 @@ import WorkspacesStore from './store';
3export const workspaceStore = new WorkspacesStore(); 3export const workspaceStore = new WorkspacesStore();
4 4
5export default function initWorkspaces(stores, actions) { 5export default function initWorkspaces(stores, actions) {
6 // eslint-disable-next-line no-param-reassign
6 stores.workspaces = workspaceStore; 7 stores.workspaces = workspaceStore;
7 workspaceStore.start(stores, actions); 8 workspaceStore.start(stores, actions);
8} 9}