React + TypeScript + Storybook + ESLint ์ธํ #
ํ๋ก์ ํธ ์์ฑ#
yarn create react-app my-app-name --template typescriptCRA + ESLint + Prettier#
Create-React-App with TypeScript, ESLint, Prettier, and Github Actions
Husky + lint-staged#
์ฌ์ฉํ์ง ์๋ ํ์ผ ์ง์ฐ๊ธฐ#
reportWebVitals- web-vitals๋ฅผ ํตํ ์ฑ๋ฅ ์ธก์ ์ ์ฌ์ฉ๋จyarn remove web-vitalssetupTests.ts- browser API๋ฅผ ์ฌ์ฉํ๊ฑฐ๋ Test ์คํ ์ global setup์ด ํ์ํ๊ฒฝ์ฐ์ ์ฌ์ฉjest์
setupFilesAfterEnv์ ๊ด๋ จ - https://jestjs.io/docs/en/configuration#setupfilesafterenv-arrayhttps://create-react-app.dev/docs/running-tests/#initializing-test-environment
react-app-env.d.ts- yarn start ๋ง๋ค ์์ฑ๋จ. ๋ง์ ์ ์ ๊ฐ ์์ฑ์ ๋ฉ์ถฐ๋ฌ๋ผ๊ณ react team์ ์์ฒญํจ.gitignore์/src/react-app-env.d.ts์ถ๊ฐ.vscode/settings.json์ ์ถ๊ฐ"files.exclude": { "src/*.d.ts": true}
.gitignore#
.gitignore ๋ ํ๋ก์ ํธ์์ ์ค์ํ ๊ฒ์ผ๋ก ์์ฉ ํ๋ก๊ทธ๋จ ์์ฒด์์ ์์ฑํ ํ์ผ์ด๋ ๋๋ ํ ๋ฆฌ๋ฅผ ๋์ดํด์ผ ํ๋ค. ๊ฐ์ฅ ์ข์ ์๋ ์บ์ ํ์ผ, ๋ก๊ทธ, ๋ก์ปฌ ๊ตฌ์ฑ ๋ฑ์ด๋ค.
.vscode , .idea , .DS_Store ๋ฑ์ ํ๋ก์ ํธ์ .gitignore ๋ณด๋ค ์ปดํจํฐ์ ๊ธ๋ก๋ฒ .gitignore ์ ์ถ๊ฐํ๋ ๊ฒ์ด ์ข๋ค.
๊ธ๋ก๋ฒ .gitignore ๋ home ๋๋ ํ ๋ฆฌ์ .gitconfig ์ ๋ณด๋ฉด ์ ์ ์๋ค.
[core] excludesfile = /Users/{home}/.gitignore_globalDon't put .idea and .vscode directories to project's .gitignore
ํด๋ ๊ตฌ์ฑํ๊ธฐ#
โโโ src โโโ components โโโ src โโโ pages โโโ App.tsx โโโ index.tsxStorybook ์ค์นํ๊ธฐ#
npx sb initlint error ๋ฐ์ (์์)
.eslintignore**/*.stories.tsx**/stories/*.tsx.eslintrc.jsrules: { // ... 'import/no-extraneous-dependencies': [ 'error', { devDependencies: [ '**/*.stories.tsx', ], }, ], // ...}storybook babel-loader crash
create-react-app babel-loader clash ยท Issue #4764 ยท storybookjs/storybook
https://storybook.js.org/docs/react/get-started/install
์น ํฐํธ ์ฌ์ฉ#
free illustration#
unDraw - Open source illustrations for any idea
Styled Components#
The Advanced Way to Style with Styled Components
Thoughts around design systems: implementationโ-โReact, Styled-Components, and more
How does the ampersand work in styled-components?
The Sass Ampersand | CSS-Tricks
Type Guard#
https://www.typescriptlang.org/docs/handbook/advanced-types.html