ReactNative - [Error] ES Lint - Parsing error
author: Dev.ian
createdAt: 2022-05-28
updatedAt: 2022-05-28
ReactNative 의 EsLint 에러를 해결해 본다.
Intro
React Native 프로젝트에서 ES Lint 설정을 한 뒤, .eslintrc.js
파일을 조금 수정했다.
Typescript 를 사용하고 있기에 parserOptions 에 project 항목을 추가하여 tsconfig.json
파일을 참조하도록 했다.
-
.eslintrc.js
...
'parserOptions': {
'ecmaFeatures': {
'jsx': true
},
'ecmaVersion': 12,
'project': './tsconfig.json',
},
...
그리고 기본값으로 설정되어 있는 package.json
파일의 lint를 실행했다.
package.json
"scripts": {
...
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
...
},
-
실행
$ npm run lint
/${PROJECT_PATH}/${APP_NAME}/.eslintrc.js
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: .eslintrc.js.
The file must be included in at least one of the projects provided
/${PROJECT_PATH}/${APP_NAME}/babel.config.js
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: babel.config.js.
The file must be included in at least one of the projects provided
/${PROJECT_PATH}/${APP_NAME}/metro.config.js
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: metro.config.js.
The file must be included in at least one of the projects provided