ESLint

프로젝트에서 자바스크립트 코드 작성하는 방식을 일관성 있게 구현하도록 도와줌
Prettier
일관된 텍스트 형식을 가질 수 있음 -> 스타일 교정
설정
패키지 설치
npm i -D eslint prettier eslint-plugin-vue eslint-config-prettier eslint-plugin-prettier
.eslintrc.js 파일 생성
module.exports = {
root: true,
env: {
node: true,
browser: true,
},
extends: [
"plugin:vue/vue3-recommended",
"eslint:recommended",
"plugin:prettier/recommended",
],
parserOptions: {
parser: "@babel/eslint-parser",
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"prettier/prettier": [
// prettier 룰 추가
"error",
{
singleQuote: true,
semi: true,
useTabs: true,
tabWidth: 2,
trailingComma: "all",
printWidth: 80,
bracketSpacing: true,
arrowParens: "avoid",
endOfLine: "auto",
},
],
},
};
.vscode에 settings.json 파일 생성
저장 시 자동 포맷팅 설정
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
참고
'프로젝트' 카테고리의 다른 글
| VSCode에서 GitHub에 프로젝트 올리기 (0) | 2025.01.20 |
|---|---|
| Vue.js (Vue 3) Bootstrap 적용 (0) | 2025.01.17 |
| Vite를 사용해서 Vue.js (Vue 3) 프로젝트 생성 (0) | 2025.01.14 |
| docker-compose pgAdmin4 설정 (0) | 2025.01.06 |
| docker-compose 네트워크 : Spring boot와 PostgreSQL 연결 (0) | 2025.01.05 |