-
Notifications
You must be signed in to change notification settings - Fork 69
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
frontend-survival-week01 assignment #105
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b5d9975
push test
YeonjuKim1 37e4c00
send assignment 01
YeonjuKim1 be6d0ac
send assignment 01 add
YeonjuKim1 2c0e8c5
send assignment 01 add add
YeonjuKim1 25da3e2
send assignment 01 add add add
YeonjuKim1 adac1cf
send assignment 01 add 4
YeonjuKim1 943ebe1
send assignment 01 add 5
YeonjuKim1 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
Empty file.
Empty file.
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
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,130 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Docusaurus cache and generated files | ||
.docusaurus | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* |
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,4 @@ | ||
{ | ||
"extends": ["@parcel/config-default"], | ||
"reporters": ["...", "parcel-reporter-static-files-copy"] | ||
} |
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,9 @@ | ||
{ | ||
"editor.rulers": [ | ||
80 | ||
], | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"trailing-spaces.trimOnSave": 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 |
---|---|---|
@@ -1,3 +1,131 @@ | ||
# frontend-survival-week01 | ||
|
||
프론트엔드 생존코스 1주차 과제 | ||
|
||
1.node 버전 18.18.0 이상 설치 필요 | ||
>node -v # 노트 버전 확인 | ||
>nvm install 18.20.4 # LTS 버전 | ||
>nvm list # 설치된 node 버전 전부 확인 가능 | ||
>nvm use 18.20.4 # 이걸로 변경 | ||
|
||
2.npm init 하기 | ||
>npm init -y | ||
2-1.[.gitignore] 파일 생성. | ||
|
||
3.typescript 설치 | ||
>npm i -D typescript # 개발도구라 -D | ||
3-1. tsc(type script compiler) 설치 | ||
>npx tsc --init | ||
3-2. tsconfig.json 파일에서 jsx 부분 주석 제거 | ||
|
||
4.ESLint 설치 | ||
>npm i -D eslint | ||
>npx eslint --init | ||
-> To check syntax and find problems | ||
-> javaScript modules(import/export) | ||
-> React | ||
-> Yes #typescript 사용 | ||
-> Browser | ||
-> Yes #지금 설치? | ||
-> npm | ||
==> 안타깝게도 eslint.config.mjs 파일이 생성 됨. | ||
|
||
아래 항목들을 eslint.config.mjs 에 추가해줘야 하는데, 공식문서 어케 보는지 모르겠음. gpt 한테 물어 봄. | ||
4-1.eslintjs 파일에 jest:true 추가 | ||
4-2.eslintjs 파일에 plugin:react/jsx-runtime 추가 | ||
4-3.[.eslintignore] 파일은 이제 더 이상 지원하지 않는단다. 설정 파일에 ignore 항목 형식으로 추가해야 한다. | ||
수정 된 eslint.config.mjs 파일 | ||
|
||
import globals from "globals"; | ||
import pluginJs from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
import pluginReact from "eslint-plugin-react"; | ||
|
||
export default [ | ||
{ | ||
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] | ||
}, | ||
{ | ||
languageOptions: { | ||
...globals.browser, | ||
...globals.jest | ||
} | ||
}, | ||
pluginJs.configs.recommended, | ||
...tseslint.configs.recommended, | ||
pluginReact.configs.flat.recommended, | ||
{ | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
rules: { | ||
'react/react-in-jsx-scope': 'off', | ||
}, | ||
extends: [ | ||
'plugin:react/jsx-runtime', // JSX Runtime 설정 추가 | ||
], | ||
}, | ||
{ | ||
ignores: [ | ||
"node_modules/", // node_modules 폴더 무시 | ||
"dist/", // dist 폴더 무시 | ||
".parcel-cache/" // .parcel-cache 폴더 무시 | ||
] | ||
} | ||
]; | ||
|
||
5.React 설치 | ||
>npm i react react-dom | ||
>npm i -D @types/react @types/react-dom | ||
|
||
6.jest(테스팅 도구) 설치 | ||
>npm i -D jest @types/jest @swc/core @swc/jest jest-environment-jsdom | ||
@testing-library/react @testing-library/jest-dom@5.16.4 | ||
6-1. jset.config.js 파일 만들기 | ||
|
||
7.Parcel 설치 | ||
>npm i -D parcel | ||
7-1. package.json 파일 scripts 에 아래 명령어 추가. | ||
"scripts": { | ||
"start": "parcel --port 8080", | ||
"build": "parcel build", | ||
"check": "tsc --noEmit", | ||
"lint": "eslint --fix src/**/*.{ts,tsx}", | ||
"test": "jest", | ||
"coverage": "jest --coverage --coverage-reporters html", | ||
"watch:test": "jest --watchAll" | ||
}, | ||
|
||
8.기타 | ||
8-1.package.json 기본 파일 잡아주기. | ||
"source": "index.html", | ||
|
||
8-2. ts-node 실행 | ||
>npx ts-node # ts-node 명령모드로 전환 됨. | ||
|
||
8-3. static에 넣은 이미지를 보기 위해 | ||
>npm i -D parcel-reporter-static-files-copy | ||
[.parcelrc] 파일 생성 | ||
{ | ||
"extends": ["@parcel/config-default"], | ||
"reporters": ["...", "parcel-reporter-static-files-copy"] | ||
} | ||
|
||
8-4. 빌드하면, 배포용 이미지. dist 폴더에 생김. 배포 | ||
>npx parcel build | ||
>npx servor dist | ||
|
||
8-5. 확장 프로그램 설치. eslint | ||
|
||
8-6. [.vscode] 폴더 생성. settings.json 파일 생성 | ||
{ | ||
"editor.rulers": [ | ||
80 | ||
], | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"trailing-spaces.trimOnSave": 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,40 @@ | ||
import globals from "globals"; | ||
import pluginJs from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
import pluginReact from "eslint-plugin-react"; | ||
|
||
|
||
export default [ | ||
{ | ||
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] | ||
}, | ||
{ | ||
languageOptions: { | ||
...globals.browser, | ||
...globals.jest | ||
} | ||
}, | ||
pluginJs.configs.recommended, | ||
...tseslint.configs.recommended, | ||
pluginReact.configs.flat.recommended, | ||
{ | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
rules: { | ||
'react/react-in-jsx-scope': 'off', | ||
}, | ||
extends: [ | ||
'plugin:react/jsx-runtime', // JSX Runtime 설정 추가 | ||
], | ||
}, | ||
{ | ||
ignores: [ | ||
"node_modules/", // node_modules 폴더 무시 | ||
"dist/", // dist 폴더 무시 | ||
".parcel-cache/" // .parcel-cache 폴더 무시 | ||
] | ||
} | ||
]; |
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 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>React Demo</title> | ||
<body> | ||
<div id="root"></div> | ||
<div id="demo"></div> | ||
<script type="module" src="./src/main.tsx"></script> | ||
</body> | ||
</head> | ||
</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,26 @@ | ||
module.exports = { | ||
testEnvironment: 'jsdom', | ||
setupFilesAfterEnv: [ | ||
'@testing-library/jest-dom/extend-expect', | ||
], | ||
transform: { | ||
'^.+\\.(t|j)sx?$': ['@swc/jest', { | ||
jsc: { | ||
parser: { | ||
syntax: 'typescript', | ||
jsx: true, | ||
decorators: true, | ||
}, | ||
transform: { | ||
react: { | ||
runtime: 'automatic', | ||
}, | ||
}, | ||
}, | ||
}], | ||
}, | ||
testPathIgnorePatterns: [ | ||
'<rootDir>/node_modules/', | ||
'<rootDir>/dist/', | ||
], | ||
}; |
Oops, something went wrong.
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.
공식문서를 어떻게 보는지 모르겠다는 의미가 잘 와닿지 않는데 아래 답변이 원하시는 방향이 맞는지는 알려주시면 좋겠습니다.
단순히 제가 이 부분을 공식문서를 찾아본다고 생각하면 한번 설명을 드려보자면,
우선 설정 파일을 세팅해야하는게 문제이니
eslint 공식문서에 들어가서 Docs > Configure ESLint 항목에서 각각 아래 옵션들에 대해서 찾아볼 것 같아요.
그러면 목차에 보면
Configuration Files
가 있는데 ~.js/mjs/.cjs 등등 여러가지 확장자 종류가 있다고 나오네요.처음 보는 확장자들도 있어서 잠깐 확장자들에 대해 간단하게 찾아보고 차이를 비교해볼 것 같아요.
그리고 다시 공식 문서로 돌아와 예시를 .js 를 중심으로 나오고 있어서 쉽게 따라하려면 js 파일로 변경해서 해도 되는지 살펴본다음 괜찮다면 .js 파일을 사용할 것 같아요.
추가로 목차를 쭉보면 rules, plugins 등등 몇가지 아래 항목들에 일치하는 항목들이 있어서 그걸 쭉 읽어볼 것 같아요.
대략적으로 쭉 살펴본다음 만약
mjs
확장자를 그대로 사용할거면 어떻게 코드를 작성하는지는 따로 찾아보거나 GPT 등에 물어볼 것 같아요.공식 문서를 따로 보는 방법이 있다기 보단 사실 인내심을 가지고 공식 문서를 어느 정도 수준으로 살펴볼거냐가 아닐까 싶어요.
저도 한번 정도는 사용하는 라이브러리들 공식문서를 읽긴 하는데 그 이후에는 보통 필요한 부분만 대략적으로 찾아서 읽는 편이에요!
예전에도 어떻게 공식문서를 보면 좋을지 모르겠다 말씀하신 적이 있는 것 같아서 추가적으로 필요하거나 궁금하신 점은 디스코드에서 물어봐주시면 감사하겠습니다 :)