[CloseSea] eslint, prettier 설정

2022. 12. 26. 17:22·팀프로젝트/close_sea
728x90
반응형

개발을 하던 중간 서로 prettier의 설정이 달라 코드 정렬이 계속 달라졌다.

이를 해결하기 위해 eslinit와 prettier로 작업영역의 코드스타일을 통일 시키려고 했다.

루트 폴더구조

루트폴더

/.vscode/setting.json

{
  "editor.codeActionsOnSave": {
    "source.fixAll": true
  },
  "eslint.workingDirectories": [{ "mode": "auto" }]
}

.vscode 폴더에 들어있는 setting.json은 루트 폴더 작업영역내의 설정을 해주는 것이다.

 

"editor.codeActionsOnSave": {
    "source.fixAll": true
},

저장을 할때마다 formatter규칙에 따라 format을 해준다는 설정이다.

"eslint.workingDirectories": [{ "mode": "auto" }]

eslint를 적용할 폴더를 루트폴더로 설정한다.

 

프론트

/front/.eslintrc.json

{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": [
    "plugin:react/recommended",
    "standard",
    "plugin:prettier/recommended"
  ],
  "parser": "@babel/eslint-parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": "latest",
    "sourceType": "module"
  },
  "plugins": ["react", "react-hooks"],
  "rules": {
    "prettier/prettier": ["warn", { "endOfLine": "auto" }],
    "react/prop-types": "off"
  }
}

/front/babel.config.json

{
  "presets": ["@babel/preset-react"]
}

/front/.prettierrc

{
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": false
}

/front/jsconfig.json

{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": ["src", "src/image"]
}

리액트 루트 경로를 src로 설정하여 import 시 경로를 깔끔하게 하기 위해 설정했다.

728x90
반응형

'팀프로젝트 > close_sea' 카테고리의 다른 글

[CloseSea] NFT거래 권한 이슈  (0) 2022.12.28
[CloseSea] 지갑연결 버튼  (0) 2022.12.28
[CloseSea] 스마트 컨트랙트  (1) 2022.12.27
[CloseSea] swap페이지 만들기  (0) 2022.12.27
[Docker] ERROR in [eslint] EACCES: permission denied, mkdir '/app/node_modules/.cache'  (0) 2022.12.20
'팀프로젝트/close_sea' 카테고리의 다른 글
  • [CloseSea] 지갑연결 버튼
  • [CloseSea] 스마트 컨트랙트
  • [CloseSea] swap페이지 만들기
  • [Docker] ERROR in [eslint] EACCES: permission denied, mkdir '/app/node_modules/.cache'
TeTedo.
TeTedo.
  • TeTedo.
    TeTedo 개발 일기
    TeTedo.
  • 전체
    오늘
    어제
    • 분류 전체보기 (319)
      • 개발 (274)
        • Article (4)
        • 정리 (21)
        • Spring Boot (17)
        • JPA (2)
        • JAVA (6)
        • Database (4)
        • 자료구조 (11)
        • 알고리즘 (32)
        • React (20)
        • Docker (10)
        • node.js (18)
        • Devops (11)
        • Linux (4)
        • TypeScript (3)
        • Go (10)
        • HyperLedger (4)
        • BlockChain (43)
        • html, css, js (48)
        • CS (3)
        • AWS (3)
      • 모아두고 나중에 쓰기 (3)
      • 팀프로젝트 (18)
        • SNS(키보드워리어) (9)
        • close_sea (9)
      • 개인프로젝트 (1)
        • Around Flavor (1)
        • CHAM (13)
        • ethFruitShop (5)
      • 독서 (0)
        • 스프링부트와 AWS로 혼자 구현하는 웹 서비스 (0)
  • 블로그 메뉴

    • 홈
    • 개발일기
    • CS
    • 실습
    • 코딩테스트
    • 웹
    • Go
    • node.js
    • 팀플
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    컨테이너
    nodejs
    명령어
    node
    erc20
    mysql
    30일챌린지
    js
    하이퍼레저
    go언어
    CSS
    React
    30일 챌린지
    ERC721
    블록체인
    node.js
    html
    도커
    프로그래머스
    go
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.1
TeTedo.
[CloseSea] eslint, prettier 설정
상단으로

티스토리툴바