FE를 리딩하며, 여러사람들이 하나의 프로젝트를 진행할때에
비슷한 스타일로 개발되어지지 않으면,
1. 유지보수할때에 전체적인 코드흐름 파악
2. 사이드 이팩트 확인이 어려움.
등의 문제점이 있다는것을 확인할수있었다.
그래서 내가 생각하는 코드 컨벤션을 간단히 정리해보고자 한다.
👉 하나의 레포는 하나의 팀, 하나의 커뮤니케이션 구조와 매핑(Conway’s Law)
pages/SubMain/All → /accounts/allpages/SubMain/Favorite → /accounts/favorite{컴포넌트명}Propsinterface TooltipProps {
children: React.ReactNode;
tooltipText: string;
}
{api명}ParamTypeinterface getAuthIsManagerParamType { … }
ComponentName.d.tsComponentName.types.tspages/Accounts/api/ 폴더:import * as get from './get'; 등으로 묶어 내보냄method + endpoint + 기능명getCommonPointRemaining()
postEdocsCertificate()setSnackbar, setLnbMenu 등 세분화company_no)는 일치시키기const MyComponent = () => {
// 1. store
const { foo, setFoo } = useStore();
// 2. props & split
const { bar } = props;
// 3. hooks
const data = useCustomHook();
// 4. state & ref
const [count, setCount] = useState(0);
// 5. effect
useEffect(() => { … }, []);
// 6. function
const handleClick = () => { … };
// 7. derived data
const isValid = useMemo(() => count > 0, [count]);
// 8. return
return <div>…</div>;
};
feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert)[SVC2DEV5-4994](feat:)<테스트> package.json 개발