root: function declaration clean-up
Following this discussion, this MR standardise function declaration. For now on, every named function should have the following pattern:
function Name (): ReturnType {
arrow declarations can still be used, but are limited to in-line utilisation similar to:
list.map((item) => { item.title })
onClick={(): void => changeMonth(true)}
Some examples
- const handleDrop = function (e: any): void {
+ function handleDrop (e: any): void {
- const makeOnClickFilterTeam = (item: string) => () => {
+ function makeOnClickFilterTeam (item: string) {
- function handleClick = async (): Promise<void> => {
+ async function handleClick (): Promise<void> {
- export const coloredAppButtonClasses = function(): string =>
twMerge("...")
+ export const coloredAppButtonClasses: string = twMerge("...")
Additional changes
- updated all
package.json
to have the same version of common packages (vite
,typescript
,eslint
, etc) - completed several function return types
- removed several deprecated icons and components (left
Modal
andSmoothScrollToTopWrapper
as they might need refactoring) - sorted and reorganise imports
- added space before function declaration and returns (manually, so no that consistent)
Edited by Fabio M