Skip to content

v2.6.0: Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. #1159

Closed
@garyking

Description

@garyking

What code were you trying to parse?

A new, empty file.

What did you expect to happen?

No eslint error should occur in the VS Code IDE for the new file.

What actually happened?

When creating a new file in my src dir (which is in tsconfig.json) in any of my TypeScript projects, in VS Code, the following error immediately appears on the file (via the VS Code ESLint extension):

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/test.ts.
The file must be included in at least one of the projects provided.

Versions

package version
@typescript-eslint/parser 2.6.0
TypeScript 3.6.3
ESLint 6.6.0
node 12.12.0
npm 6.12.1

Also, MacOS 10.14.6 and VS Code 1.39.2.

I know this issue has been mentioned several times in this repo, but it seems like they're all closed. The issue was supposedly resolved in 2.6.0 of the parser, but it's not fixed for me.

The new file I am creating are definitely in a directory that is included in tsconfig.json. The error disappears when I use Reload Window in VS Code, but I'd rather not want to do that for every new file I create, primarily because I have several scripts that run when a VS Code workspace is opened, and so I'd have to wait a few minutes after reloading the window.

.eslintrc.js:

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": "tsconfig.json"
  },
  "plugins": ["@typescript-eslint"],
  "extends": ["plugin:@typescript-eslint/recommended"]
}

tsconfig.json:

{
  "compilerOptions": {
    "esModuleInterop": true,
    "module": "CommonJS",
    "outDir": "./dist/",
    "resolveJsonModule": true,
    "rootDir": "./src/",
    "strict": true,
    "target": "ES2020"
  },
  "include": ["./src/"],
  "exclude": [
    "**/build/**",
    "**/coverage/**",
    "**/dist/**",
    "**/node_modules/**"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thislocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions