To solve the error “Parsing Error: Cannot read file ‘tsconfig.json’”, update your .eslintrc.js
file to set the tsconfigRootDir
option to __dirname
to force ESLint to resolve your project configuration relative to the folder where .eslintrc.js
is located.
Note: If there is a .eslintrc
file instead in your application, you should transform it into .eslintrc.js
first.
Open your .eslintrc.js
file and add or update your parserOptions
object to look as follows.
.eslintrc.js
1 | module.exports = { |
By setting the parserOptions object we tell ESLint which JavaScript language options we want to support.
The sourceType
option is set to module
to indicate that we want to support ES6 Modules.
The tsconfigRootDir
option is set to __dirname
, so ESLint resolves our project config relative to the .eslintrc.js
file.