Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to fix esLint " parserOptions.project has been set for @typescript-eslint/parser "?

$
0
0

I get that wired error message on each file on my project:

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.The file does not match your project config: ../../../../../../../home/gautier/Travail/react-native/appli/appliAudioCap/App.tsx.The file must be included in at least one of the projects provided

The path being the relative path of the file (which is in /home/gautier/Travail/react-native/appli/appliAudioCap/App.tsx in that case, because I opened App.tsx in VsCode). The application is a react-native application, in an expo-managed workspace. I'm using Visual Code Studio.

I've tried multiples solution on other thread, trying to include sources repertories, but it doesn't seem to be working. Did I do something wrong with my different configuration ?

.eslintrc.json

{"root": true,"parser": "@typescript-eslint/parser",  // Tried to override, not working  // "overrides": [  //   {  //     "files": ["*.ts", "*.tsx"], // Your TypeScript files extension  //     "parserOptions": {  //       "project": ["./tsconfig.json"] // Specify it only for TypeScript files  //     }  //   }  // ],"plugins": ["@typescript-eslint", "react", "react-hooks"],"extends": ["eslint:recommended","plugin:@typescript-eslint/eslint-recommended","plugin:@typescript-eslint/recommended","airbnb-typescript","prettier"  ],"parserOptions": {"project": "./tsconfig.json"    // "project": "./tsconfig.eslint.json"  },"ignorePatterns": [".eslintrc.json"],"rules": {"@typescript-eslint/no-unused-expressions": "error","@typescript-eslint/no-unused-vars": "error","no-console": "error","react/self-closing-comp": "error","react-hooks/exhaustive-deps": "error","react-hooks/rules-of-hooks": "error","import/prefer-default-export": "off",    // Tempo ? Rules because prettier force them false"@typescript-eslint/comma-dangle": "off","operator-linebreak": "off","object-curly-newline": "off","implicit-arrow-linebreak": "off","no-param-reassign": ["error",      {"props": true,"ignorePropertyModificationsFor": ["state"]      }    ]  }}

ts.config.json

{"extends": "expo/tsconfig.base","compilerOptions": {"allowSyntheticDefaultImports": true,"jsx": "react-native","lib": ["dom", "esnext"],"moduleResolution": "node","noEmit": true,"skipLibCheck": true,"resolveJsonModule": true,"strict": true,"esModuleInterop": true,"allowJs": true,"baseUrl": ".","paths": {"@App/*": ["*"]    }  }}

tsconfig.eslint.json(not used anymore)

{  // extend your base config so you don't have to redefine your compilerOptions"extends": "./tsconfig.json","include": ["src", "__tests__"]}

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>