-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
경북대 FE_정서현_1주차 과제 Step1/2/3 #46
Open
hyunaeri
wants to merge
43
commits into
kakao-tech-campus-2nd-step2:1oveydev
Choose a base branch
from
hyunaeri:1oveydev
base: 1oveydev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
9243d4d
Feat: initialize project using CRA
hyunaeri 316e041
Feat: add alias paths
hyunaeri 8f9c23d
Docs: add README.md
hyunaeri 2c51629
Docs: add README.md
hyunaeri 1ea4a01
Feat: add ESLint configuration
hyunaeri 4f302c4
Chore: switch from npm to yarn
hyunaeri 4555385
Chore: switch from npm to yarn
hyunaeri 1eb0c6e
Feat: add Prettier configuration
hyunaeri 7704884
Docs: add README.md
hyunaeri 7ca3eef
Chore: configure ESLint and Prettier to avoid conflicts
hyunaeri bd10b45
Chore: add ESLint and Prettier configuration files
hyunaeri 5066d89
Chore: add lint script to package.json
hyunaeri b7455ce
Docs: add README.md
hyunaeri e7e0683
Chore: remove unnecessary files
hyunaeri 1df33dd
Chore: remove unnecessary files
hyunaeri 4a3d7ad
Feat: initialize App.tsx
hyunaeri afd214d
Feat: add Emotion for css-in-js styling
hyunaeri 33231b0
Chore: modify Prettier configuration
hyunaeri 7caaafc
Feat: add jsxImportSource
hyunaeri 3799b98
Docs: add README.md
hyunaeri 040051d
Feat: apply Reset CSS
hyunaeri ce410eb
Feat: Add path alias configuration to tsconfig.json for absolute imports
hyunaeri 7520a08
Feat: add GlobalStyle.tsx for Reset CSS
hyunaeri f122b6f
Chore: removed unnecessary tags and comments
hyunaeri 5a5b347
Chore: set up initial project directory structure
hyunaeri b5cf0ab
Docs: add directory structure description
hyunaeri 2328790
Docs: add directory structure description
hyunaeri bdd8188
Feat: initialize index.tsx
hyunaeri 9faf06d
Docs: add Storybook directory structure
hyunaeri c910b43
Docs: rename from services to api
hyunaeri c76d8ea
Refactor: rename services directory to api
hyunaeri 6945f88
Refactor: remove services directory to api
hyunaeri 8251198
Refactor: modify import in App.tsx
hyunaeri 277c232
Refactor: modify path alias configuration
hyunaeri 50ed6b6
Docs: modify README.md
hyunaeri 961bb4b
Chore: update code style and configuration files
hyunaeri e392444
Feat: add craco for absolute path alias
hyunaeri bada9d0
Refactor: modify ESLint rules
hyunaeri 342c4da
Feat(Storybook): add components & stories
hyunaeri 09c1371
Chore: add comments to eslintrc.cjs
hyunaeri e86d885
Feat: implement Storybook components
hyunaeri 07d7bcd
Docs: add final README.md
hyunaeri 96a1067
Refactor: modify ESlint rules
hyunaeri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
module.exports = { | ||
env: { | ||
// [env] 프로젝트 환경 설정, 브라우저 환경과 ES2021 문법, node 사용 | ||
browser: true, | ||
es2021: true, | ||
node: true, | ||
}, | ||
|
||
// [plugins] typescript 를 parser 로 사용하도록 함 | ||
plugins: ['react', 'react-hooks', 'jsx-a11y'], | ||
|
||
// [extends] 프로젝트에 사용할 eslint 규칙 | ||
extends: [ | ||
'airbnb', | ||
'airbnb/hooks', | ||
'plugin:import/errors', | ||
'plugin:import/warnings', | ||
'plugin:prettier/recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'plugin:storybook/recommended', | ||
], | ||
|
||
overrides: [], | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
// [rules] 상세 규칙 | ||
rules: { | ||
'no-var': 'warn', // var 금지 | ||
'react/prop-types': 0, // 컴포넌트의 props 검사 비활성화, propstype 사용하지 않아도 경고 띄우지 않음 | ||
'no-extra-semi': 'error', // 불필요한 세미콜론 사용 시 에러 표시 | ||
'react/jsx-filename-extension': [ | ||
2, | ||
{ extensions: ['.js', '.jsx', '.ts', '.tsx'] }, // jsx 파일 확장자 .jx, .jsx, .ts, .tsx 허용 | ||
], | ||
|
||
'arrow-parens': ['warn', 'as-needed'], // 화살표 함수의 파라미터가 하나일때 괄호 생략 | ||
'no-unused-vars': ['off'], // 사용하지 않는 변수가 있을 때 발생하는 경고 비 활성화 | ||
'no-console': ['off'], // 콘솔 사용 시 발생하는 경고 비 활성화 | ||
'import/prefer-default-export': ['off'], // export문이 하나일 때 default export 사용 권장 경고 비 활성화 | ||
'react-hooks/exhaustive-deps': ['warn'], // react hooks의 의존성배열이 충분하지 않을 때 경고 표시 | ||
'react/jsx-pascal-case': 'warn', // 컴포넌트 이름은 PascalCase로 | ||
'react/jsx-key': 'warn', // 반복문으로 생성하는 요소에 key 강제 | ||
'no-debugger': 'off', // 디버그 허용 | ||
'prettier/prettier': ['error', { endOfLine: 'auto' }], | ||
'react/function-component-definition': [ | ||
2, | ||
{ namedComponents: ['arrow-function', 'function-declaration'] }, | ||
], | ||
'react/react-in-jsx-scope': 0, | ||
'react/prefer-stateless-function': 0, | ||
'react/jsx-one-expression-per-line': 0, | ||
'no-nested-ternary': 0, | ||
'react/require-default-props': 'off', // 컴포넌트의 props에 기본값을 설정하지 않아도 오류 X | ||
'react/no-unescaped-entities': 'off', // React 컴포넌트 내에서 HTML 엔티티를 사용해도 오류 X | ||
'react/jsx-curly-brace-presence': [ | ||
'warn', | ||
{ props: 'always', children: 'always' }, | ||
], | ||
'import/no-unresolved': ['error', { caseSensitive: false }], // 파일의 경로가 틀렸는지 확인하는 옵션 false | ||
'react/jsx-props-no-spreading': [1, { custom: 'ignore' }], // props spreading 허용하지 않는 경고 표시 | ||
'linebreak-style': 0, | ||
'import/extensions': 0, | ||
'no-use-before-define': 0, | ||
'import/no-extraneous-dependencies': 0, // 테스트 또는 개발환경을 구성 파일에서는 devDependency 사용 허용 | ||
'no-shadow': 0, | ||
'jsx-a11y/no-noninteractive-element-interactions': 0, | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
'jsx-a11y/alt-text': 'off', | ||
quotes: ['error', 'single', { avoidEscape: true }], // 따옴표 규칙 추가 | ||
}, | ||
|
||
settings: { | ||
'import/resolver': { | ||
node: { | ||
paths: ['src'], | ||
extensions: ['.js', '.jsx', '.ts', '.tsx'], | ||
}, | ||
alias: { | ||
map: [ | ||
['@api', './src/api'], | ||
['@assets', './src/assets'], | ||
['@components', './src/components'], | ||
['@constants', './src/constants'], | ||
['@hooks', './src/hooks'], | ||
['@interfaces', './src/interfaces'], | ||
['@mocks', './src/mocks'], | ||
['@pages', './src/pages'], | ||
['@stories', './src/stories'], | ||
['@styles', './src/styles'], | ||
['@utils', './src/utils'], | ||
], | ||
extensions: ['.js', '.jsx', '.ts', '.tsx'], | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
*storybook.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"plugins": ["@trivago/prettier-plugin-sort-imports"], | ||
"importOrder": [ | ||
"^node:.*$", | ||
"<THIRD_PARTY_MODULES>", | ||
"^@/(apis|assets|constants|hooks|mocks|pages|stores|utils)/(.*)$", | ||
"^@/components/(.*)$", | ||
"^@/types/(.*)$", | ||
"^[./]" | ||
], | ||
"importOrderSeparation": true, | ||
"importOrderSortSpecifiers": true, | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"semi": true, | ||
"jsxSingleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { StorybookConfig } from '@storybook/react-webpack5'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
addons: [ | ||
'@storybook/preset-create-react-app', | ||
'@storybook/addon-onboarding', | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@chromatic-com/storybook', | ||
'@storybook/addon-interactions', | ||
], | ||
framework: { | ||
name: '@storybook/react-webpack5', | ||
options: {}, | ||
}, | ||
staticDirs: ['../public'], | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { Preview } from '@storybook/react'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"cSpell.words": [ | ||
"autodocs", | ||
"craco", | ||
"linebreak", | ||
"necolas", | ||
"Parens", | ||
"propstype", | ||
"trivago", | ||
"Viewports" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,45 @@ | ||
# react-gift-react-foundation | ||
FE 카카오 선물하기 1주차 과제: React 기초 | ||
<h1> FE 카카오 선물하기 1주차 과제: React 기초 </h1> | ||
|
||
<h3>1주차 체크 리스트</h3> | ||
|
||
- [x] CRA로 만들어진 프로젝트에 Typescript 로 세팅 | ||
|
||
- [x] ESLint 및 Prettier 추가 후 자신만의 세팅하기 | ||
|
||
- [x] 폴더 구조를 나누고 README.md 에 폴더 구조에 대한 설명 작성 | ||
|
||
- [x] emotion 스타일 라이브러리 추가, reset CSS 적용 | ||
|
||
- [x] .gitignore 를 추가, 프로젝트에 불 필요한 코드들은 정리 | ||
|
||
- [x] 코딩 컨벤션 준수 | ||
|
||
- [x] 기능 단위로 적절하게 커밋 | ||
|
||
- [x] Storybook 을 사용하여 재사용 가능한 컴포넌트 구현 | ||
|
||
- [x] ReadMe 에 주어진 퀴즈에 답변 | ||
|
||
<br> | ||
|
||
--- | ||
|
||
<h3>📌 프로젝트 내 폴더 구조</h3> | ||
|
||
```zsh | ||
src | ||
├── api // API 호출 및 외부 서비스와의 통신 로직 | ||
├── assets // 이미지, 아이콘 등 정적 파일 | ||
├── components // 재사용 가능한 React 컴포넌트 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 그럼 재사용 가능하지 않은 컴포넌트는 어디에 작성하나요~? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 음.. 제 생각으로는 재사용 불가능한 컴포넌트들은 특정 페이지에서만 사용되므로 해당 페이지 컴포넌트 내부에 작성해야 한다고 생각합니다. 따라서 page 폴더에 작성됩니다. |
||
├── constants // 애플리케이션 전반에 사용가능한 상수 값 | ||
├── hooks // 커스텀 React 훅 | ||
├── interfaces // TypeScript 인터페이스 및 타입 정의 | ||
├── mocks // 테스트에 사용할 모의 데이터나 API 응답 | ||
├── pages // 애플리케이션의 각 페이지 컴포넌트 | ||
├── stories // Storybook | ||
├── styles // 전역에서 사용할 스타일 컴포넌트 | ||
│ └── GlobalStyle.tsx | ||
├── utils // 공통으로 사용되는 유틸리티 함수들 | ||
├── index.tsx | ||
└── App.tsx | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
webpack: { | ||
alias: { | ||
'@api': path.resolve(__dirname, 'src/api'), | ||
'@assets': path.resolve(__dirname, 'src/assets'), | ||
'@components': path.resolve(__dirname, 'src/components'), | ||
'@hooks': path.resolve(__dirname, 'src/hooks'), | ||
'@interfaces': path.resolve(__dirname, 'src/interfaces'), | ||
'@mocks': path.resolve(__dirname, 'src/mocks'), | ||
'@pages': path.resolve(__dirname, 'src/pages'), | ||
'@stories': path.resolve(__dirname, 'src/stories'), | ||
'@styles': path.resolve(__dirname, 'src/styles'), | ||
'@utils': path.resolve(__dirname, 'src/utils'), | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"name": "react-gift-react-foundation", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"@craco/craco": "^7.1.0", | ||
"@emotion/css": "^11.11.2", | ||
"@emotion/react": "^11.11.4", | ||
"@emotion/styled": "^11.11.5", | ||
"@testing-library/jest-dom": "^5.17.0", | ||
"@testing-library/react": "^13.4.0", | ||
"@testing-library/user-event": "^13.5.0", | ||
"@types/jest": "^27.5.2", | ||
"@types/node": "^16.18.101", | ||
"@types/react": "^18.3.3", | ||
"@types/react-dom": "^18.3.0", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"react-scripts": "5.0.1", | ||
"typescript": "^5.5.2", | ||
"web-vitals": "^2.1.4" | ||
}, | ||
"scripts": { | ||
"start": "craco start", | ||
"build": "craco build", | ||
"test": "craco test", | ||
"eject": "react-scripts eject", | ||
"lint": "eslint .", | ||
"format": "prettier --write .", | ||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"react-app", | ||
"react-app/jest" | ||
] | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@chromatic-com/storybook": "^1.5.0", | ||
"@storybook/addon-essentials": "^8.1.11", | ||
"@storybook/addon-interactions": "^8.1.11", | ||
"@storybook/addon-links": "^8.1.11", | ||
"@storybook/addon-onboarding": "^8.1.11", | ||
"@storybook/blocks": "^8.1.11", | ||
"@storybook/preset-create-react-app": "^8.1.11", | ||
"@storybook/react": "^8.1.11", | ||
"@storybook/react-webpack5": "^8.1.11", | ||
"@storybook/test": "^8.1.11", | ||
"@trivago/prettier-plugin-sort-imports": "^4.3.0", | ||
"@typescript-eslint/eslint-plugin": "^7.14.1", | ||
"@typescript-eslint/parser": "^7.14.1", | ||
"eslint": "^9.5.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-import-resolver-alias": "^1.1.2", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-jsx-a11y": "^6.9.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-react": "^7.34.3", | ||
"eslint-plugin-react-hooks": "^4.6.2", | ||
"eslint-plugin-storybook": "^0.8.0", | ||
"prettier": "^3.3.2", | ||
"prop-types": "^15.8.1", | ||
"react-app-rewired": "^2.2.1", | ||
"storybook": "^8.1.11", | ||
"webpack": "^5.92.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>React App</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import GlobalStyle from '@styles/GlobalStyle'; | ||
|
||
function App() { | ||
return ( | ||
<div className='App'> | ||
test | ||
<GlobalStyle /> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
Empty file.
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 특정 룰을 선호한다기 보다는 팀원들과 논의해서 정하는 편입니다.
선호하는 규칙은 따로 없는데요, 다만 airbnb 규칙은 불호에 가깝습니다 ㅋㅋㅋ
이유는 너무 빡빡하게 굴어서.. 인데요. 가끔 '이게 왜?'라는 느낌을 받을 때가 많습니다.
그럴 때마다 일일히 규칙을 꺼주는 것도 번거롭구요.
개인적으로는 린트 룰을 어떻게 설정하는지는 그리 중요하지는 않은 것 같습니다.
물론 정말 중요한 룰이 몇개 있긴 하지만요.(react hooks 관련 룰 같은 것들이요!)
룰의 구체적인 내용보다는 '모든 팀원이 같은 스타일의 코드를 짜도록 강제한다'는 개념이 중요하다고 생각해요.
그래서 지금 당장 어떤 룰은 좋아~ 어떤 룰은 싫어! 라고 생각하기보다는 개발하시면서 이것도 써보고, 저것도 써보시는 것을 추천드려요.
다만, eslint와 prettier를 함께 쓰실때는 각각의 도구가 어떤 역할을 담당하는지 잘 구분하시면 좋을 것 같습니다.
prettier는 텍스트를 가지런히 정돈하는 역할로 사용하고, eslint는 코드를 작성하는 방식에 대한 규칙으로 사용하시게 될텐데요.
예를 들어, prettier는 들여쓰기나 따옴표 등을 담당합니다.
현재 eslint 규칙에는 따옴표 규칙이 포함되어 있네요! 이런 룰은 prettier가 담당하는 것이니 제거하는게 좋겠죠?