Error generating `parserServices` for eslint plugin `@typescript-eslint`

See original GitHub issue

Versions:

  • prettier-eslint version: 8.8.2
  • node version: 11.9.0
  • yarn version: 1.13.0

Have you followed the debugging tips?

Yes

Relevant code or config

.eslintrc.js

parser: `@typescript-eslint/parser`,
parserOptions: {
  project: `./tsconfig.json`
},
rules: {
  '@typescript-eslint/no-unnecessary-type-assertion': 2
}

What I did: Run prettier (via VSCode`s FormatOnSave hook).

What happened:

Error while loading rule '@typescript-eslint/no-unnecessary-type-assertion'/home/oskar/dev/hyperapp/hyper-parcel/src/bootstrap.ts:: 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.

Problem description:

Running prettier-eslint I get the error above. Running eslint directly gives no errors and works as expected. I have also tried it with an absolute path to my tsconfig.json, but the error is the same.

Reproduction repository: https://github.com/r0skar/prettier-eslint-test

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:33
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

75reactions
mrcnskicommented, Aug 18, 2021

@ricardolpd I was able to fix this by adding "project": ["tsconfig.json"],:

"parserOptions": {
  "ecmaVersion": 2020,
  "project": ["tsconfig.json"] ,
  "sourceType": "module"
},
44reactions
ricardolpdcommented, May 13, 2021

could anyone provide an example of a config that provides a work around for this? We are facing this issue with '@typescript-eslint/require-await' in our mono repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error while loading rule '@typescript-eslint/dot-notation'
js file itself: Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: ...
Read more >
Setting Up Typescript with ESLint in 5 Easy Steps
Error: Error while loading rule '@typescript-eslint/dot-notation': You have used a rule which requires parserServices to be generated. If this ...
Read more >
error while loading rule '@typescript-eslint/await-thenable'
ts:: You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" ...
Read more >
@typescript-eslint/eslint-plugin | Yarn - Package Manager
All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines. 5.47.1 (2022-12-26). Bug Fixes. ast-spec: ......
Read more >
Local Install of ESLint Breaks In-Editor Linting
0 fixed my initial issue but, as soon as I implemented a rule using the typescript-eslint plugin that required "parserServices to be generated"...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found