I am getting the error: -
Parsing error: "parserOptions.project" has been set for u/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. IDE - WebStorm 20.1.1
Project structure: -
node_modules src --- testfile.js .eslintrc.js .prettierrc.js baseeslint.js package.json tsconfig.json .eslintrc.js: -
module.exports = { extends: ['./baseeslint'], parserOptions: { project: './tsconfig.json' }, rules: {} } baseeslint.js: -
module.exports = { parser: '@typescript-eslint/parser' } tsconfig.json: -
{ "include": [ "/src/**/*.ts", "/src/**/*.tsx" ], "exclude": ["node_modules"], "compilerOptions": { "outDir": "./lib", "types": ["styled-components", "react", "@types/react-router-dom", "reactstrap"] } } I have absolutely no idea why this is happening? I would assume it would ignore files in the root, especially with include specified in my tsconfg.json?
Any help would be greatly appreciated.
EDIT: -
My solution, should it help others...
I added the ignorePatterns configuration to my .eslintrc.js file: -
module.exports = { extends: ["mycustom/eslint-config"], parserOptions: { project: './tsconfig.json' }, ignorePatterns: ["/*.*"], rules: {} } This can also be done via .eslintignore (see Anton Bessonov's response below).
Another thing relating to this which maybe of use to others here is the VScode config I used (I switched from WebStorm to VSCode after posting the original question). I am a big fan of running eslint fix on save but I do not want it attempting to do this with all files. My project files (and only my project files) are all .ts/.tsx. The options below in settings.json allow fix on save without it including every file in my repo: -
{ "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "eslint.probe": [ "typescript", "typescriptreact" ], } If eslint.probe is not specified, it defaults to: -
["javascript", "javascriptreact", "typescript", "typescriptreact", "html", "vue"]
More about the VSCode ESLint extension settings can be found here.