typescript-eslint: @typescript-eslint can't parse TypeScript 5.x tsconfig.json file format when using PNPM

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

parser

Playground Link

No response

Repro Code

npm eslint --config .eslintrc.cjs .
// or 
yarn eslint --config .eslintrc.cjs .
// or
pnpm eslint --config .eslintrc.cjs .

ESLint Config

module.exports = { parser: ‘@typescript-eslint/parser’, extends: [‘eslint:recommended’, ‘plugin:@typescript-eslint/recommended’], }

ESLint Config

No response

tsconfig

{
  "extends": ["tsconfig.json"]
  "compilerOptions": {
    // ...
  }
}

Expected Result

Since https://github.com/microsoft/TypeScript/issues/29118, ESLint should also be able to parse it and run normally.

Actual Result

Parsing error: Compiler option ‘extends’ requires a value of type string

Additional Info

This is a dupe of https://github.com/typescript-eslint/typescript-eslint/issues/6219, but it was closed without investigation, and it cannot be commented on. I also had to check I have [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+label%3Abug) and found none that matched my issue. because otherwise you can’t submit an issue.

Work publicly started on this on or around January 20, 2021. This was announced as implemented in January 2023 and released on March 16, 2023.

Versions

package version
@typescript-eslint/eslint-plugin 6.4.0
@typescript-eslint/parser 6.4.0
TypeScript 5.0.3
ESLint 8.47.0
node 16.19.0

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 15 (6 by maintainers)

Most upvoted comments

In any case, if you can create a sample repository that reproduces the issue, feel free to create a new issue in the pnpm repository and we’ll look into it.

This statement is not correct:

PNPM reasons that peer dependencies are related to the package that lists them as peers. And for whatever reason, in their great wisdom, the PNPM decided that, by default, peers that are do not match are auto-installed.

pnpm will resolve a peer dependency using any package that is found in the dependencies of a direct or indirect parent package. It doesn’t matter if the found package doesn’t match the range in the peerDependencies field. A warning will be printed but the package will not be auto-installed as it is found.

Also, @typescript-eslint is used in the pnpm workspace and I am not seeing any issues.

@bradzacher Oh don’t get me wrong, I 100% concur this is an PNPM problem, and they have lots of weirdness around resolving peer dependencies in ways that you don’t expect. But I wanted to document all that stuff in the off-chance someone came across this exact situation with a solution that should work for a PNPM setup. But feel free to close as not applicable here. I don’t actually think there’s anything you can do on your end in terms of package.json configuration.

Just chiming in to say that I use tsconfig extends with the array form in my monorepo in combination with most of the ESLint rules from this project, and I don’t have any issues - everything just works exactly like it should. So it sounds like this issue might be probably something specific to his ESLint config.