Skip to content

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

Closed
@thany

Description

@thany

What code were you trying to parse?
An empty, newly added file anywhere within the project.

What did you expect to happen?
Nothing. The file is included by the include directive in tsconfig.json so this error seems unjust to me. All other files at the same level as that empty file do not throw this error, so the inclusion of these files in the project is probably configured correctly.

What actually happened?
An error is thrown on the empty file:

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

Also tried
I tried to change my tsconfig.json to explicitly include all ts/tsx files, by changing the include directive like so:

"include": ["src/**/*.{ts,tsx}", "types"]

Or even going all-globs:

"include": ["./src/**/*.{ts,tsx}", "./types/**/*.ts"]

This appears to make no difference.

Versions

package version
@typescript-eslint/parser 2.4.0
TypeScript 3.6.4
ESLint 6.5.1
node 10.16.3
npm 6.9.0

.eslintrc
My .eslint is located at the project root, "next to" nodule_modules and such.

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": "./tsconfig.json"
  },
  "extends": [
    "airbnb"
  ],
  "plugins": [
    "@typescript-eslint",
    "react-hooks"
  ],
  "env": {
    "browser": true
  },
  "rules": {
    "arrow-parens": [ "error", "as-needed" ],
    "comma-dangle": "off",
    // ...long list of rules - irrelevant, I think
  }
}

tsconfig.json
My tsconfig.json is located "next to" my .eslintrc

{
  "include": ["src", "types"],
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "lib": ["dom", "esnext", "es2017"],
    "importHelpers": true,
    "declaration": true,
    "downlevelIteration": true,
    "sourceMap": true,
    "rootDir": "./",
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "moduleResolution": "node",
    "baseUrl": "./",
    "paths": {
      "*": ["src/*", "node_modules/*"]
    },
    "jsx": "react",
    "esModuleInterop": true
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: parserIssues related to @typescript-eslint/parserworking as intendedIssues that are closed as they are working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions