diff --git a/.eslintrc.json b/.eslintrc.json
index 638d319307..a7e987556a 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -44,6 +44,53 @@
"extensions": [".tsx"]
}
],
+ "@typescript-eslint/ban-types": "error",
+ "@typescript-eslint/no-duplicate-enum-values": "error",
+ "@typescript-eslint/array-type": "error",
+ "@typescript-eslint/consistent-type-assertions": "error",
+ "@typescript-eslint/consistent-type-imports": "error",
+ "@typescript-eslint/explicit-function-return-type": "error",
+ "@typescript-eslint/naming-convention": [
+ "error",
+ // Interfaces must begin with Interface or TestInterface followed by a PascalCase name
+ {
+ "selector": "interface",
+ "format": ["PascalCase"],
+ "prefix": ["Interface", "TestInterface"]
+ },
+ // Type Aliases must be in PascalCase
+ {
+ "selector": ["typeAlias", "typeLike", "enum"],
+ "format": ["PascalCase"]
+ },
+ {
+ "selector": "typeParameter",
+ "format": ["PascalCase"],
+ "prefix": ["T"]
+ },
+ {
+ "selector": "variable",
+ "format": ["camelCase", "UPPER_CASE"],
+ "leadingUnderscore": "allow"
+ },
+ {
+ "selector": "parameter",
+ "format": ["camelCase"],
+ "leadingUnderscore": "allow"
+ },
+ {
+ "selector": "function",
+ "format": ["camelCase"]
+ },
+ {
+ "selector": "memberLike",
+ "modifiers": ["private"],
+ "format": ["camelCase"],
+ "leadingUnderscore": "require"
+ },
+
+ { "selector": "variable", "modifiers": ["exported"], "format": null }
+ ],
// Ensures that components are always written in PascalCase
"react/jsx-pascal-case": [
"error",
diff --git a/src/App.test.tsx b/src/App.test.tsx
index 2a629db12e..1b88c4e2d7 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -35,7 +35,7 @@ const MOCKS = [
const link = new StaticMockLink(MOCKS, true);
const link2 = new StaticMockLink([], true);
-async function wait(ms = 100) {
+async function wait(ms = 100): Promise {
await act(() => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
diff --git a/src/App.tsx b/src/App.tsx
index 21583fc2d6..981aa19e03 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -22,7 +22,7 @@ import Requests from 'screens/Requests/Requests';
import BlockUser from 'screens/BlockUser/BlockUser';
import MemberDetail from 'screens/MemberDetail/MemberDetail';
-function App(): JSX.Element {
+function app(): JSX.Element {
/*const { updatePluginLinks, updateInstalled } = bindActionCreators(
actionCreators,
dispatch
@@ -52,12 +52,12 @@ function App(): JSX.Element {
const extraRoutes = Object.entries(installedPlugins).map(
(plugin: any, index) => {
- const ExtraComponent = plugin[1];
+ const extraComponent = plugin[1];
return (
);
}
@@ -104,4 +104,4 @@ function App(): JSX.Element {
);
}
-export default App;
+export default app;
diff --git a/src/components/AddOn/AddOn.tsx b/src/components/AddOn/AddOn.tsx
index bf4a79bf7d..7ac6466979 100644
--- a/src/components/AddOn/AddOn.tsx
+++ b/src/components/AddOn/AddOn.tsx
@@ -2,21 +2,21 @@ import React from 'react';
import PropTypes from 'prop-types';
import AdminNavbar from 'components/AdminNavbar/AdminNavbar';
import { useSelector } from 'react-redux';
-import { RootState } from 'state/reducers';
+import type { RootState } from 'state/reducers';
-interface AddOnProps {
+interface InterfaceAddOnProps {
extras: any;
name: string;
children: any;
}
// Validate Extras
-function AddOn({ children }: AddOnProps): JSX.Element {
+function addOn({ children }: InterfaceAddOnProps): JSX.Element {
const appRoutes = useSelector((state: RootState) => state.appRoutes);
const { targets, configUrl } = appRoutes;
return (
<>
-
+
{children}
@@ -24,13 +24,13 @@ function AddOn({ children }: AddOnProps): JSX.Element {
);
}
-AddOn.defaultProps = {
+addOn.defaultProps = {
extras: {},
name: '',
children: null,
};
-AddOn.propTypes = {
+addOn.propTypes = {
extras: PropTypes.shape({
components: PropTypes.shape({}),
actions: PropTypes.shape({}),
@@ -39,4 +39,4 @@ AddOn.propTypes = {
children: PropTypes.any,
};
-export default AddOn;
+export default addOn;
diff --git a/src/components/AddOn/core/AddOnEntry/AddOnEntry.test.tsx b/src/components/AddOn/core/AddOnEntry/AddOnEntry.test.tsx
index faf635d7d3..1716323755 100644
--- a/src/components/AddOn/core/AddOnEntry/AddOnEntry.test.tsx
+++ b/src/components/AddOn/core/AddOnEntry/AddOnEntry.test.tsx
@@ -4,12 +4,13 @@ import { BrowserRouter } from 'react-router-dom';
import AddOnEntry from './AddOnEntry';
import {
ApolloClient,
- NormalizedCacheObject,
ApolloProvider,
InMemoryCache,
ApolloLink,
HttpLink,
} from '@apollo/client';
+
+import type { NormalizedCacheObject } from '@apollo/client';
import { Provider } from 'react-redux';
import { store } from 'state/store';
import { BACKEND_URL } from 'Constant/constant';
@@ -40,7 +41,7 @@ describe('Testing AddOnEntry', () => {
configurable: true,
modified: true,
isInstalled: true,
- getInstalledPlugins: () => {
+ getInstalledPlugins: (): { sample: string } => {
return { sample: 'sample' };
},
};
diff --git a/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx b/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx
index ccb281357b..9288c30af9 100644
--- a/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx
+++ b/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx
@@ -9,7 +9,7 @@ import {
import { useMutation } from '@apollo/client';
import { useTranslation } from 'react-i18next';
-interface AddOnEntryProps {
+interface InterfaceAddOnEntryProps {
id: string;
enabled: boolean;
title: string;
@@ -23,7 +23,7 @@ interface AddOnEntryProps {
getInstalledPlugins: () => any;
}
-function AddOnEntry({
+function addOnEntry({
id,
enabled,
title,
@@ -32,7 +32,7 @@ function AddOnEntry({
installed,
isInstalled,
getInstalledPlugins,
-}: AddOnEntryProps): JSX.Element {
+}: InterfaceAddOnEntryProps): JSX.Element {
const { t } = useTranslation('translation', { keyPrefix: 'addOnEntry' });
const [buttonLoading, setButtonLoading] = useState(false);
@@ -46,17 +46,16 @@ function AddOnEntry({
const currentOrg = window.location.href.split('=')[1];
- const updateOrgList = async () => {
+ const updateOrgList = async (): Promise => {
await updateOrgStatus({
variables: {
id: id.toString(),
orgId: currentOrg.toString(),
},
});
- // console.log('orgs pushed', data);
};
- const updateInstallStatusFunc = async () => {
+ const updateInstallStatusFunc = async (): Promise => {
setButtonLoading(true);
await updateInstallStatus({
variables: {
@@ -66,8 +65,6 @@ function AddOnEntry({
});
setIsInstalledLocal(!isInstalledLocal);
- // console.log('AddOnEntry Data IS =>', data);
-
setButtonLoading(false);
};
@@ -150,7 +147,7 @@ function AddOnEntry({
label={t('enable')}
className={styles.entrytoggle}
// eslint-disable-next-line @typescript-eslint/no-empty-function
- onChange={() => {}}
+ onChange={(): void => {}}
disabled={switchInProgress}
checked={enabled}
/>
@@ -166,7 +163,7 @@ function AddOnEntry({
variant="primary"
// disabled={buttonLoading || !configurable}
disabled={buttonLoading}
- onClick={() => {
+ onClick={(): void => {
updateOrgList();
updateInstallStatusFunc();
getInstalledPlugins();
@@ -190,7 +187,7 @@ function AddOnEntry({
);
}
-AddOnEntry.defaultProps = {
+addOnEntry.defaultProps = {
enabled: false,
configurable: true,
title: '',
@@ -198,7 +195,7 @@ AddOnEntry.defaultProps = {
isInstalled: false,
};
-AddOnEntry.propTypes = {
+addOnEntry.propTypes = {
enabled: PropTypes.bool,
configurable: PropTypes.bool,
title: PropTypes.string,
@@ -206,4 +203,4 @@ AddOnEntry.propTypes = {
isInstalled: PropTypes.bool,
};
-export default AddOnEntry;
+export default addOnEntry;
diff --git a/src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx b/src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx
index f5f79a9e40..7caa1f9e3e 100644
--- a/src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx
+++ b/src/components/AddOn/core/AddOnRegister/AddOnRegister.test.tsx
@@ -4,12 +4,12 @@ import userEvent from '@testing-library/user-event';
import AddOnRegister from './AddOnRegister';
import {
ApolloClient,
- NormalizedCacheObject,
ApolloProvider,
InMemoryCache,
ApolloLink,
HttpLink,
} from '@apollo/client';
+import type { NormalizedCacheObject } from '@apollo/client';
import { Provider } from 'react-redux';
import { store } from 'state/store';
import { BrowserRouter } from 'react-router-dom';
@@ -24,7 +24,7 @@ const httpLink = new HttpLink({
},
});
-async function wait(ms = 500) {
+async function wait(ms = 500): Promise {
await act(() => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
diff --git a/src/components/AddOn/core/AddOnRegister/AddOnRegister.tsx b/src/components/AddOn/core/AddOnRegister/AddOnRegister.tsx
index a04cae6304..4f720b4fad 100644
--- a/src/components/AddOn/core/AddOnRegister/AddOnRegister.tsx
+++ b/src/components/AddOn/core/AddOnRegister/AddOnRegister.tsx
@@ -7,11 +7,11 @@ import { ADD_PLUGIN_MUTATION } from 'GraphQl/Mutations/mutations';
import { useTranslation } from 'react-i18next';
import { toast } from 'react-toastify';
-interface AddOnRegisterProps {
+interface InterfaceAddOnRegisterProps {
id?: string; // OrgId
createdBy?: string; // User
}
-interface formStateTypes {
+interface InterfaceFormStateTypes {
pluginName: string;
pluginCreatedBy: string;
pluginDesc: string;
@@ -21,16 +21,19 @@ interface formStateTypes {
const currentUrl = window.location.href.split('=')[1];
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-function AddOnRegister({ createdBy }: AddOnRegisterProps): JSX.Element {
+function addOnRegister({
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ createdBy,
+}: InterfaceAddOnRegisterProps): JSX.Element {
const { t } = useTranslation('translation', { keyPrefix: 'addOnRegister' });
const [show, setShow] = useState(false);
- const handleClose = () => setShow(false);
- const handleShow = () => setShow(true);
+ const handleClose = (): void => setShow(false);
+ const handleShow = (): void => setShow(true);
const [create] = useMutation(ADD_PLUGIN_MUTATION);
- const [formState, setFormState] = useState({
+ const [formState, setFormState] = useState({
pluginName: '',
pluginCreatedBy: '',
pluginDesc: '',
@@ -38,7 +41,7 @@ function AddOnRegister({ createdBy }: AddOnRegisterProps): JSX.Element {
installedOrgs: [currentUrl],
});
- const handleRegister = async () => {
+ const handleRegister = async (): Promise => {
const { data } = await create({
variables: {
$pluginName: formState.pluginName,
@@ -81,7 +84,7 @@ function AddOnRegister({ createdBy }: AddOnRegisterProps): JSX.Element {
autoComplete="off"
required
value={formState.pluginName}
- onChange={(e) => {
+ onChange={(e): void => {
setFormState({
...formState,
pluginName: e.target.value,
@@ -97,7 +100,7 @@ function AddOnRegister({ createdBy }: AddOnRegisterProps): JSX.Element {
autoComplete="off"
required
value={formState.pluginCreatedBy}
- onChange={(e) => {
+ onChange={(e): void => {
setFormState({
...formState,
pluginCreatedBy: e.target.value,
@@ -114,7 +117,7 @@ function AddOnRegister({ createdBy }: AddOnRegisterProps): JSX.Element {
placeholder={t('pDesc')}
required
value={formState.pluginDesc}
- onChange={(e) => {
+ onChange={(e): void => {
setFormState({
...formState,
pluginDesc: e.target.value,
@@ -145,12 +148,12 @@ function AddOnRegister({ createdBy }: AddOnRegisterProps): JSX.Element {
);
}
-AddOnRegister.defaultProps = {
+addOnRegister.defaultProps = {
createdBy: 'Admin',
};
-AddOnRegister.propTypes = {
+addOnRegister.propTypes = {
createdBy: PropTypes.string,
};
-export default AddOnRegister;
+export default addOnRegister;
diff --git a/src/components/AddOn/core/AddOnStore/AddOnStore.test.tsx b/src/components/AddOn/core/AddOnStore/AddOnStore.test.tsx
index 758d6c96cb..2fc5e61e92 100644
--- a/src/components/AddOn/core/AddOnStore/AddOnStore.test.tsx
+++ b/src/components/AddOn/core/AddOnStore/AddOnStore.test.tsx
@@ -8,12 +8,13 @@ import { render } from '@testing-library/react';
// import { store } from 'state/store';
import {
ApolloClient,
- NormalizedCacheObject,
ApolloProvider,
InMemoryCache,
ApolloLink,
HttpLink,
} from '@apollo/client';
+
+import type { NormalizedCacheObject } from '@apollo/client';
import { BrowserRouter } from 'react-router-dom';
import AddOnStore from './AddOnStore';
import { Provider } from 'react-redux';
diff --git a/src/components/AddOn/core/AddOnStore/AddOnStore.tsx b/src/components/AddOn/core/AddOnStore/AddOnStore.tsx
index df85f88245..b3283497da 100644
--- a/src/components/AddOn/core/AddOnStore/AddOnStore.tsx
+++ b/src/components/AddOn/core/AddOnStore/AddOnStore.tsx
@@ -15,14 +15,14 @@ import {
USER_LIST,
} from 'GraphQl/Queries/Queries'; // PLUGIN_LIST
import { useSelector } from 'react-redux';
-import { RootState } from '../../../../state/reducers';
+import type { RootState } from '../../../../state/reducers';
import { Form, Tab, Tabs } from 'react-bootstrap';
import AddOnRegister from '../AddOnRegister/AddOnRegister';
import PluginHelper from 'components/AddOn/support/services/Plugin.helper';
import { store } from './../../../../state/store';
import { useTranslation } from 'react-i18next';
-function AddOnStore(): JSX.Element {
+function addOnStore(): JSX.Element {
const { t } = useTranslation('translation', { keyPrefix: 'addOnStore' });
const [isStore, setIsStore] = useState(true);
@@ -39,6 +39,7 @@ function AddOnStore(): JSX.Element {
// type plugData = { pluginName: String, plug };
const { data, loading, error } = useQuery(PLUGIN_GET);
/* istanbul ignore next */
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const getStorePlugins = async () => {
let plugins = await new PluginHelper().fetchStore();
const installIds = (await new PluginHelper().fetchInstalled()).map(
@@ -69,12 +70,11 @@ function AddOnStore(): JSX.Element {
};
/* istanbul ignore next */
- const updateLinks = async (links: any[]) => {
+ const updateLinks = async (links: any[]): Promise => {
store.dispatch({ type: 'UPDATE_P_TARGETS', payload: links });
};
-
// /* istanbul ignore next */
- const pluginModified = () => {
+ const pluginModified = (): void => {
return getInstalledPlugins();
// .then((installedPlugins) => {
// getStorePlugins();
@@ -86,12 +86,12 @@ function AddOnStore(): JSX.Element {
// pluginModified();
// }, []);
- const updateSelectedTab = (tab: any) => {
+ const updateSelectedTab = (tab: any): void => {
setIsStore(tab === 'available');
isStore ? getStorePlugins() : getInstalledPlugins();
};
- const filterChange = (ev: any) => {
+ const filterChange = (ev: any): void => {
setShowEnabled(ev.target.value === 'enabled');
};
@@ -103,16 +103,10 @@ function AddOnStore(): JSX.Element {
>
);
}
- // console.log(
- // 'Filtered Data is ',
- // data.getPlugins.filter((plugin: any) => plugin.pluginInstallStatus == true)
- // );
- // TODO: Update routes for other pages
- // TODO: Implement Search
return (
<>
@@ -124,7 +118,7 @@ function AddOnStore(): JSX.Element {
placeholder={t('searchName')}
autoComplete="off"
required
- onChange={(e) => setSearchText(e.target.value)}
+ onChange={(e): void => setSearchText(e.target.value)}
/>
{!isStore && (
@@ -260,7 +254,7 @@ function AddOnStore(): JSX.Element {
isInstalled={plug.pluginInstallStatus}
configurable={plug.pluginInstallStatus}
component={'Special Component'}
- modified={() => {
+ modified={(): void => {
console.log('Plugin is modified');
}}
getInstalledPlugins={getInstalledPlugins}
@@ -337,7 +331,7 @@ function AddOnStore(): JSX.Element {
isInstalled={plug.pluginInstallStatus}
configurable={plug.pluginInstallStatus}
component={'Special Component'}
- modified={() => {
+ modified={(): void => {
console.log('Plugin is modified');
}}
getInstalledPlugins={getInstalledPlugins}
@@ -354,11 +348,11 @@ function AddOnStore(): JSX.Element {
);
}
-AddOnStore.defaultProps = {};
+addOnStore.defaultProps = {};
-AddOnStore.propTypes = {};
+addOnStore.propTypes = {};
-export default AddOnStore;
+export default addOnStore;
// {addonStore.map((plugin: any, index: number) => {
// return (
diff --git a/src/components/AddOn/support/components/Action/Action.tsx b/src/components/AddOn/support/components/Action/Action.tsx
index e1484df8aa..50b6b10797 100644
--- a/src/components/AddOn/support/components/Action/Action.tsx
+++ b/src/components/AddOn/support/components/Action/Action.tsx
@@ -1,19 +1,15 @@
-import React, { useEffect, useRef } from 'react';
+import React, { useRef } from 'react';
// TODO: UI logic for embedded actions (hide label)
-interface ActionProps {
+interface InterfaceActionProps {
children: any;
label: string;
}
// TODO: props => Validate child element type, register functions from children for global use?,
-function Action(props: ActionProps): JSX.Element {
+function action(props: InterfaceActionProps): JSX.Element {
const actionRef = useRef(null);
- useEffect(() => {
- // console.log('Props', props.children); // Validate Type
- // console.log('Ref', actionRef); // Fetch Events
- });
return (
{props.label}
@@ -22,4 +18,4 @@ function Action(props: ActionProps): JSX.Element {
);
}
-export default Action;
+export default action;
diff --git a/src/components/AddOn/support/components/MainContent/MainContent.tsx b/src/components/AddOn/support/components/MainContent/MainContent.tsx
index f8d5178f06..7ca4dfc8c4 100644
--- a/src/components/AddOn/support/components/MainContent/MainContent.tsx
+++ b/src/components/AddOn/support/components/MainContent/MainContent.tsx
@@ -1,13 +1,13 @@
import React from 'react';
import styles from './MainContent.module.css';
-interface MainContentProps {
+interface InterfaceMainContentProps {
children: any;
}
// TODO: Implement extras plugins
// TODO: Implement additional styles
// id - [plugin/component-name]-main-content if is in plugin
-function MainContent({ children }: MainContentProps): JSX.Element {
+function mainContent({ children }: InterfaceMainContentProps): JSX.Element {
return (
{children}
@@ -15,4 +15,4 @@ function MainContent({ children }: MainContentProps): JSX.Element {
);
}
-export default MainContent;
+export default mainContent;
diff --git a/src/components/AddOn/support/components/SidePanel/SidePanel.test.tsx b/src/components/AddOn/support/components/SidePanel/SidePanel.test.tsx
index 170b91e226..5590fa1786 100644
--- a/src/components/AddOn/support/components/SidePanel/SidePanel.test.tsx
+++ b/src/components/AddOn/support/components/SidePanel/SidePanel.test.tsx
@@ -1,12 +1,8 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import SidePanel from './SidePanel';
-import {
- ApolloClient,
- NormalizedCacheObject,
- ApolloProvider,
- InMemoryCache,
-} from '@apollo/client';
+import type { NormalizedCacheObject } from '@apollo/client';
+import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client';
import { BACKEND_URL } from 'Constant/constant';
const client: ApolloClient
= new ApolloClient({
diff --git a/src/components/AddOn/support/components/SidePanel/SidePanel.tsx b/src/components/AddOn/support/components/SidePanel/SidePanel.tsx
index cba3ece0c2..2eda5e7225 100644
--- a/src/components/AddOn/support/components/SidePanel/SidePanel.tsx
+++ b/src/components/AddOn/support/components/SidePanel/SidePanel.tsx
@@ -1,13 +1,16 @@
import React from 'react';
import styles from './SidePanel.module.css';
-interface SidePanelProps {
+interface InterfaceSidePanelProps {
collapse?: boolean;
children: any;
}
// TODO: Implement Extras Plugin
// id - [plugin-name]-side-panel
-function SidePanel({ collapse, children }: SidePanelProps): JSX.Element {
+function sidePanel({
+ collapse,
+ children,
+}: InterfaceSidePanelProps): JSX.Element {
return (
{
+ fetchStore = async (): Promise
=> {
const result = await fetch(`http://localhost:3005/store`);
return await result.json();
};
- fetchInstalled = async () => {
+ fetchInstalled = async (): Promise => {
const result = await fetch(`http://localhost:3005/installed`);
return await result.json();
};
- generateLinks = (plugins: any[]) => {
+ generateLinks = (plugins: any[]): { name: string; url: string }[] => {
return plugins
.filter((plugin: any) => plugin.enabled)
.map((installedPlugin: any) => {
diff --git a/src/components/AdminDashListCard/AdminDashListCard.tsx b/src/components/AdminDashListCard/AdminDashListCard.tsx
index ebd90076c5..5f66a10ef2 100644
--- a/src/components/AdminDashListCard/AdminDashListCard.tsx
+++ b/src/components/AdminDashListCard/AdminDashListCard.tsx
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
import styles from './AdminDashListCard.module.css';
import defaultImg from 'assets/third_image.png';
-interface AdminDashListCardProps {
+interface InterfaceAdminDashListCardProps {
key: string;
id: string;
orgName: string;
@@ -18,10 +18,12 @@ interface AdminDashListCardProps {
members: any;
}
-function AdminDashListCard(props: AdminDashListCardProps): JSX.Element {
+function adminDashListCard(
+ props: InterfaceAdminDashListCardProps
+): JSX.Element {
const userId = localStorage.getItem('id');
- function Click() {
+ function click(): void {
const url = '/orgdash/id=' + props.id;
window.location.replace(url);
}
@@ -58,7 +60,7 @@ function AdminDashListCard(props: AdminDashListCardProps): JSX.Element {
@@ -382,7 +387,7 @@ function EventListCard(props: EventListCardProps): JSX.Element {
type="checkbox"
data-testid="updateIsPublic"
checked={publicchecked}
- onChange={() => setPublicChecked(!publicchecked)}
+ onChange={(): void => setPublicChecked(!publicchecked)}
/>
@@ -392,7 +397,7 @@ function EventListCard(props: EventListCardProps): JSX.Element {
type="checkbox"
data-testid="updateRegistrable"
checked={registrablechecked}
- onChange={() =>
+ onChange={(): void =>
setRegistrableChecked(!registrablechecked)
}
/>
@@ -423,4 +428,4 @@ function EventListCard(props: EventListCardProps): JSX.Element {
);
}
export {};
-export default EventListCard;
+export default eventListCard;
diff --git a/src/components/LandingPage/LandingPage.test.tsx b/src/components/LandingPage/LandingPage.test.tsx
index 7cf4f16407..b4e798bab7 100644
--- a/src/components/LandingPage/LandingPage.test.tsx
+++ b/src/components/LandingPage/LandingPage.test.tsx
@@ -3,12 +3,8 @@ import { render, waitFor } from '@testing-library/react';
import { I18nextProvider } from 'react-i18next';
import LandingPage from './LandingPage';
-import {
- ApolloClient,
- NormalizedCacheObject,
- ApolloProvider,
- InMemoryCache,
-} from '@apollo/client';
+import type { NormalizedCacheObject } from '@apollo/client';
+import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client';
import i18n from 'utils/i18n';
import { BACKEND_URL } from 'Constant/constant';
diff --git a/src/components/LandingPage/LandingPage.tsx b/src/components/LandingPage/LandingPage.tsx
index 68ff087179..fadb028dc9 100644
--- a/src/components/LandingPage/LandingPage.tsx
+++ b/src/components/LandingPage/LandingPage.tsx
@@ -3,7 +3,7 @@ import styles from './LandingPage.module.css';
import slide1 from 'assets/images/palisadoes_logo.png';
import { useTranslation } from 'react-i18next';
-function LandingPage(): JSX.Element {
+function landingPage(): JSX.Element {
const { t } = useTranslation('translation', { keyPrefix: 'loginPage' });
return (
@@ -20,4 +20,4 @@ function LandingPage(): JSX.Element {
);
}
export {};
-export default LandingPage;
+export default landingPage;
diff --git a/src/components/ListNavbar/ListNavbar.test.tsx b/src/components/ListNavbar/ListNavbar.test.tsx
index 0097d5d619..40612db985 100644
--- a/src/components/ListNavbar/ListNavbar.test.tsx
+++ b/src/components/ListNavbar/ListNavbar.test.tsx
@@ -8,7 +8,7 @@ import 'jest-localstorage-mock';
import ListNavbar from './ListNavbar';
import i18nForTest from 'utils/i18nForTest';
-async function wait(ms = 100) {
+async function wait(ms = 100): Promise {
await act(() => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
diff --git a/src/components/ListNavbar/ListNavbar.tsx b/src/components/ListNavbar/ListNavbar.tsx
index 6e5acca609..e4f6af111a 100644
--- a/src/components/ListNavbar/ListNavbar.tsx
+++ b/src/components/ListNavbar/ListNavbar.tsx
@@ -10,6 +10,7 @@ import styles from './ListNavbar.module.css';
import Logo from 'assets/talawa-logo-200x200.png';
import { languages } from 'utils/languages';
+// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const ListNavbar = () => {
const { t } = useTranslation('translation', { keyPrefix: 'listNavbar' });
@@ -17,7 +18,7 @@ const ListNavbar = () => {
const currentLanguageCode = Cookies.get('i18next') || 'en';
- const logout = () => {
+ const logout = (): void => {
localStorage.clear();
window.location.replace('/');
};
@@ -77,7 +78,9 @@ const ListNavbar = () => {
i18next.changeLanguage(language.code)}
+ onClick={async (): Promise => {
+ await i18next.changeLanguage(language.code);
+ }}
disabled={currentLanguageCode === language.code}
data-testid={`changeLanguageBtn${index}`}
>
diff --git a/src/components/MemberRequestCard/MemberRequestCard.test.tsx b/src/components/MemberRequestCard/MemberRequestCard.test.tsx
index bec84b5a39..94efce5f09 100644
--- a/src/components/MemberRequestCard/MemberRequestCard.test.tsx
+++ b/src/components/MemberRequestCard/MemberRequestCard.test.tsx
@@ -45,7 +45,7 @@ const MOCKS = [
},
];
const link = new StaticMockLink(MOCKS, true);
-async function wait(ms = 100) {
+async function wait(ms = 100): Promise {
await act(() => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
@@ -67,7 +67,7 @@ describe('Testing Member Request Card', () => {
global.alert = jest.fn();
it('should render props and text elements test for the page component', async () => {
- global.confirm = () => true;
+ global.confirm = (): boolean => true;
render(
@@ -90,7 +90,7 @@ describe('Testing Member Request Card', () => {
});
it('Should render text elements when props value is not passed', async () => {
- global.confirm = () => false;
+ global.confirm = (): boolean => false;
render(
diff --git a/src/components/MemberRequestCard/MemberRequestCard.tsx b/src/components/MemberRequestCard/MemberRequestCard.tsx
index 53a3fd98d1..f107bcf6f7 100644
--- a/src/components/MemberRequestCard/MemberRequestCard.tsx
+++ b/src/components/MemberRequestCard/MemberRequestCard.tsx
@@ -13,7 +13,7 @@ import { toast } from 'react-toastify';
import defaultImg from 'assets/third_image.png';
import { errorHandler } from 'utils/errorHandler';
-interface MemberRequestCardProps {
+interface InterfaceMemberRequestCardProps {
key: string;
id: string;
memberName: string;
@@ -23,7 +23,9 @@ interface MemberRequestCardProps {
email: string;
}
-function MemberRequestCard(props: MemberRequestCardProps): JSX.Element {
+function memberRequestCard(
+ props: InterfaceMemberRequestCardProps
+): JSX.Element {
const [acceptMutation] = useMutation(ACCEPT_ORGANIZATION_REQUEST_MUTATION);
const [rejectMutation] = useMutation(REJECT_ORGANIZATION_REQUEST_MUTATION);
@@ -31,7 +33,7 @@ function MemberRequestCard(props: MemberRequestCardProps): JSX.Element {
keyPrefix: 'membershipRequest',
});
- const AddMember = async () => {
+ const addMember = async (): Promise => {
try {
await acceptMutation({
variables: {
@@ -51,7 +53,7 @@ function MemberRequestCard(props: MemberRequestCardProps): JSX.Element {
}
};
- const RejectMember = async () => {
+ const rejectMember = async (): Promise => {
const sure = window.confirm('Are you sure you want to Reject Request ?');
if (sure) {
try {
@@ -101,13 +103,13 @@ function MemberRequestCard(props: MemberRequestCardProps): JSX.Element {
{t('accept')}
{t('reject')}
@@ -120,4 +122,4 @@ function MemberRequestCard(props: MemberRequestCardProps): JSX.Element {
);
}
export {};
-export default MemberRequestCard;
+export default memberRequestCard;
diff --git a/src/components/NotFound/NotFound.tsx b/src/components/NotFound/NotFound.tsx
index 5b732d6d85..6e2853cf82 100644
--- a/src/components/NotFound/NotFound.tsx
+++ b/src/components/NotFound/NotFound.tsx
@@ -3,12 +3,12 @@ import { useTranslation } from 'react-i18next';
import styles from './NotFound.module.css';
-interface NotFoundProps {
+interface InterfaceNotFoundProps {
title: string;
keyPrefix: string;
}
-function NotFound(props: NotFoundProps): JSX.Element {
+function notFound(props: InterfaceNotFoundProps): JSX.Element {
const key = props.keyPrefix.toString();
const { t } = useTranslation('translation', {
keyPrefix: key,
@@ -22,4 +22,4 @@ function NotFound(props: NotFoundProps): JSX.Element {
);
}
-export default NotFound;
+export default notFound;
diff --git a/src/components/OrgAdminListCard/OrgAdminListCard.test.tsx b/src/components/OrgAdminListCard/OrgAdminListCard.test.tsx
index 09fb634a3c..db499cd0b1 100644
--- a/src/components/OrgAdminListCard/OrgAdminListCard.test.tsx
+++ b/src/components/OrgAdminListCard/OrgAdminListCard.test.tsx
@@ -28,7 +28,7 @@ const MOCKS = [
},
];
const link = new StaticMockLink(MOCKS, true);
-async function wait(ms = 100) {
+async function wait(ms = 100): Promise {
await act(() => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
diff --git a/src/components/OrgAdminListCard/OrgAdminListCard.tsx b/src/components/OrgAdminListCard/OrgAdminListCard.tsx
index ca90a6cdf9..ee1a562eb2 100644
--- a/src/components/OrgAdminListCard/OrgAdminListCard.tsx
+++ b/src/components/OrgAdminListCard/OrgAdminListCard.tsx
@@ -5,7 +5,6 @@ import Button from 'react-bootstrap/Button';
import Modal from 'react-bootstrap/Modal';
import { useMutation } from '@apollo/client';
import { toast } from 'react-toastify';
-// import { ApolloProvider } from '@apollo/react-hooks';
import styles from './OrgAdminListCard.module.css';
import { REMOVE_ADMIN_MUTATION } from 'GraphQl/Mutations/mutations';
@@ -14,7 +13,7 @@ import { Link } from 'react-router-dom';
import defaultImg from 'assets/third_image.png';
import { errorHandler } from 'utils/errorHandler';
-interface OrgPeopleListCardProps {
+interface InterfaceOrgPeopleListCardProps {
key: string;
id: string;
memberName: string;
@@ -24,7 +23,7 @@ interface OrgPeopleListCardProps {
}
const currentUrl = window.location.href.split('=')[1];
-function OrgAdminListCard(props: OrgPeopleListCardProps): JSX.Element {
+function orgAdminListCard(props: InterfaceOrgPeopleListCardProps): JSX.Element {
const [remove] = useMutation(REMOVE_ADMIN_MUTATION);
const [showRemoveAdminModal, setShowRemoveAdminModal] = React.useState(false);
@@ -32,10 +31,10 @@ function OrgAdminListCard(props: OrgPeopleListCardProps): JSX.Element {
keyPrefix: 'orgAdminListCard',
});
- const toggleRemoveAdminModal = () =>
+ const toggleRemoveAdminModal = (): void =>
setShowRemoveAdminModal(!showRemoveAdminModal);
- const RemoveAdmin = async () => {
+ const removeAdmin = async (): Promise => {
try {
const { data } = await remove({
variables: {
@@ -108,7 +107,7 @@ function OrgAdminListCard(props: OrgPeopleListCardProps): JSX.Element {
{t('yes')}
@@ -118,5 +117,4 @@ function OrgAdminListCard(props: OrgPeopleListCardProps): JSX.Element {
);
}
-export {};
-export default OrgAdminListCard;
+export default orgAdminListCard;
diff --git a/src/components/OrgContriCards/OrgContriCards.test.tsx b/src/components/OrgContriCards/OrgContriCards.test.tsx
index 9de29e1d1f..95de529d98 100644
--- a/src/components/OrgContriCards/OrgContriCards.test.tsx
+++ b/src/components/OrgContriCards/OrgContriCards.test.tsx
@@ -1,11 +1,7 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
-import {
- ApolloClient,
- NormalizedCacheObject,
- ApolloProvider,
- InMemoryCache,
-} from '@apollo/client';
+import type { NormalizedCacheObject } from '@apollo/client';
+import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client';
import { I18nextProvider } from 'react-i18next';
import OrgContriCards from './OrgContriCards';
diff --git a/src/components/OrgContriCards/OrgContriCards.tsx b/src/components/OrgContriCards/OrgContriCards.tsx
index 09f965f8c6..69a9e03d58 100644
--- a/src/components/OrgContriCards/OrgContriCards.tsx
+++ b/src/components/OrgContriCards/OrgContriCards.tsx
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
import styles from './OrgContriCards.module.css';
-interface OrgContriCardsProps {
+interface InterfaceOrgContriCardsProps {
key: string;
id: string;
userName: string;
@@ -14,7 +14,7 @@ interface OrgContriCardsProps {
contriTransactionId: string;
userEmail: string;
}
-function OrgContriCards(props: OrgContriCardsProps): JSX.Element {
+function orgContriCards(props: InterfaceOrgContriCardsProps): JSX.Element {
const { t } = useTranslation('translation', {
keyPrefix: 'orgContriCards',
});
@@ -39,4 +39,4 @@ function OrgContriCards(props: OrgContriCardsProps): JSX.Element {
>
);
}
-export default OrgContriCards;
+export default orgContriCards;
diff --git a/src/components/OrgDelete/OrgDelete.test.tsx b/src/components/OrgDelete/OrgDelete.test.tsx
index ed669efcdd..cc89241f56 100644
--- a/src/components/OrgDelete/OrgDelete.test.tsx
+++ b/src/components/OrgDelete/OrgDelete.test.tsx
@@ -1,11 +1,7 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
-import {
- ApolloClient,
- NormalizedCacheObject,
- ApolloProvider,
- InMemoryCache,
-} from '@apollo/client';
+import type { NormalizedCacheObject } from '@apollo/client';
+import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client';
import { I18nextProvider } from 'react-i18next';
import OrgDelete from './OrgDelete';
diff --git a/src/components/OrgDelete/OrgDelete.tsx b/src/components/OrgDelete/OrgDelete.tsx
index 36c4241d5c..0f1335dae4 100644
--- a/src/components/OrgDelete/OrgDelete.tsx
+++ b/src/components/OrgDelete/OrgDelete.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
-function OrgDelete(): JSX.Element {
+function orgDelete(): JSX.Element {
const { t } = useTranslation('translation', {
keyPrefix: 'orgDelete',
});
@@ -14,4 +14,4 @@ function OrgDelete(): JSX.Element {
>
);
}
-export default OrgDelete;
+export default orgDelete;
diff --git a/src/components/OrgPeopleListCard/OrgPeopleListCard.test.tsx b/src/components/OrgPeopleListCard/OrgPeopleListCard.test.tsx
index 7666738960..e283f92e13 100644
--- a/src/components/OrgPeopleListCard/OrgPeopleListCard.test.tsx
+++ b/src/components/OrgPeopleListCard/OrgPeopleListCard.test.tsx
@@ -28,7 +28,7 @@ const MOCKS = [
},
];
const link = new StaticMockLink(MOCKS, true);
-async function wait(ms = 100) {
+async function wait(ms = 100): Promise {
await act(() => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
@@ -49,7 +49,7 @@ describe('Testing Organization People List Card', () => {
global.alert = jest.fn();
test('should render props and text elements test for the page component', async () => {
- global.confirm = () => true;
+ global.confirm = (): boolean => true;
render(
@@ -72,7 +72,7 @@ describe('Testing Organization People List Card', () => {
});
test('Should render text elements when props value is not passed', async () => {
- global.confirm = () => false;
+ global.confirm = (): boolean => false;
render(
diff --git a/src/components/OrgPeopleListCard/OrgPeopleListCard.tsx b/src/components/OrgPeopleListCard/OrgPeopleListCard.tsx
index ad741c9a0c..233bf81980 100644
--- a/src/components/OrgPeopleListCard/OrgPeopleListCard.tsx
+++ b/src/components/OrgPeopleListCard/OrgPeopleListCard.tsx
@@ -12,7 +12,7 @@ import { Link } from 'react-router-dom';
import defaultImg from 'assets/third_image.png';
import { errorHandler } from 'utils/errorHandler';
-interface OrgPeopleListCardProps {
+interface InterfaceOrgPeopleListCardProps {
key: string;
id: string;
memberName: string;
@@ -21,19 +21,21 @@ interface OrgPeopleListCardProps {
memberEmail: string;
}
-function OrgPeopleListCard(props: OrgPeopleListCardProps): JSX.Element {
+function orgPeopleListCard(
+ props: InterfaceOrgPeopleListCardProps
+): JSX.Element {
const currentUrl = window.location.href.split('=')[1];
const [remove] = useMutation(REMOVE_MEMBER_MUTATION);
const [showRemoveAdminModal, setShowRemoveAdminModal] = React.useState(false);
- const toggleRemoveAdminModal = () =>
+ const toggleRemoveAdminModal = (): void =>
setShowRemoveAdminModal(!showRemoveAdminModal);
const { t } = useTranslation('translation', {
keyPrefix: 'orgPeopleListCard',
});
- const RemoveMember = async () => {
+ const removeMember = async (): Promise => {
try {
const { data } = await remove({
variables: {
@@ -107,7 +109,7 @@ function OrgPeopleListCard(props: OrgPeopleListCardProps): JSX.Element {
{t('yes')}
@@ -118,4 +120,4 @@ function OrgPeopleListCard(props: OrgPeopleListCardProps): JSX.Element {
);
}
export {};
-export default OrgPeopleListCard;
+export default orgPeopleListCard;
diff --git a/src/components/OrgPostCard/OrgPostCard.test.tsx b/src/components/OrgPostCard/OrgPostCard.test.tsx
index 94ec7bb595..dc8a7e5fd4 100644
--- a/src/components/OrgPostCard/OrgPostCard.test.tsx
+++ b/src/components/OrgPostCard/OrgPostCard.test.tsx
@@ -47,7 +47,7 @@ const MOCKS = [
},
];
const link = new StaticMockLink(MOCKS, true);
-async function wait(ms = 100) {
+async function wait(ms = 100): Promise {
await act(() => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
@@ -69,7 +69,7 @@ describe('Testing Organization Post Card', () => {
global.alert = jest.fn();
test('should render props and text elements test for the page component', async () => {
- global.confirm = () => true;
+ global.confirm = (): boolean => true;
render(
@@ -91,7 +91,7 @@ describe('Testing Organization Post Card', () => {
});
test('Should render text elements when props value is not passed', async () => {
- global.confirm = () => false;
+ global.confirm = (): boolean => false;
render(
diff --git a/src/components/OrgPostCard/OrgPostCard.tsx b/src/components/OrgPostCard/OrgPostCard.tsx
index 3a44cec035..2dff394890 100644
--- a/src/components/OrgPostCard/OrgPostCard.tsx
+++ b/src/components/OrgPostCard/OrgPostCard.tsx
@@ -1,19 +1,21 @@
-import React, { ChangeEvent, useEffect, useState } from 'react';
+import type { ChangeEvent } from 'react';
+import React, { useEffect, useState } from 'react';
+import { useMutation } from '@apollo/client';
import Button from 'react-bootstrap/Button';
import Modal from 'react-bootstrap/Modal';
-import { useMutation } from '@apollo/client';
import { toast } from 'react-toastify';
-import styles from './OrgPostCard.module.css';
import {
DELETE_POST_MUTATION,
UPDATE_POST_MUTATION,
} from 'GraphQl/Mutations/mutations';
-import { useTranslation } from 'react-i18next';
import defaultImg from 'assets/third_image.png';
+import { useTranslation } from 'react-i18next';
import { errorHandler } from 'utils/errorHandler';
+import styles from './OrgPostCard.module.css';
+import { Form } from 'react-bootstrap';
-interface OrgPostCardProps {
+interface InterfaceOrgPostCardProps {
key: string;
id: string;
postTitle: string;
@@ -23,7 +25,7 @@ interface OrgPostCardProps {
postVideo: string;
}
-function OrgPostCard(props: OrgPostCardProps): JSX.Element {
+function orgPostCard(props: InterfaceOrgPostCardProps): JSX.Element {
const [postformState, setPostFormState] = useState({
posttitle: '',
postinfo: '',
@@ -33,9 +35,11 @@ function OrgPostCard(props: OrgPostCardProps): JSX.Element {
const [showEditModal, setShowEditModal] = useState(false);
const [showDeleteModal, setShowDeleteModal] = useState(false);
- const toggleShowEditModal = () => setShowEditModal(!showEditModal);
- const toggleShowDeleteModal = () => setShowDeleteModal(!showDeleteModal);
- function handletoggleClick() {
+ const toggleShowEditModal = (): void => setShowEditModal(!showEditModal);
+ const toggleShowDeleteModal = (): void =>
+ setShowDeleteModal(!showDeleteModal);
+
+ function handletoggleClick(): void {
if (togglePost === 'Read more') {
setPostToggle('hide');
} else {
@@ -57,7 +61,7 @@ function OrgPostCard(props: OrgPostCardProps): JSX.Element {
const [create] = useMutation(DELETE_POST_MUTATION);
const [updatePost] = useMutation(UPDATE_POST_MUTATION);
- const DeletePost = async () => {
+ const deletePost = async (): Promise => {
try {
const { data } = await create({
variables: {
@@ -80,13 +84,15 @@ function OrgPostCard(props: OrgPostCardProps): JSX.Element {
const handleInputEvent = (
e: ChangeEvent
- ) => {
+ ): void => {
const { name, value } = e.target;
setPostFormState({ ...postformState, [name]: value });
};
- const updatePostHandler = async (e: ChangeEvent) => {
+ const updatePostHandler = async (
+ e: ChangeEvent
+ ): Promise => {
e.preventDefault();
try {
@@ -192,7 +198,7 @@ function OrgPostCard(props: OrgPostCardProps): JSX.Element {
- {/* delete modal */}
+ {/* Delete Modal */}
{t('deletePost')}
@@ -208,7 +214,7 @@ function OrgPostCard(props: OrgPostCardProps): JSX.Element {
{t('yes')}
@@ -219,9 +225,7 @@ function OrgPostCard(props: OrgPostCardProps): JSX.Element {
{/* Edit Modal */}
-
- {t('editPost')}
-
+ {t('editPost')}
@@ -232,7 +236,7 @@ function OrgPostCard(props: OrgPostCardProps): JSX.Element {
-
{t('information')}
-
@@ -189,7 +189,7 @@ function OrgUpdate(props: OrgUpdateProps): JSX.Element {
id="registrable"
type="checkbox"
defaultChecked={visiblechecked}
- onChange={() => setVisibleChecked(!visiblechecked)}
+ onChange={(): void => setVisibleChecked(!visiblechecked)}
/>
@@ -217,4 +217,4 @@ function OrgUpdate(props: OrgUpdateProps): JSX.Element {
>
);
}
-export default OrgUpdate;
+export default orgUpdate;
diff --git a/src/components/OrganizationCard/OrganizationCard.tsx b/src/components/OrganizationCard/OrganizationCard.tsx
index 736ab04597..ba90f3f83f 100644
--- a/src/components/OrganizationCard/OrganizationCard.tsx
+++ b/src/components/OrganizationCard/OrganizationCard.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import styles from './OrganizationCard.module.css';
-interface OrganizationCardProps {
+interface InterfaceOrganizationCardProps {
key: any;
image: string;
id: string;
@@ -10,7 +10,7 @@ interface OrganizationCardProps {
firstName: string;
}
-function OrganizationCard(props: OrganizationCardProps): JSX.Element {
+function organizationCard(props: InterfaceOrganizationCardProps): JSX.Element {
const uri = '/superorghome/i=' + props.id;
return (
@@ -46,4 +46,4 @@ function OrganizationCard(props: OrganizationCardProps): JSX.Element {
}
export {};
-export default OrganizationCard;
+export default organizationCard;
diff --git a/src/components/OrganizationCardStart/OrganizationCardStart.tsx b/src/components/OrganizationCardStart/OrganizationCardStart.tsx
index 51a61c738b..37c7b65686 100644
--- a/src/components/OrganizationCardStart/OrganizationCardStart.tsx
+++ b/src/components/OrganizationCardStart/OrganizationCardStart.tsx
@@ -1,14 +1,16 @@
import React from 'react';
import styles from './OrganizationCardStart.module.css';
-interface OrganizationCardStartProps {
+interface InterfaceOrganizationCardStartProps {
key: any;
image: string;
id: string;
name: string;
}
-function OrganizationCardStart(props: OrganizationCardStartProps): JSX.Element {
+function organizationCardStart(
+ props: InterfaceOrganizationCardStartProps
+): JSX.Element {
const uri = '/orghome/i=' + props.id;
return (
@@ -36,4 +38,4 @@ function OrganizationCardStart(props: OrganizationCardStartProps): JSX.Element {
);
}
-export default OrganizationCardStart;
+export default organizationCardStart;
diff --git a/src/components/Pagination/Pagination.test.tsx b/src/components/Pagination/Pagination.test.tsx
index 41a19661cd..88bb3752c5 100644
--- a/src/components/Pagination/Pagination.test.tsx
+++ b/src/components/Pagination/Pagination.test.tsx
@@ -13,7 +13,9 @@ describe('Testing Pagination component', () => {
count: 5,
page: 10,
rowsPerPage: 5,
- onPageChange: () => 10,
+ onPageChange: (): number => {
+ return 10;
+ },
};
test('Component should be rendered properly on rtl', () => {
@@ -34,7 +36,9 @@ const props = {
count: 5,
page: 10,
rowsPerPage: 5,
- onPageChange: () => 10,
+ onPageChange: (): number => {
+ return 10;
+ },
theme: { direction: 'rtl' },
};
diff --git a/src/components/Pagination/Pagination.tsx b/src/components/Pagination/Pagination.tsx
index 5605e43747..1a4b1d5921 100644
--- a/src/components/Pagination/Pagination.tsx
+++ b/src/components/Pagination/Pagination.tsx
@@ -7,7 +7,7 @@ import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft';
import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight';
import LastPageIcon from '@mui/icons-material/LastPage';
-interface TablePaginationActionsProps {
+interface InterfaceTablePaginationActionsProps {
count: number;
page: number;
rowsPerPage: number;
@@ -17,34 +17,34 @@ interface TablePaginationActionsProps {
) => void;
}
-function Pagination(props: TablePaginationActionsProps) {
+function pagination(props: InterfaceTablePaginationActionsProps): JSX.Element {
const theme = useTheme();
const { count, page, rowsPerPage, onPageChange } = props;
/* istanbul ignore next */
const handleFirstPageButtonClick = (
event: React.MouseEvent
- ) => {
+ ): void => {
onPageChange(event, 0);
};
const handleBackButtonClick = (
event: React.MouseEvent
- ) => {
+ ): void => {
onPageChange(event, page - 1);
};
/* istanbul ignore next */
const handleNextButtonClick = (
event: React.MouseEvent
- ) => {
+ ): void => {
onPageChange(event, page + 1);
};
/* istanbul ignore next */
const handleLastPageButtonClick = (
event: React.MouseEvent
- ) => {
+ ): void => {
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
};
@@ -94,4 +94,4 @@ function Pagination(props: TablePaginationActionsProps) {
);
}
-export default Pagination;
+export default pagination;
diff --git a/src/components/PaginationList/PaginationList.tsx b/src/components/PaginationList/PaginationList.tsx
index 80018a3ffb..562f5204bb 100644
--- a/src/components/PaginationList/PaginationList.tsx
+++ b/src/components/PaginationList/PaginationList.tsx
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
import Pagination from '../Pagination/Pagination';
import './PaginationList.css';
-interface PropsInterface {
+interface InterfacePropsInterface {
count: number;
rowsPerPage: number;
page: number;
@@ -18,7 +18,7 @@ interface PropsInterface {
) => void;
}
-const PaginationList = (props: PropsInterface) => {
+const PaginationList = (props: InterfacePropsInterface): JSX.Element => {
const { t } = useTranslation('translation', {
keyPrefix: 'paginationList',
});
diff --git a/src/components/SuperDashListCard/SuperDashListCard.test.tsx b/src/components/SuperDashListCard/SuperDashListCard.test.tsx
index f84dca476f..d33794b801 100644
--- a/src/components/SuperDashListCard/SuperDashListCard.test.tsx
+++ b/src/components/SuperDashListCard/SuperDashListCard.test.tsx
@@ -10,11 +10,14 @@ import i18nForTest from 'utils/i18nForTest';
Enzyme.configure({ adapter: new Adapter() });
-jest.mock('react-router-dom', () => ({
- useHistory: () => ({
- push: jest.fn(),
- }),
-}));
+jest.mock(
+ 'react-router-dom',
+ (): { useHistory: () => { push: jest.Mock } } => ({
+ useHistory: (): { push: jest.Mock } => ({
+ push: jest.fn(),
+ }),
+ })
+);
describe('Testing the Super Dash List', () => {
test('should render props and text elements test for the page component', () => {
diff --git a/src/components/SuperDashListCard/SuperDashListCard.tsx b/src/components/SuperDashListCard/SuperDashListCard.tsx
index 33179b4712..6e84fcb15f 100644
--- a/src/components/SuperDashListCard/SuperDashListCard.tsx
+++ b/src/components/SuperDashListCard/SuperDashListCard.tsx
@@ -7,7 +7,7 @@ import styles from './SuperDashListCard.module.css';
import { useHistory } from 'react-router-dom';
import AboutImg from 'assets/images/defaultImg.png';
-interface SuperDashListCardProps {
+interface InterfaceSuperDashListCardProps {
key: string;
id: string;
orgName: string;
@@ -18,12 +18,14 @@ interface SuperDashListCardProps {
members: any;
}
-function SuperDashListCard(props: SuperDashListCardProps): JSX.Element {
+function superDashListCard(
+ props: InterfaceSuperDashListCardProps
+): JSX.Element {
const userId = localStorage.getItem('id');
const userType = localStorage.getItem('UserType');
const history = useHistory();
- function handleClick() {
+ function handleClick(): void {
const url = '/orgdash/id=' + props.id;
/*
@@ -91,4 +93,4 @@ function SuperDashListCard(props: SuperDashListCardProps): JSX.Element {
);
}
export {};
-export default SuperDashListCard;
+export default superDashListCard;
diff --git a/src/components/UserListCard/UserListCard.test.tsx b/src/components/UserListCard/UserListCard.test.tsx
index bf44fca1e4..894571a597 100644
--- a/src/components/UserListCard/UserListCard.test.tsx
+++ b/src/components/UserListCard/UserListCard.test.tsx
@@ -28,7 +28,7 @@ const MOCKS = [
},
];
const link = new StaticMockLink(MOCKS, true);
-async function wait(ms = 100) {
+async function wait(ms = 100): Promise {
await act(() => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
diff --git a/src/components/UserListCard/UserListCard.tsx b/src/components/UserListCard/UserListCard.tsx
index 84d7f16d72..910e4ca108 100644
--- a/src/components/UserListCard/UserListCard.tsx
+++ b/src/components/UserListCard/UserListCard.tsx
@@ -12,7 +12,7 @@ import { Link } from 'react-router-dom';
import defaultImg from 'assets/third_image.png';
import { errorHandler } from 'utils/errorHandler';
-interface UserListCardProps {
+interface InterfaceUserListCardProps {
key: string;
id: string;
memberName: string;
@@ -21,7 +21,7 @@ interface UserListCardProps {
memberEmail: string;
}
-function UserListCard(props: UserListCardProps): JSX.Element {
+function userListCard(props: InterfaceUserListCardProps): JSX.Element {
const currentUrl = window.location.href.split('=')[1];
const [adda] = useMutation(ADD_ADMIN_MUTATION);
@@ -29,7 +29,7 @@ function UserListCard(props: UserListCardProps): JSX.Element {
keyPrefix: 'userListCard',
});
- const AddAdmin = async () => {
+ const addAdmin = async (): Promise => {
try {
const { data } = await adda({
variables: {
@@ -79,7 +79,7 @@ function UserListCard(props: UserListCardProps): JSX.Element {
{t('addAdmin')}
@@ -92,4 +92,4 @@ function UserListCard(props: UserListCardProps): JSX.Element {
);
}
export {};
-export default UserListCard;
+export default userListCard;
diff --git a/src/components/UserPasswordUpdate/UserPasswordUpdate.test.tsx b/src/components/UserPasswordUpdate/UserPasswordUpdate.test.tsx
index 39af22082b..7b07db0cc7 100644
--- a/src/components/UserPasswordUpdate/UserPasswordUpdate.test.tsx
+++ b/src/components/UserPasswordUpdate/UserPasswordUpdate.test.tsx
@@ -33,7 +33,7 @@ const MOCKS = [
const link = new StaticMockLink(MOCKS, true);
-async function wait(ms = 5) {
+async function wait(ms = 5): Promise {
await act(() => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
diff --git a/src/components/UserPasswordUpdate/UserPasswordUpdate.tsx b/src/components/UserPasswordUpdate/UserPasswordUpdate.tsx
index d3e42a5803..2fc2874360 100644
--- a/src/components/UserPasswordUpdate/UserPasswordUpdate.tsx
+++ b/src/components/UserPasswordUpdate/UserPasswordUpdate.tsx
@@ -7,12 +7,15 @@ import styles from './UserPasswordUpdate.module.css';
import { toast } from 'react-toastify';
import { Form } from 'react-bootstrap';
-interface UserPasswordUpdateProps {
+interface InterfaceUserPasswordUpdateProps {
id: string;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-const UserUpdate: React.FC = ({ id }): JSX.Element => {
+const UserUpdate: React.FC = ({
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ id,
+}): JSX.Element => {
const { t } = useTranslation('translation', {
keyPrefix: 'userPasswordUpdate',
});
@@ -24,17 +27,19 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
const [login] = useMutation(UPDATE_USER_PASSWORD_MUTATION);
- const login_link = async () => {
+ const loginLink = async (): Promise => {
if (
!formState.previousPassword ||
!formState.newPassword ||
!formState.confirmNewPassword
) {
- return toast.error('The password field cannot be empty.');
+ toast.error('The password field cannot be empty.');
+ return;
}
if (formState.newPassword !== formState.confirmNewPassword) {
- return toast.error('New and Confirm password do not match.');
+ toast.error('New and Confirm password do not match.');
+ return;
}
try {
@@ -52,14 +57,14 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
window.location.reload();
}, 2000);
}
- } catch (error) {
+ } catch (error: any) {
/* istanbul ignore next */
- toast.error(error);
+ toast.error(error.toString());
}
};
/* istanbul ignore next */
- const cancelUpdate = () => {
+ const cancelUpdate = (): void => {
window.location.reload();
};
@@ -78,7 +83,7 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
autoComplete="off"
required
value={formState.previousPassword}
- onChange={(e) => {
+ onChange={(e): void => {
setFormState({
...formState,
previousPassword: e.target.value,
@@ -97,7 +102,7 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
autoComplete="off"
required
value={formState.newPassword}
- onChange={(e) => {
+ onChange={(e): void => {
setFormState({
...formState,
newPassword: e.target.value,
@@ -116,7 +121,7 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
autoComplete="off"
required
value={formState.confirmNewPassword}
- onChange={(e) => {
+ onChange={(e): void => {
setFormState({
...formState,
confirmNewPassword: e.target.value,
@@ -130,7 +135,7 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
type="button"
className={styles.greenregbtn}
value="savechanges"
- onClick={login_link}
+ onClick={loginLink}
>
{t('saveChanges')}
diff --git a/src/components/UserUpdate/UserUpdate.test.tsx b/src/components/UserUpdate/UserUpdate.test.tsx
index 559a1d6342..7b627367a9 100644
--- a/src/components/UserUpdate/UserUpdate.test.tsx
+++ b/src/components/UserUpdate/UserUpdate.test.tsx
@@ -68,7 +68,7 @@ const MOCKS = [
const link = new StaticMockLink(MOCKS, true);
-async function wait(ms = 5) {
+async function wait(ms = 5): Promise {
await act(() => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
diff --git a/src/components/UserUpdate/UserUpdate.tsx b/src/components/UserUpdate/UserUpdate.tsx
index 9f384ceda7..6807565c3c 100644
--- a/src/components/UserUpdate/UserUpdate.tsx
+++ b/src/components/UserUpdate/UserUpdate.tsx
@@ -12,12 +12,14 @@ import { toast } from 'react-toastify';
import { errorHandler } from 'utils/errorHandler';
import { Form } from 'react-bootstrap';
-interface UserUpdateProps {
+interface InterfaceUserUpdateProps {
id: string;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-const UserUpdate: React.FC = ({ id }): JSX.Element => {
+const UserUpdate: React.FC = ({
+ id,
+}): JSX.Element => {
const currentUrl = localStorage.getItem('id');
const { t } = useTranslation('translation', {
keyPrefix: 'userUpdate',
@@ -64,7 +66,7 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
window.location.assign(`/orgsettings/id=${currentUrl}`);
}
- const login_link = async () => {
+ const loginLink = async (): Promise => {
try {
const { data } = await updateUser({
variables: {
@@ -97,7 +99,7 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
};
/* istanbul ignore next */
- const cancelUpdate = () => {
+ const cancelUpdate = (): void => {
window.location.reload();
};
@@ -116,7 +118,7 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
autoComplete="off"
required
value={formState.firstName}
- onChange={(e) => {
+ onChange={(e): void => {
setFormState({
...formState,
firstName: e.target.value,
@@ -135,7 +137,7 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
autoComplete="off"
required
value={formState.lastName}
- onChange={(e) => {
+ onChange={(e): void => {
setFormState({
...formState,
lastName: e.target.value,
@@ -154,7 +156,7 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {
autoComplete="off"
required
value={formState.email}
- onChange={(e) => {
+ onChange={(e): void => {
setFormState({
...formState,
email: e.target.value,
@@ -171,7 +173,7 @@ const UserUpdate: React.FC = ({ id }): JSX.Element => {