Open furdzik opened 3 years ago
[PROPOSITION]
The best order I come up with:
external:
@material-ui
{enter}configuration, types and constants:
@config
(API config, environment, lang etc.)
{enter}@types / @interfaces
{enter}@constants
{enter}main parts:
@routes
(navigation, index)
{enter}data and API:
@data
(JSON files)
{enter}*@api
{enter}utils, hooks:
@utils
{enter}@hooks
(useBrakepoint or other styles hooks can be without enter if next is @style/brakepoint
)
{enter}app general styles and assets:
@styles
{enter}@assets
{enter}app general langs:
@lang
{enter}components and containers (also @contexts):
@context
- alphabetically
{enter}@components/ui
- alphabetically
{enter}*@components
- alphabetically
{enter}*@containers
- alphabeticallycomponent internal utils and stuff:
* - is optional
TODO: Additionally, formating!
In case of import uses of hooks is import as { useState } etc.
React.createElement
and React.Fragment
use form React.
TODO: Compose all imports in one file and correct order
EXAMPLES:
import { fetchSome, fetchSomeDictionary, updateSome } from '@api';
import { getLanguageType } from '@utils/getLanguageType';
import { openAlert } from '@containers/LayoutContainer/LayoutContainer.reducer';
import { prepereSomeToSend } from './utils';
import messages from './SomeSection.messages';
const initialState = {
...
};
const actionTypes = {
...
};
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import { IMAGES_SIZES } from '@config/constants';
import { eventsShape } from '@shapes/EventsSection.shape';
import { useBreakpoint } from '@utils/hooks/useBreakpoint';
import { getCdnResizeParams } from '@utils/getCdnResizeParams';
import { EmergencyModeContext } from '@utils/contexts/emergencyModeContext';
import { checkIfEventHasEndedAlready } from '@utils/checkIfEventHasEndedAlready';
import { breakpoints } from '@styles/basic';
import Section from '@components/ui/Section';
import ShadowBox from '@components/ui/ShadowBox';
import PersonalInfo from '@components/ui/PersonalInfo';
import Avatar from '@components/Avatar';
import LiveIndicator from '@components/LiveIndicator';
import SaveEventSeat from '@components/SaveEventSeat';
import EventsScheduleHeader from '@components/EventsScheduleHeader';