JavaScript_Eslint / Prettier
03 Jul 2023테킷 멋쟁이사자처럼 JavaScript
Eslint / Prettier
npm i -D prettier
npm init @eslint/config
- Eslint는 오류 확인
- prettier는 포맷팅
√ How would you like to use ESLint? · problems
√ What type of modules does your project use? · esm
√ Which framework does your project use? · none
√ Does your project use TypeScript? · No
√ Where does your code run? · browser, node
√ What format do you want your config file to be in? · JavaScript
Local ESLint installation not found.
The config that you've selected requires the following dependencies:
eslint@latest
√ Would you like to install them now? · Yes
√ Which package manager do you want to use? · npm
- 컨벤션 설정할 수 있음
- 잘못된 컨벤션 사용 시 경고(경고 수준 조절 가능)
package-lock.json
- devDependencies
- 단순 개발용이라면 -D 플래그 추가해서 devDependencies에 넣어주면 됨(예. eslint, prettier)
- dependencies
- 배포할 때 올라감
live-server
npm i -D live-server
실행은 npx 사용
npx live-server client
npx live-server client --host=localhost --port=5500 --no-browser
명령어 등록 후에는 npm으로 실행 가능
- npm start
"scripts": {
"start": "live-server client --host=localhost --port=5500 --no-browser"
},