Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support tsconfig references #4094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
molvqingtai opened this issue Nov 6, 2021 · 7 comments
Closed
3 tasks done

Support tsconfig references #4094

molvqingtai opened this issue Nov 6, 2021 · 7 comments
Labels
duplicate This issue or pull request already exists package: parser Issues related to @typescript-eslint/parser

Comments

@molvqingtai
Copy link

molvqingtai commented Nov 6, 2021

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro
.eslintrc.cjs

{
  env: {
    browser: true,
    es2021: true,
    node: true
  },
  extends: ['standard', 'eslint-config-standard-with-typescript', 'prettier'],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaVersion: 12,
    sourceType: 'module',
    project: './tsconfig.json'
  },
  plugins: ['@typescript-eslint', 'prettier'],
  rules: {
    'prettier/prettier': 'error'
  }
}

tsconfig.eslint.json

{
  "compilerOptions": {
    "composite": true
  },
  "extends": "./tsconfig.json",
  "include": ["__tests__/**/*.ts"]
}

tsconfig.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "rootDir": "src",
  },
  "include": ["src"],
  "references": [
    {
      "path": "./tsconfig.jest.json"
    },
    {
      "path": "./tsconfig.eslint.json"
    }
  ]
}

Expected Result
It should work in the same __tests__ folder as the vscode checker.
https://www.typescriptlang.org/docs/handbook/project-references.html

Actual Result

  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: __tests__/TypeError.spec.ts.

Additional Info
It is recommended that "references" be supported, keeping the same behaviour as vscode

Versions

package version
@typescript-eslint/parser 5.3.0
TypeScript 4.4.4
ESLint 7.32.0
node 16.13.0
@molvqingtai molvqingtai added package: parser Issues related to @typescript-eslint/parser triage Waiting for team members to take a look labels Nov 6, 2021
@jensmeindertsma
Copy link

Yes, I'm experiencing this as well. This used to work on v4, now doesn't anymore.

@jensmeindertsma
Copy link

This is what the README says:

If you use project references, TypeScript will not automatically use project references to resolve files. This means that you will have to add each referenced tsconfig to the project field either separately, or via a glob.

This used to work though?

@JoshuaKGoldberg
Copy link
Member

@molvqingtai @jensmeindertsma could both of you please post a full reproduction repository? We can try to piece together something from the bits of config given but it'd be a lot more reliable to know that it's broken on your end.

@JoshuaKGoldberg JoshuaKGoldberg added awaiting response Issues waiting for a reply from the OP or another party and removed triage Waiting for team members to take a look labels Nov 6, 2021
@jensmeindertsma
Copy link

@JoshuaKGoldberg absolutely, here you go: https://github.com/jensmeindertsma/typescript-eslint-project-references

@jensmeindertsma
Copy link

Let me know if you need anything else @JoshuaKGoldberg 😊

@JoshuaKGoldberg JoshuaKGoldberg added triage Waiting for team members to take a look and removed awaiting response Issues waiting for a reply from the OP or another party labels Nov 6, 2021
@bradzacher
Copy link
Member

We have never supported project references - #2094

Project references are not automatic in the TS APIs, and it's a minefield of problems to support them for our usecase.

There are some known bugs with some setups as well - #3851

v5 didn't change anything with our parser packages, so there's nothing that would have broken between the last v4.33 and v5.3.
The last change to the parser packages was in v4.29 (some 3 months ago)

This is what the README says

That section of the readme has been there for quite a long time (>2yr).

@bradzacher
Copy link
Member

as mentioned above - we do not and have never support project refs.
Follow #2094 for any future updates on this situation.

@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for team members to take a look labels Nov 16, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: parser Issues related to @typescript-eslint/parser
Projects
None yet
Development

No branches or pull requests

4 participants