create-vite로 React+TS 환경 구축 시 설정 파일에서 린트 오류 발생하는 경우

Shyuuuuni·2023년 7월 16일
1

❌ Trouble-shooting

목록 보기
7/9

create vite@latest 를 사용해 React + TS 환경을 구축했을 경우 .eslintrc.cjs 파일과 vite.config.ts 파일에서 ESLint 오류가 발생하는 경우 해결하는 방법

에러

.eslintrc.cjs

Parsing error: ESLint was configured to run on `<tsconfigRootDir>/.eslintrc.cjs` using `parserOptions.project`: /users/macrent/documents/github-repositories/todolist/tsconfig.json
However, that TSConfig does not include this file. Either:
- Change ESLint's list of included files to not include this file
- Change that TSConfig to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-fileeslint

vite.config.ts

Parsing error: ESLint was configured to run on `<tsconfigRootDir>/vite.config.ts` using `parserOptions.project`: /users/macrent/documents/github-repositories/todolist/tsconfig.json
However, that TSConfig does not include this file. Either:
- Change ESLint's list of included files to not include this file
- Change that TSConfig to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-fileeslint

해결방법

.eslintrc.cjs 파일에 아래 속성을 추가한다.

/* eslint-env node */

module.exports = {
	// ...
  ignorePatterns: [".eslintrc.cjs", "vite.config.ts"],
};

래퍼런스

profile
배짱개미 개발자 김승현입니다 🖐

0개의 댓글