From c09a535653e93933800a3a7bda2f0afc370bb19e Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Sun, 16 Jan 2022 19:47:16 +0100 Subject: [PATCH] chore: suit eslint rules --- .../src/apps/discord/authentication.ts | 1 - .../src/apps/firebase/authentication.ts | 2 +- .../backend/src/apps/github/authentication.ts | 10 +- .../backend/src/apps/twitch/authentication.ts | 2 +- .../src/graphql/mutations/execute-step.ts | 12 +- .../src/graphql/mutations/update-step.ts | 1 - .../backend/src/graphql/queries/get-flows.ts | 4 +- .../src/graphql/queries/test-connection.ts | 2 +- packages/backend/src/graphql/types/action.ts | 6 +- packages/backend/src/graphql/types/app.ts | 1 + .../backend/src/graphql/types/connection.ts | 1 + packages/backend/src/graphql/types/step.ts | 2 +- packages/backend/src/graphql/types/trigger.ts | 6 +- .../backend/src/helpers/authentication.ts | 4 +- packages/backend/src/helpers/error-handler.ts | 8 +- packages/backend/src/models/base.ts | 6 +- packages/backend/src/models/connection.ts | 15 +- packages/cli/__tests__/cli.test.js | 7 - packages/cli/src/cli.js | 3 +- .../src/components/AddAppConnection/index.tsx | 2 +- .../components/AddNewAppConnection/index.tsx | 6 +- .../src/components/ApolloProvider/index.tsx | 2 +- packages/web/src/components/AppBar/index.tsx | 3 +- .../AppConnectionContextMenu/index.tsx | 2 +- .../src/components/AppConnectionRow/index.tsx | 6 +- .../src/components/AppConnectionRow/style.ts | 2 +- .../src/components/AppConnections/index.tsx | 2 +- .../web/src/components/AppFlowRow/index.tsx | 2 +- .../web/src/components/AppFlowRow/style.ts | 2 +- .../web/src/components/AppFlows/index.tsx | 6 +- packages/web/src/components/AppIcon/index.tsx | 2 +- packages/web/src/components/AppRow/index.tsx | 3 +- packages/web/src/components/AppRow/style.ts | 2 +- .../ConditionalIconButton/index.tsx | 6 +- .../web/src/components/Container/index.tsx | 3 +- packages/web/src/components/Drawer/index.tsx | 2 +- packages/web/src/components/Editor/index.tsx | 2 +- .../web/src/components/EditorLayout/index.tsx | 6 +- packages/web/src/components/FlowRow/index.tsx | 2 +- packages/web/src/components/FlowRow/style.ts | 2 +- .../web/src/components/FlowStep/index.tsx | 2 +- packages/web/src/components/Form/index.tsx | 4 +- .../web/src/components/HideOnScroll/index.tsx | 3 +- .../web/src/components/InputCreator/index.tsx | 5 +- .../web/src/components/IntlProvider/index.tsx | 2 +- packages/web/src/components/Layout/index.tsx | 6 +- .../web/src/components/ListItemLink/index.tsx | 2 +- .../src/components/NoResultFound/index.tsx | 2 +- .../web/src/components/PageTitle/index.tsx | 3 +- .../web/src/components/SearchInput/index.tsx | 3 +- .../src/components/SnackbarProvider/index.tsx | 3 +- .../web/src/components/TabPanel/index.tsx | 4 +- .../web/src/components/TextField/index.tsx | 8 +- .../src/components/ThemeProvider/index.tsx | 3 +- packages/web/src/config/urls.ts | 14 +- packages/web/src/graphql/cache.ts | 2 +- packages/web/src/graphql/client.ts | 2 +- packages/web/src/graphql/link.ts | 10 +- .../web/src/helpers/authenticationSteps.ts | 31 +- .../src/helpers/computeAuthStepVariables.ts | 17 +- packages/web/src/helpers/copyInputValue.ts | 3 +- packages/web/src/hooks/useFormatMessage.tsx | 2 +- packages/web/src/pages/Application/index.tsx | 6 +- packages/web/src/pages/Applications/index.tsx | 2 +- packages/web/src/pages/Editor/create.tsx | 2 +- packages/web/src/pages/Editor/index.tsx | 3 +- packages/web/src/pages/Editor/routes.tsx | 2 +- packages/web/src/pages/Explore/index.tsx | 3 +- packages/web/src/pages/Flow/index.tsx | 21 +- packages/web/src/pages/Flows/index.tsx | 4 +- packages/web/src/reportWebVitals.ts | 2 +- packages/web/src/types/step.ts | 1 + yarn.lock | 3411 +++++------------ 73 files changed, 1197 insertions(+), 2549 deletions(-) delete mode 100644 packages/cli/__tests__/cli.test.js diff --git a/packages/backend/src/apps/discord/authentication.ts b/packages/backend/src/apps/discord/authentication.ts index a644c89a..251ac747 100644 --- a/packages/backend/src/apps/discord/authentication.ts +++ b/packages/backend/src/apps/discord/authentication.ts @@ -1,5 +1,4 @@ import { URLSearchParams } from 'url'; -import DiscordApi from 'discord.js'; import axios, { AxiosInstance } from 'axios'; import App from '../../models/app'; import Field from '../../types/field'; diff --git a/packages/backend/src/apps/firebase/authentication.ts b/packages/backend/src/apps/firebase/authentication.ts index cacf56a4..7dcb2d01 100644 --- a/packages/backend/src/apps/firebase/authentication.ts +++ b/packages/backend/src/apps/firebase/authentication.ts @@ -1,4 +1,4 @@ -import { google, google as GoogleApi } from 'googleapis'; +import { google as GoogleApi } from 'googleapis'; import App from '../../models/app'; import Field from '../../types/field'; diff --git a/packages/backend/src/apps/github/authentication.ts b/packages/backend/src/apps/github/authentication.ts index 2d492016..c3d8bcf6 100644 --- a/packages/backend/src/apps/github/authentication.ts +++ b/packages/backend/src/apps/github/authentication.ts @@ -16,11 +16,11 @@ export default class Authentication { this.appData = App.findOneByKey('github'); } - get oauthRedirectUrl() { + get oauthRedirectUrl(): string { return this.appData.fields.find((field: Field) => field.key == 'oAuthRedirectUrl').value; } - async createAuthData() { + async createAuthData(): { url: string } { const { url } = await getWebFlowAuthorizationUrl({ clientType: "oauth-app", clientId: this.connectionData.consumerKey, @@ -33,8 +33,8 @@ export default class Authentication { }; } - async verifyCredentials() { - const { data, authentication } = await exchangeWebFlowCode({ + async verifyCredentials(): any { + const { data } = await exchangeWebFlowCode({ clientType: "oauth-app", clientId: this.connectionData.consumerKey, clientSecret: this.connectionData.consumerSecret, @@ -65,7 +65,7 @@ export default class Authentication { }); } - async isStillVerified() { + async isStillVerified(): boolean { try { await this.getTokenInfo(); diff --git a/packages/backend/src/apps/twitch/authentication.ts b/packages/backend/src/apps/twitch/authentication.ts index a35325ea..9a8b2274 100644 --- a/packages/backend/src/apps/twitch/authentication.ts +++ b/packages/backend/src/apps/twitch/authentication.ts @@ -1,4 +1,4 @@ -import TwitchApi, { ApiVersions } from 'twitch-js'; +import TwitchApi from 'twitch-js'; import fetchUtil from 'twitch-js/lib/utils/fetch'; import App from '../../models/app'; import Field from '../../types/field'; diff --git a/packages/backend/src/graphql/mutations/execute-step.ts b/packages/backend/src/graphql/mutations/execute-step.ts index 2b772a74..37494c37 100644 --- a/packages/backend/src/graphql/mutations/execute-step.ts +++ b/packages/backend/src/graphql/mutations/execute-step.ts @@ -1,20 +1,18 @@ import { GraphQLInt, GraphQLNonNull } from 'graphql'; -import App from '../../models/app'; import Connection from '../../models/connection'; import Step from '../../models/step'; import stepType from '../types/step'; -import RequestWithCurrentUser from '../../types/express/request-with-current-user'; type Params = { id: number, - data: object + data: Record } -const executeStepResolver = async (params: Params, req: RequestWithCurrentUser) => { - let step = await Step.query().findOne({ +const executeStepResolver = async (params: Params): Promise => { + const step = await Step.query().findOne({ id: params.id }).throwIfNotFound(); - let connection = await Connection.query().findOne({ + const connection = await Connection.query().findOne({ id: step.connectionId }).throwIfNotFound(); @@ -30,7 +28,7 @@ const executeStep = { args: { id: { type: GraphQLNonNull(GraphQLInt) } }, - resolve: (_: any, params: Params, req: RequestWithCurrentUser) => executeStepResolver(params, req) + resolve: (_: any, params: Params) => executeStepResolver(params) }; export default executeStep; diff --git a/packages/backend/src/graphql/mutations/update-step.ts b/packages/backend/src/graphql/mutations/update-step.ts index f89a4695..adda2842 100644 --- a/packages/backend/src/graphql/mutations/update-step.ts +++ b/packages/backend/src/graphql/mutations/update-step.ts @@ -1,7 +1,6 @@ import { GraphQLInt, GraphQLString, GraphQLNonNull } from 'graphql'; import Flow from '../../models/flow'; import Step from '../../models/step'; -import flowType from '../types/flow'; import stepType from '../types/step'; import availableAppsEnumType from '../types/available-apps-enum-type'; import RequestWithCurrentUser from '../../types/express/request-with-current-user'; diff --git a/packages/backend/src/graphql/queries/get-flows.ts b/packages/backend/src/graphql/queries/get-flows.ts index c1437d85..eb87515b 100644 --- a/packages/backend/src/graphql/queries/get-flows.ts +++ b/packages/backend/src/graphql/queries/get-flows.ts @@ -1,9 +1,9 @@ -import { GraphQLList, GraphQLString } from 'graphql'; +import { GraphQLList } from 'graphql'; import Flow from '../../models/flow'; import RequestWithCurrentUser from '../../types/express/request-with-current-user'; import flowType from '../types/flow'; -const getFlowsResolver = async (req: RequestWithCurrentUser) => { +const getFlowsResolver = async (req: RequestWithCurrentUser): Promise => { const flows = await Flow.query() .withGraphJoined('[steps.[connection]]') .where({'flows.user_id': req.currentUser.id}); diff --git a/packages/backend/src/graphql/queries/test-connection.ts b/packages/backend/src/graphql/queries/test-connection.ts index f264750e..085b9e0e 100644 --- a/packages/backend/src/graphql/queries/test-connection.ts +++ b/packages/backend/src/graphql/queries/test-connection.ts @@ -1,4 +1,4 @@ -import { GraphQLString, GraphQLNonNull, GraphQLBoolean } from 'graphql'; +import { GraphQLString, GraphQLNonNull } from 'graphql'; import Connection from '../../models/connection'; import RequestWithCurrentUser from '../../types/express/request-with-current-user'; import connectionType from '../types/connection' diff --git a/packages/backend/src/graphql/types/action.ts b/packages/backend/src/graphql/types/action.ts index 17c1844e..4def1d2e 100644 --- a/packages/backend/src/graphql/types/action.ts +++ b/packages/backend/src/graphql/types/action.ts @@ -1,4 +1,4 @@ -import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLInt, GraphQLBoolean } from 'graphql'; +import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLBoolean } from 'graphql'; const actionType = new GraphQLObjectType({ name: 'Action', @@ -6,13 +6,13 @@ const actionType = new GraphQLObjectType({ name: { type: GraphQLString }, key: { type: GraphQLString }, description: { type: GraphQLString }, - subSteps: { + subSteps: { type: GraphQLList( new GraphQLObjectType({ name: 'ActionSubStep', fields: { name: { type: GraphQLString }, - arguments: { + arguments: { type: GraphQLList( new GraphQLObjectType({ name: 'ActionSubStepArgument', diff --git a/packages/backend/src/graphql/types/app.ts b/packages/backend/src/graphql/types/app.ts index 915e730a..ea50d753 100644 --- a/packages/backend/src/graphql/types/app.ts +++ b/packages/backend/src/graphql/types/app.ts @@ -8,6 +8,7 @@ import actionType from './action'; const appType = new GraphQLObjectType({ name: 'App', fields: () => { + // eslint-disable-next-line @typescript-eslint/no-var-requires const connectionType = require('./connection').default; return { diff --git a/packages/backend/src/graphql/types/connection.ts b/packages/backend/src/graphql/types/connection.ts index 21e1d554..fb4d9f45 100644 --- a/packages/backend/src/graphql/types/connection.ts +++ b/packages/backend/src/graphql/types/connection.ts @@ -4,6 +4,7 @@ import connectionDataType from './connection-data'; const connectionType = new GraphQLObjectType({ name: 'Connection', fields: () => { + // eslint-disable-next-line @typescript-eslint/no-var-requires const appType = require('./app').default; return { diff --git a/packages/backend/src/graphql/types/step.ts b/packages/backend/src/graphql/types/step.ts index cf4ee8a5..f0fb6809 100644 --- a/packages/backend/src/graphql/types/step.ts +++ b/packages/backend/src/graphql/types/step.ts @@ -1,4 +1,4 @@ -import { GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLEnumType, GraphQLInt } from 'graphql'; +import { GraphQLObjectType, GraphQLString, GraphQLEnumType, GraphQLInt } from 'graphql'; import ConnectionType from './connection'; const stepType = new GraphQLObjectType({ diff --git a/packages/backend/src/graphql/types/trigger.ts b/packages/backend/src/graphql/types/trigger.ts index 0918a476..f2a6b7fa 100644 --- a/packages/backend/src/graphql/types/trigger.ts +++ b/packages/backend/src/graphql/types/trigger.ts @@ -1,4 +1,4 @@ -import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLInt, GraphQLBoolean } from 'graphql'; +import { GraphQLObjectType, GraphQLString, GraphQLList, GraphQLBoolean } from 'graphql'; const triggerType = new GraphQLObjectType({ name: 'Trigger', @@ -6,13 +6,13 @@ const triggerType = new GraphQLObjectType({ name: { type: GraphQLString }, key: { type: GraphQLString }, description: { type: GraphQLString }, - subSteps: { + subSteps: { type: GraphQLList( new GraphQLObjectType({ name: 'TriggerSubStep', fields: { name: { type: GraphQLString }, - arguments: { + arguments: { type: GraphQLList( new GraphQLObjectType({ name: 'TriggerSubStepArgument', diff --git a/packages/backend/src/helpers/authentication.ts b/packages/backend/src/helpers/authentication.ts index b858370d..f636f8d3 100644 --- a/packages/backend/src/helpers/authentication.ts +++ b/packages/backend/src/helpers/authentication.ts @@ -1,8 +1,8 @@ -import { Request, Response, NextFunction } from 'express'; +import { Response, NextFunction } from 'express'; import User from '../models/user'; import RequestWithCurrentUser from '../types/express/request-with-current-user'; -const authentication = async (req: RequestWithCurrentUser, _res: Response, next: NextFunction) => { +const authentication = async (req: RequestWithCurrentUser, _res: Response, next: NextFunction): Promise => { // We set authentication to use the sample user we created temporarily. req.currentUser = await User.query().findOne({ email: 'user@automatisch.com' diff --git a/packages/backend/src/helpers/error-handler.ts b/packages/backend/src/helpers/error-handler.ts index 11ae7e92..f20d409d 100644 --- a/packages/backend/src/helpers/error-handler.ts +++ b/packages/backend/src/helpers/error-handler.ts @@ -1,7 +1,11 @@ -import { Request, Response, NextFunction } from 'express'; +import { Request, Response } from 'express'; import logger from './logger'; -const errorHandler = (err: any, req: Request, res: Response, _next: NextFunction) => { +type Error = { + message: string; +} + +const errorHandler = (err: Error, req: Request, res: Response): void => { if(err.message === 'Not Found') { res.status(404).end() } else { diff --git a/packages/backend/src/models/base.ts b/packages/backend/src/models/base.ts index 59909592..20e5d8bc 100644 --- a/packages/backend/src/models/base.ts +++ b/packages/backend/src/models/base.ts @@ -1,5 +1,5 @@ import { Model, snakeCaseMappers } from 'objection'; -import type { Constructor, TransactionOrKnex, QueryBuilderType, QueryContext, ModelOptions, ColumnNameMappers } from 'objection'; +import type { QueryContext, ModelOptions, ColumnNameMappers } from 'objection'; class Base extends Model { createdAt!: string; @@ -9,14 +9,14 @@ class Base extends Model { return snakeCaseMappers(); } - async $beforeInsert(queryContext: QueryContext) { + async $beforeInsert(queryContext: QueryContext): Promise { await super.$beforeInsert(queryContext); this.createdAt = new Date().toISOString(); this.updatedAt = new Date().toISOString(); } - async $beforeUpdate(opt: ModelOptions, queryContext: QueryContext) { + async $beforeUpdate(opt: ModelOptions, queryContext: QueryContext): Promise { await super.$beforeUpdate(opt, queryContext); this.updatedAt = new Date().toISOString(); diff --git a/packages/backend/src/models/connection.ts b/packages/backend/src/models/connection.ts index a3081f9a..893acc43 100644 --- a/packages/backend/src/models/connection.ts +++ b/packages/backend/src/models/connection.ts @@ -1,4 +1,5 @@ import { QueryContext, ModelOptions } from 'objection'; +import type { RelationMappings } from 'objection'; import { AES, enc } from 'crypto-js'; import Base from './base' import User from './user' @@ -27,7 +28,7 @@ class Connection extends Base { } } - static relationMappings = () => ({ + static relationMappings = (): RelationMappings => ({ user: { relation: Base.BelongsToOneRelation, modelClass: User, @@ -38,33 +39,33 @@ class Connection extends Base { } }) - encryptData() { + encryptData(): void { if(!this.eligibleForEncryption()) return; this.data = AES.encrypt(JSON.stringify(this.data), appConfig.encryptionKey).toString(); } - decryptData() { + decryptData(): void { if(!this.eligibleForEncryption()) return; this.data = JSON.parse(AES.decrypt(this.data, appConfig.encryptionKey).toString(enc.Utf8)); } - eligibleForEncryption() { + eligibleForEncryption(): boolean { return this.data ? true : false } // TODO: Make another abstraction like beforeSave instead of using // beforeInsert and beforeUpdate separately for the same operation. - async $beforeInsert(queryContext: QueryContext) { + async $beforeInsert(queryContext: QueryContext): Promise { await super.$beforeInsert(queryContext); this.encryptData(); } - async $beforeUpdate(opt: ModelOptions, queryContext: QueryContext) { + async $beforeUpdate(opt: ModelOptions, queryContext: QueryContext): Promise { await super.$beforeUpdate(opt, queryContext); this.encryptData(); } - async $afterFind(queryContext: QueryContext) { + async $afterFind(): Promise { this.decryptData(); } } diff --git a/packages/cli/__tests__/cli.test.js b/packages/cli/__tests__/cli.test.js deleted file mode 100644 index 79a6562a..00000000 --- a/packages/cli/__tests__/cli.test.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -const cli = require('..'); - -describe('cli', () => { - it('needs tests'); -}); diff --git a/packages/cli/src/cli.js b/packages/cli/src/cli.js index af3d5964..fb79baf7 100644 --- a/packages/cli/src/cli.js +++ b/packages/cli/src/cli.js @@ -1,7 +1,8 @@ 'use strict'; +// eslint-disable-next-line no-undef module.exports = cli; function cli() { - // TODO + // TODO } diff --git a/packages/web/src/components/AddAppConnection/index.tsx b/packages/web/src/components/AddAppConnection/index.tsx index 92c07b65..7f2a24bc 100644 --- a/packages/web/src/components/AddAppConnection/index.tsx +++ b/packages/web/src/components/AddAppConnection/index.tsx @@ -23,7 +23,7 @@ type Response = { [key: string]: any; } -export default function AddAppConnection(props: AddAppConnectionProps){ +export default function AddAppConnection(props: AddAppConnectionProps): React.ReactElement { const { application, connectionId, onClose } = props; const { key, fields, authenticationSteps, reconnectionSteps } = application; const formatMessage = useFormatMessage(); diff --git a/packages/web/src/components/AddNewAppConnection/index.tsx b/packages/web/src/components/AddNewAppConnection/index.tsx index eb0705e8..e4b2ceb5 100644 --- a/packages/web/src/components/AddNewAppConnection/index.tsx +++ b/packages/web/src/components/AddNewAppConnection/index.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import * as React from 'react'; import { useQuery } from '@apollo/client'; import { Link } from 'react-router-dom'; import { useTheme } from '@mui/material/styles'; @@ -27,12 +27,12 @@ type AddNewAppConnectionProps = { onClose: () => void; }; -export default function AddNewAppConnection(props: AddNewAppConnectionProps){ +export default function AddNewAppConnection(props: AddNewAppConnectionProps): React.ReactElement { const { onClose } = props; const theme = useTheme(); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('sm')); const formatMessage = useFormatMessage(); - const [appName, setAppName] = useState(null); + const [appName, setAppName] = React.useState(null); const { data } = useQuery(GET_APPS, { variables: {name: appName } }); return ( diff --git a/packages/web/src/components/ApolloProvider/index.tsx b/packages/web/src/components/ApolloProvider/index.tsx index 7fe39a4a..00716ce2 100644 --- a/packages/web/src/components/ApolloProvider/index.tsx +++ b/packages/web/src/components/ApolloProvider/index.tsx @@ -7,7 +7,7 @@ type ApolloProviderProps = { children: React.ReactNode; }; -const ApolloProvider = (props: ApolloProviderProps) => { +const ApolloProvider = (props: ApolloProviderProps): React.ReactElement => { const { enqueueSnackbar } = useSnackbar(); const onError = React.useCallback((message) => { diff --git a/packages/web/src/components/AppBar/index.tsx b/packages/web/src/components/AppBar/index.tsx index cbd69b0c..620200b3 100644 --- a/packages/web/src/components/AppBar/index.tsx +++ b/packages/web/src/components/AppBar/index.tsx @@ -1,3 +1,4 @@ +import * as React from 'react'; import { useTheme } from '@mui/material/styles'; import useMediaQuery from '@mui/material/useMediaQuery'; import MuiAppBar from '@mui/material/AppBar'; @@ -18,7 +19,7 @@ type AppBarProps = { onDrawerClose: () => void; }; -export default function AppBar({ drawerOpen, onDrawerOpen, onDrawerClose }: AppBarProps) { +export default function AppBar({ drawerOpen, onDrawerOpen, onDrawerClose }: AppBarProps): React.ReactElement { const theme = useTheme(); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), { noSsr: true }); diff --git a/packages/web/src/components/AppConnectionContextMenu/index.tsx b/packages/web/src/components/AppConnectionContextMenu/index.tsx index fcc64668..3ee2873c 100644 --- a/packages/web/src/components/AppConnectionContextMenu/index.tsx +++ b/packages/web/src/components/AppConnectionContextMenu/index.tsx @@ -19,7 +19,7 @@ type ContextMenuProps = { anchorEl: PopoverProps['anchorEl']; }; -export default function ContextMenu(props: ContextMenuProps) { +export default function ContextMenu(props: ContextMenuProps): React.ReactElement { const { appKey, connectionId, onClose, onMenuItemClick, anchorEl } = props; const formatMessage = useFormatMessage(); diff --git a/packages/web/src/components/AppConnectionRow/index.tsx b/packages/web/src/components/AppConnectionRow/index.tsx index 77c6d60e..8faeb035 100644 --- a/packages/web/src/components/AppConnectionRow/index.tsx +++ b/packages/web/src/components/AppConnectionRow/index.tsx @@ -31,7 +31,7 @@ const countTranslation = (value: React.ReactNode) => ( ); -function AppConnectionRow(props: AppConnectionRowProps) { +function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { const { enqueueSnackbar } = useSnackbar(); const [verificationVisible, setVerificationVisible] = React.useState(false); const [testConnection, { called: testCalled, loading: testLoading }] = useLazyQuery(TEST_CONNECTION, { @@ -51,12 +51,12 @@ function AppConnectionRow(props: AppConnectionRowProps) { setAnchorEl(null); }; - const onContextMenuClick = (event: React.MouseEvent) => setAnchorEl(contextButtonRef.current); + const onContextMenuClick = () => setAnchorEl(contextButtonRef.current); const onContextMenuAction = React.useCallback(async (event, action: { [key: string]: string }) => { if (action.type === 'delete') { await deleteConnection({ variables: { id }, - update: (cache, mutationResult) => { + update: (cache) => { const connectionCacheId = cache.identify({ __typename: 'Connection', id, diff --git a/packages/web/src/components/AppConnectionRow/style.ts b/packages/web/src/components/AppConnectionRow/style.ts index 30f9967b..903a4a26 100644 --- a/packages/web/src/components/AppConnectionRow/style.ts +++ b/packages/web/src/components/AppConnectionRow/style.ts @@ -11,7 +11,7 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ })); -export const Typography = styled(MuiTypography)(({ theme }) => ({ +export const Typography = styled(MuiTypography)(() => ({ textAlign: 'center', display: 'inline-block', })); diff --git a/packages/web/src/components/AppConnections/index.tsx b/packages/web/src/components/AppConnections/index.tsx index 7a01de02..42fc945f 100644 --- a/packages/web/src/components/AppConnections/index.tsx +++ b/packages/web/src/components/AppConnections/index.tsx @@ -12,7 +12,7 @@ type AppConnectionsProps = { appKey: string; } -export default function AppConnections(props: AppConnectionsProps) { +export default function AppConnections(props: AppConnectionsProps): React.ReactElement { const { appKey } = props; const formatMessage = useFormatMessage(); const { data } = useQuery(GET_APP_CONNECTIONS, { variables: { key: appKey } }); diff --git a/packages/web/src/components/AppFlowRow/index.tsx b/packages/web/src/components/AppFlowRow/index.tsx index 6dce387b..1d8745a3 100644 --- a/packages/web/src/components/AppFlowRow/index.tsx +++ b/packages/web/src/components/AppFlowRow/index.tsx @@ -12,7 +12,7 @@ type AppFlowRowProps = { flow: any; } -function AppFlowRow(props: AppFlowRowProps) { +function AppFlowRow(props: AppFlowRowProps): React.ReactElement { const { flow } = props; return ( diff --git a/packages/web/src/components/AppFlowRow/style.ts b/packages/web/src/components/AppFlowRow/style.ts index 6953d69b..31b02e04 100644 --- a/packages/web/src/components/AppFlowRow/style.ts +++ b/packages/web/src/components/AppFlowRow/style.ts @@ -11,7 +11,7 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ })); -export const Typography = styled(MuiTypography)(({ theme }) => ({ +export const Typography = styled(MuiTypography)(() => ({ display: 'inline-block', width: 300, maxWidth: '50%', diff --git a/packages/web/src/components/AppFlows/index.tsx b/packages/web/src/components/AppFlows/index.tsx index b43a2d4c..6ab5884f 100644 --- a/packages/web/src/components/AppFlows/index.tsx +++ b/packages/web/src/components/AppFlows/index.tsx @@ -4,11 +4,7 @@ import { GET_FLOWS } from 'graphql/queries/get-flows'; import AppFlowRow from 'components/AppFlowRow'; import type { Flow } from 'types/flow'; -type AppFlowsProps = { - appKey: String; -} - -export default function AppFlows(props: AppFlowsProps) { +export default function AppFlows(): React.ReactElement { const { data } = useQuery(GET_FLOWS); const appFlows: Flow[] = data?.getFlows || []; diff --git a/packages/web/src/components/AppIcon/index.tsx b/packages/web/src/components/AppIcon/index.tsx index 0d3e6d35..34de9347 100644 --- a/packages/web/src/components/AppIcon/index.tsx +++ b/packages/web/src/components/AppIcon/index.tsx @@ -12,7 +12,7 @@ const inlineImgStyle: React.CSSProperties = { objectFit: 'contain', }; -export default function AppIcon(props: AppIconProps & AvatarProps) { +export default function AppIcon(props: AppIconProps & AvatarProps): React.ReactElement { const { name, url, color, sx = {}, ...restProps } = props; return ( diff --git a/packages/web/src/components/AppRow/index.tsx b/packages/web/src/components/AppRow/index.tsx index c5141b8e..6a5864cf 100644 --- a/packages/web/src/components/AppRow/index.tsx +++ b/packages/web/src/components/AppRow/index.tsx @@ -1,3 +1,4 @@ +import * as React from 'react'; import { Link } from 'react-router-dom'; import Card from '@mui/material/Card'; import Box from '@mui/material/Box'; @@ -23,7 +24,7 @@ const countTranslation = (value: React.ReactNode) => ( ); -function AppRow(props: AppRowProps) { +function AppRow(props: AppRowProps): React.ReactElement { const formatMessage = useFormatMessage(); const { name, primaryColor, iconUrl, connectionCount } = props.application; diff --git a/packages/web/src/components/AppRow/style.ts b/packages/web/src/components/AppRow/style.ts index 89ee3a3b..56ff45ab 100644 --- a/packages/web/src/components/AppRow/style.ts +++ b/packages/web/src/components/AppRow/style.ts @@ -11,7 +11,7 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ })); -export const Typography = styled(MuiTypography)(({ theme }) => ({ +export const Typography = styled(MuiTypography)(() => ({ '&.MuiTypography-h6': { textTransform: 'capitalize', }, diff --git a/packages/web/src/components/ConditionalIconButton/index.tsx b/packages/web/src/components/ConditionalIconButton/index.tsx index 0a501b53..9f045798 100644 --- a/packages/web/src/components/ConditionalIconButton/index.tsx +++ b/packages/web/src/components/ConditionalIconButton/index.tsx @@ -2,10 +2,12 @@ import * as React from 'react'; import { useTheme } from '@mui/material/styles'; import useMediaQuery from '@mui/material/useMediaQuery'; import Button from '@mui/material/Button'; +import type { ButtonProps } from '@mui/material/Button'; import { IconButton } from './style'; -export default function ConditionalIconButton(props: any) { +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +export default function ConditionalIconButton(props: any): React.ReactElement { const { icon, ...buttonProps } = props; const theme = useTheme(); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), { noSsr: true }); @@ -24,6 +26,6 @@ export default function ConditionalIconButton(props: any) { } return ( -