MacOS M2 기준으로 작성되었습니다.
brew install node입력하여 설치node -v 입력하여 제대로 설치되었는지 확인 (v20.6.0)npx creat-react-app <project name> //현재 디렉토리에 리액트 앱 만들기npm start {
"singleQuote": true,
"semi": true,
"useTabs": false,
"tabWidth": 2,
"printWidth": 120
}npm -g add eslint ESLint 다운로드eslint --init ESLint 시작How would you like to use ESlint ? : 구문, 문제, 스타일What type of modiles does your project use? : 사용하는 모듈Which framework does your project use? : 사용하는 프레임워크Does your project use TypeScript? : 타입스크립트 사용 여부Where does your code run? : 코드가 어디에서 실행되는가How would you like to define a style for your project? : 프로젝트 스타일 정의 방법Which style guide do you want to follow? : 스타일 가이드What format do you want your config file to be in? : config파일의 형식Which package manager do you want to use? : 사용하려는 패키지 매니저ESLint, Prettier 충돌
- 설치 완료시 충돌 발생 => Prettier과 충돌하는 ESLint 규칙을 꺼주는 패키지 실행
1.npm install eslint-config-prettier입력
2. .eslintrc.js 파일에 아래 extends 추가(...) extends: [ 'eslint:recommended', 'plugin:react/recommended', 'plugin:prettier/recommended' ], (...)
ESLint 업데이트
[eslint] Failed to load plugin 'prettier' declared in '.eslintrc.js': Cannot find module 'eslint-plugin-prettier'
- 터미널에 입력하여 플러그인 업데이트
npm i eslint-plugin-prettier@latest -D
ESLint 에러 => .eslintrc.js 파일 조건 추가
React must be in scope when using JSX
- 해당 라인에
import React from 'react';추가- 또는 eslint.js파일에 아래 조건 추가
rules: { 'react/react-in-jsx-scope':'off'}'list' is missing in props validation
- 조건 추가
rules: {'react/prop-types': 'off'}Missing JSDoc comment
- 조건 추가
rules: {'require-jsdoc' : 0}rules: { 'react/react-in-jsx-scope': 'off', 'react/prop-types': 'off', 'requre-jsdoc': 0, },