Change to using arrow functions (#1603)

* Change to using arrow functions

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>

* Add lint rule

---------

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
gitstart-twenty
2023-09-16 02:41:10 +01:00
committed by GitHub
parent 549335054a
commit 00a3c8ca2b
575 changed files with 2848 additions and 3063 deletions

View File

@ -3,7 +3,7 @@ import { ActivityTargetableEntityForSelect } from '@/activities/types/ActivityTa
import { useFilteredSearchEntityQuery } from '@/search/hooks/useFilteredSearchEntityQuery';
import { useSearchPeopleQuery } from '~/generated/graphql';
export function useFilteredSearchPeopleQuery({
export const useFilteredSearchPeopleQuery = ({
searchFilter,
selectedIds = [],
limit,
@ -11,8 +11,8 @@ export function useFilteredSearchPeopleQuery({
searchFilter: string;
selectedIds?: string[];
limit?: number;
}) {
return useFilteredSearchEntityQuery({
}) =>
useFilteredSearchEntityQuery({
queryHook: useSearchPeopleQuery,
filters: [
{
@ -32,4 +32,3 @@ export function useFilteredSearchPeopleQuery({
} as ActivityTargetableEntityForSelect),
limit,
});
}

View File

@ -12,15 +12,15 @@ import { ActivityType, useDeleteManyPersonMutation } from '~/generated/graphql';
import { GET_PEOPLE } from '../graphql/queries/getPeople';
export function usePersonTableContextMenuEntries() {
export const usePersonTableContextMenuEntries = () => {
const setContextMenuEntries = useSetRecoilState(contextMenuEntriesState);
const openCreateActivityRightDrawer =
useOpenCreateActivityDrawerForSelectedRowIds();
async function handleActivityClick(type: ActivityType) {
const handleActivityClick = async (type: ActivityType) => {
openCreateActivityRightDrawer(type, ActivityTargetableEntityType.Person);
}
};
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
const [tableRowIds, setTableRowIds] = useRecoilState(tableRowIdsState);
@ -31,7 +31,7 @@ export function usePersonTableContextMenuEntries() {
refetchQueries: [getOperationName(GET_PEOPLE) ?? ''],
});
async function handleDeleteClick() {
const handleDeleteClick = async () => {
const rowIdsToDelete = selectedRowIds;
resetRowSelection();
@ -52,7 +52,7 @@ export function usePersonTableContextMenuEntries() {
);
},
});
}
};
return {
setContextMenuEntries: () =>
@ -75,4 +75,4 @@ export function usePersonTableContextMenuEntries() {
},
]),
};
}
};

View File

@ -3,7 +3,7 @@ import { useSetRecoilState } from 'recoil';
import { genericEntitiesFamilyState } from '@/ui/editable-field/states/genericEntitiesFamilyState';
import { useGetPersonQuery } from '~/generated/graphql';
export function usePersonQuery(id: string) {
export const usePersonQuery = (id: string) => {
const updatePersonShowPage = useSetRecoilState(
genericEntitiesFamilyState(id),
);
@ -13,4 +13,4 @@ export function usePersonQuery(id: string) {
updatePersonShowPage(data?.findUniquePerson);
},
});
}
};

View File

@ -12,15 +12,15 @@ import { ActivityType, useDeleteManyPersonMutation } from '~/generated/graphql';
import { GET_PEOPLE } from '../graphql/queries/getPeople';
export function usePersonTableActionBarEntries() {
export const usePersonTableActionBarEntries = () => {
const setActionBarEntries = useSetRecoilState(actionBarEntriesState);
const openCreateActivityRightDrawer =
useOpenCreateActivityDrawerForSelectedRowIds();
async function handleActivityClick(type: ActivityType) {
const handleActivityClick = async (type: ActivityType) => {
openCreateActivityRightDrawer(type, ActivityTargetableEntityType.Person);
}
};
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
const [tableRowIds, setTableRowIds] = useRecoilState(tableRowIdsState);
@ -31,7 +31,7 @@ export function usePersonTableActionBarEntries() {
refetchQueries: [getOperationName(GET_PEOPLE) ?? ''],
});
async function handleDeleteClick() {
const handleDeleteClick = async () => {
const rowIdsToDelete = selectedRowIds;
resetRowSelection();
@ -56,7 +56,7 @@ export function usePersonTableActionBarEntries() {
});
},
});
}
};
return {
setActionBarEntries: () =>
@ -79,4 +79,4 @@ export function usePersonTableActionBarEntries() {
},
]),
};
}
};

View File

@ -21,7 +21,7 @@ import { peopleLinkedinUrlFamilyState } from '../states/peopleLinkedinUrlFamilyS
import { peopleNameCellFamilyState } from '../states/peopleNamesFamilyState';
import { peoplePhoneFamilyState } from '../states/peoplePhoneFamilyState';
export function useSetPeopleEntityTable() {
export const useSetPeopleEntityTable = () => {
const resetTableRowSelection = useResetTableRowSelection();
const tableContextScopeId = useRecoilScopeId(TableRecoilScopeContext);
@ -134,4 +134,4 @@ export function useSetPeopleEntityTable() {
},
[currentLocation, resetTableRowSelection, tableContextScopeId],
);
}
};

View File

@ -9,7 +9,7 @@ import { fieldsForPerson } from '../utils/fieldsForPerson';
export type FieldPersonMapping = (typeof fieldsForPerson)[number]['key'];
export function useSpreadsheetPersonImport() {
export const useSpreadsheetPersonImport = () => {
const { openSpreadsheetImport } = useSpreadsheetImport<FieldPersonMapping>();
const { enqueueSnackBar } = useSnackBar();
@ -23,7 +23,7 @@ export function useSpreadsheetPersonImport() {
) => {
openSpreadsheetImport({
...options,
async onSubmit(data) {
onSubmit: async (data) => {
// TODO: Add better type checking in spreadsheet import later
const createInputs = data.validData.map((person) => ({
id: uuidv4(),
@ -59,4 +59,4 @@ export function useSpreadsheetPersonImport() {
};
return { openPersonSpreadsheetImport };
}
};