<aside> 💡 - 기본적으로 TSX syntax를 사용합니다

</aside>

Typescript convention


📜  Declare

file-scope 상수는 UPPER_CASE 로 작성합니다.

// file scope
const NUMBER_OF_WHEELS = 6;

file-scope 상수를 제외한 상수, 변수는 camelCase 로 작성합니다.

function printHello(worldName: string) {

	// BAD 👎
  const HELLO_TEXT = 'Hello ';
  console.log(HELLO_TEXT + worldName);

	// GOOD 👍
  const helloText = 'Hello ';
  console.log(helloText + worldName);
}

사용하지 않는 변수일 경우 _ 를 붙입니다.

export type UseProfileProps = unknown;

export const useProfile = (_: UseProfileProps) => {
  const { data } = useUserInfoQuery();
  const { signOut } = useSignOut();

  return {
    user: data?.user,
    signOut,
  };
}

Types & Enums

Type, Enum은 PascalCase 로 작성합니다.

// BAD 👎
type personProps = { /* ... */ };

enum buttonSize {
  // ...
}

// GOOD 👍
type PersonProps = { /* ... */ };

enum ButtonSize {
  // ...
}