상세 컨텐츠

본문 제목

[ESLint] vite+React+TS 프로젝트 세팅 시 린트 오류 해결하기

Programming/기타

by 겨리! 2024. 1. 12. 18:36

본문

 

 

 

vite를 사용해서 React + TS 프로젝트 환경을 세팅하던 중 ESLint 오류가 발생했다.

 

🧨 에러

 

.eslintrc.cjs와 vite.config.ts 파일에서 ESLint 오류가 발생하고 있다. 😬😬

 

에러 내용 

// eslintrc.cjs

Parsing error: ESLint was configured to run on <tsconfigRootDir>/.eslintrc.cjs using parserOptions.project: <tsconfigRootDir>/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`: <tsconfigRootDir>/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파일에서 ignorePatterns 속성을 추가해주면 된다.

// .eslintrc.cjs

...
ignorePatterns: ['.eslintrc.cjs', 'vite.config.ts'],
...

 

 


Reference

 

https://github.com/vitejs/vite/issues/13739

 

Parsing error: ESLint was configured to run on `<tsconfigRootDir>/vite.config.ts` using `parserOptions.project`: · Issue #13739

Describe the bug pnpm create vite react typescript-swc Reproduction https://stackblitz.com/edit/vitejs-vite-psmxmw?file=tsconfig.node.json Steps to reproduce No response System Info OS: macOS 12.5....

github.com

 

관련글 더보기

댓글 영역