inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

[리뉴얼] React로 NodeBird SNS 만들기

CORS 문제 해결하기

eslint와 prettier 설정 관련 질문

590

haruharu

작성한 질문수 43

0

예전에 여쭤보고 블로그들 찾아봐서 적용했는데 airbnb와 prettier를 같이 적용하면 에러가 제대로 안뜨고 엄격한 규칙이 제대로 적용이 안되는것같습니다. 

아래 처럼 설정해 두었는데 어디를 수정해야지 airbnb eslint를 제대로 사용하면서 prettier까지 적용할 수 있을까요??

.eslintrc

{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"node": true,
"es6": true
},
"ignorePatterns": ["node_modules/"],
"extends": ["airbnb", "plugin:prettier/recommended"],
"plugins": ["import", "react-hooks", "prettier"],
"rules": {
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/anchor-is-valid": "off",
"no-console": "off",
"no-underscore-dangle": "off",
"react/forbid-prop-types": "off",
"react/jsx-filename-extension": "off",
"react/jsx-one-expression-per-line": "off",
"object-curly-newline": "off",
"linebreak-style": "off",
"no-param-reassign": "off"
}
}

.prettierrc

{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"endOfLine": "auto",
"jsxBracketSameLine": false
}

vscode에 settings.json

//화면크기에따라 줄바꿈 설정
"editor.wordWrap": "on",
//prettier 설정
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"[json]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace",
"gitlens.codeLens.scopes": ["document"]
},

// For ESLint
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},

"launch": {
"configurations": [],
"compounds": []
},
// jsx 자동완성 추천
"emmet.syntaxProfiles": {
"javascript": "jsx"
},
// jsx에서 html 자동완성 추천
"emmet.includeLanguages": {
"javascript": "html"
},
//import 변경 자동 수정
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.fontLigatures": null,
"workbench.colorTheme": "Material Theme Darker High Contrast"
}

redux express nodejs react Next.js

답변 1

0

제로초(조현영)

airbnb와 prettier 둘 다 자기만의 스타일대로 코드를 강제합니다. 그러므로 둘 중에 하나만 쓰셔야 합니다.

넥스트 버젼 질문

0

90

2

로그인시 401 Unauthorized 오류가 뜹니다

0

104

1

무한 스크롤 중 스크롤 튐 현상

0

192

1

특정 페이지 접근을 막고 싶을 때

0

116

2

createGlobalStyle의 위치와 영향범위

0

102

2

인라인 스타일 리렌더링 관련

0

98

2

vsc 에서 npm init 설치시 오류

0

157

2

nextjs 15버전 사용 가능할까요?

0

166

1

화면 새로고침 문의

0

129

1

RTK에서 draft, state 차이가 있나요?

0

160

2

Next 14 사용해도 될까요?

0

455

1

next, node 버전 / 폴더 구조 질문 드립니다.

0

359

1

url 오류 질문있습니다

0

214

1

ssh xxxxx로 우분투에 들어가려니까 port 22: Connection timed out

0

391

1

sudo certbot --nginx 에러

0

1293

2

Minified React error 콘솔에러 (hydrate)

0

477

1

카카오 공유했을 때 이전에 작성했던 글이 나오는 버그

0

255

1

프론트서버 배포 후 EADDRINUSE에러 발생

0

337

1

npm run build 에러

0

525

1

front 서버 npm run build 중에 발생한 에러들

0

399

1

서버 실행하고 브라우저로 들어갔을때 404에러

0

350

2

css 서버사이드 랜더링이 적용되지 않아서 문의 드립니다.

0

290

1

팔로워 3명씩 불러오고 데이터 합쳐주는걸로 바꾸고 서버요청을 무한으로하고있습니다.

0

249

2

해시태그 검색에서 throttle에 관해 질문있습니다.

0

206

1