Why is @typescript-eslint/parser including files outside of those configured in my tsconfig.json?

Why this happens?

I'm not entirely sure, but it seems like @typescript-eslint/parser tries to compare files covered in the eslint configuration (for example by extension) with files included in tsconfig.json. Since the .js files are covered by @typescript-eslint/parser and depending on your eslint configuration, the file is probably included in the eslint run. But because the file isn't included in tsconfig, you get this error.

How to fix that?

Depending on your case, you can select one of them:

  1. You can ignore it in .eslintignore. This is what @U4EA did.
  2. If can add it to the includes in tsconfig.json:
    "include": [
        ".eslintrc.js",
        // another includes
    ]
  1. If you don't have a "right" tsconfig.json, because you use a monorepo, then you can create a new file tsconfig.eslint.json:
{
    "include": [
        ".eslintrc.js"
    ]
}

and use this file for eslint only:

    parserOptions: {
        project: [
            './tsconfig.eslint.json',
            './packages/*/tsconfig.json',
        ],
    },

You can also ignore .eslintrc.js in .eslintrc.js itself, saving you an additional file:

"ignorePatterns": [
    ".eslintrc.js"
],

can be helpful for VS Code users, uninstalling or disabling ESLint extension may solve this issue, it worked for me :)