Next.js
Storybook
webpack v5
설치
yarn add -D webpack@latest
- Storybook 초기화
npx sb init --builder webpack5
Emotion
yarn add @emotion/react @emotion/styled
With
@emotion/babel-plugin
Note:If you’re using Create React App, you can use the Babel macro
Emotion has an optional Babel plugin that optimizes styles by compressing and hoisting them and creates a better developer experience with source maps and labels.
yarn add --dev @emotion/babel-plugin
@emotion/babel-plugin
사용했을 때의 장점- 소스맵 제공
- emotion allows for emotion components to be targeted like regular CSS selectors
- Minification, dead code elimination 등등
CSS 선택자를 사용하기 위해 @emotion/babel-plugin
ESLint
- 아래의 아티클을 읽고
eslint-config-prettier
만 사용하기로 결정! eslint-config-prettier
- Prettier와 충돌하는 ESLint 규칙을 전부 꺼줌
eslint-plugin-prettier
- 린터 규칙인 것처럼 Prettier를 실행함
- 특정 상황에서 유용할 수 있지만 포맷팅 문제도 오류로 출력돼서 오류 메시지가 지나치게 많아지며 Prettier를 직접 실행하는 것보다 느림
eslint
,eslint-config-prettier
,eslint-config-airbnb
(peerDependencies 포함) 설치
yarn add -D eslint eslint-config-prettier npx install-peerdeps -D eslint-config-airbnb # eslint-config-airbnb의 peerDependencies # eslint-plugin-import # eslint-plugin-react # eslint-plugin-react-hooks # eslint-plugin-jsx-a11y
If using npm 5+, use this shortcut

npx install-peerdeps --dev eslint-config-airbnb
If using yarn, you can also use the shortcut described above if you have npm 5+ installed on your machine, as the command will detect that you are using yarn and will act accordingly. Otherwise, run npm info "eslint-config-airbnb@latest" peerDependencies
to list the peer dependencies and versions, then run yarn add --dev <dependency>@<version>
for each listed peer dependency.
.eslintrc
작성
{ "env": { "browser": true, "node": true }, "extends": ["airbnb", "prettier", "next/core-web-vitals"], "rules": { "react/react-in-jsx-scope": 0, "react/jsx-props-no-spreading": 0, "react/function-component-definition": [ 1, { "namedComponents": "arrow-function", "unnamedComponents": "arrow-function" } ], "arrow-body-style": ["error", "always"] } }
Prettier
Prettier
설치
yarn add -D prettier
workspace
에.vscode/settings.json
작성Workspace Settings
: Settings stored inside your workspace and only apply when the workspace is opened.- Workspace settings override user settings. Workspace settings are specific to a project and can be shared across developers on a project.
{ "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode" }
.prettierrc
작성
{ "printWidth": 80, "tabWidth": 2, "singleQuote": true, "trailingComma": "all", "bracketSpacing": true, "jsxBracketSameLine": true, "semi": false, "arrowParens": "always", "jsxSingleQuote": false, "quoteProps": "as-needed", "htmlWhitespaceSensitivity": "css", "endOfLine": "auto", "insertPragma": false, "proseWrap": "preserve", "requirePragma": false, "useTabs": false, "vueIndentScriptAndStyle": false }
✍🏻 추가해야 될 내용
Storybook
builder로 webpack v5
쓴 이유eslint-config-prettier
정확히 하는 일 & eslint-plugin-prettier
와의 차이점@babel/eslint-parser
가 하는 일Prettier
option 내용.eslintrc
작성package.json
전체.vscode/settings.json
option, 작성법@emotion/babel-plugin, @emotion/babel-preset-css-prop 문제점
jsx 태그와 css 속성