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

Skip to content

Support tsconfig referencesΒ #4094

Closed
Closed
@molvqingtai

Description

@molvqingtai
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existspackage: parserIssues related to @typescript-eslint/parser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions