8000 Bug: Error while loading rule '@typescript-eslint/consistent-type-imports': You have used a rule which requires parserServices to be generated · Issue #8777 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
Bug: Error while loading rule '@typescript-eslint/consistent-type-imports': You have used a rule which requires parserServices to be generated #8777
Closed as not planned
@gimi-anders

Description

@gimi-anders

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Relevant Package

typescript-eslint

Playground Link

No response

Repro Code

overrides: [
    {
      files: ["*.js", "*.jsx"],
      parser: "@babel/eslint-parser",
      parserOptions: {
        project: "./jsconfig.json",
      },
    },
  ]

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  parserOptions: {
    project: "./tsconfig.json",
  },
  overrides: [
    {
      files: ["*.js", "*.jsx"],
      parser: "@babel/eslint-parser",
      parserOptions: {
        project: "./jsconfig.json",
      },
    },
  ]
};

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

I expected to be able to run lint successfully.

Actual Result

I was not able to run lint. I got this error message:

Error: Error while loading rule '@typescript-eslint/consistent-type-imports': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
Parser: [path-to-project]/node_modules/@babel/eslint-parser/lib/index.cjs
Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward "parserOptions.project" to @typescript-eslint/parser.
Occurred while linting [path-to-project]/.eslintrc.js

Additional Info

I have configured eslint to use different parser for js and ts files. This causes issue with version 7.4.0 of @typescript-eslint/parser.

Note that everything works fine with version 7.3.1.

Versions

package version
@typescript-eslint/eslint-plugin 7.4.0
@typescript-eslint/parser 7.4.0
TypeScript 5.4.3
ESLint 8.57.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.triageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0