Untitled

Untitled

npm install -g -d eslint //lint 설치

eslint --init

/*설정*/
- to check syntax and find problems 
- javascript modules 
- vue, react: none of these 
- typescript : no 
- browser 
- json

npm install-peerdeps --dev eslint-config-airbnb-base

npm install --save-dev --save-exact prettier

npm install eslint-plugin-prettier@latest --save-dev -g

//겹치는 룰 삭제
npm install --save-dev eslint-config-prettier
//eslint prettier 포메
npm install --save-dev eslint-plugin-prettier
{
  "env": {
    "browser": true,
    "node": true,
    "es2021": true
  },
  "extends": [
    "eslint:recommended",
    "airbnb-base",
    "plugin:prettier/recommended"
  ],
  "parserOptions": {
    "ecmaVersion": 2021,
    "sourceType": "module"
  },
  "rules": { "no-unused-vars": "warn" }
}
module.exports = {
  singleQuote: true, // 문자열은 홑따옴표로 formatting
  semi: true, //코드 마지막에 세미콜른이 있게 formatting
  useTabs: false, //탭의 사용을 금하고 스페이스바 사용으로 대체하게 formatting
  tabWidth: 2, // 들여쓰기 너비는 2칸
  trailingComma: 'all', // 자세한 설명은 구글링이 짱이긴하나 객체나 배열 키:값 뒤에 항상 콤마를 붙히도록 	  	//formatting
  printWidth: 120, // 코드 한줄이 maximum 120칸
  arrowParens: 'avoid', // 화살표 함수가 하나의 매개변수를 받을 때 괄호를 생략하게 formatting
  endOfLine: 'auto', // windows에 뜨는 'Delete cr' 에러 해결
};

Untitled

충돌하지 않게 겹치는 부분 eslint 끄기

1. ctrl + shift + p를 눌러 팔레트를 연다. 
2. format document with ~ 
3. config default formatter 
4. prettier 선택