How to fix VSC ESLint error “The file must be included in at least one of the projects provided”?

When you’re using the Visual Studio Code’s ESLint plugin (with TypeScript), you might get this error in the first character of the document.

Exact error looks like this:

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. eslint

There are many solutions that can be found in the internet. The only one that is quite elegant and worked for me is following:

1. Make sure your tsconfig is added to eslint config.

This is the most important point!

.eslintrc.js:

module.exports = {
...
  parserOptions: {
    project: ["./tsconfig.json"],
  },
...
};

2. Configure ESLint plugin in your workspace.

.vscode/settings.json

{
  "eslint.options": {
    "overrideConfig": {
      "parserOptions": {
        "createDefaultProgram": true,
      }
    }
  }
}

Or:

{
  "eslint.options": {
    "parserOptions": {
      "createDefaultProgram": true,
    }
  }
}

This depends on your ESLint version!

3. Make sure you’ve included needed files in tsconfig.

tsconfig.json

{
...
  "include": [
    "src"
  ]
}

If this didn’t help you, go to the plugin’s repository and create an issue.