I created a new React Native project with --template typescript
I deleted the template
directory which came as part of the boilerplate.
I then proceeded to add ESLint:
module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: ["airbnb-typescript-prettier"]
};
However, when I open babel.config.js
, I get this error
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config:
/Users/Dan/site/babel.config.js
. The file must be included in at least one of the projects provided.eslint
You can create a separate TypeScript config file (tsconfig.eslint.json
) intended for eslint
configuration. That file extends tsconfig
configuration and setups include
key for files that have to be linted.
.eslint.js
:
// ...
parserOptions: {
// ...
project: "./tsconfig.eslint.json",
// ...
},
// ...
tsconfig.eslint.json
:
{
"extends": "./tsconfig.json",
"include": [
// ...
"babel.config.js"
]
}
Or if you want to ignore it, you can put it into .eslintignore
.
.eslintignore
:
// ...
babel.config.js