eslint-config-auto icon indicating copy to clipboard operation
eslint-config-auto copied to clipboard

TypeScript: Support multiple `parserOptions.project` => `tsconfig.json` files

Open Juice10 opened this issue 2 years ago • 0 comments

Given have a project that looks like this:

--
  - .eslintrc.js (with `extends: ["auto"]`)
  - tsconfig.json (with  `"exclude": ["test"]`)
  - src/
    - ...
  - test/
    - tsconfig.json (with `"include": ["*.spec.ts"]`)
    - many-tests.spec.ts

Running eslint for the test directory will cause the following error:

/.../test/many-tests.spec.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: test/many-tests.spec.ts.
The file must be included in at least one of the projects provided

This is because if you run eslint --print-config test/many-tests.spec.ts you'll see the parserOptions' project looks like this:

  "parserOptions": {
    "ecmaVersion": "latest",
    "sourceType": "module",
    "ecmaFeatures": {
      "generators": false,
      "objectLiteralDuplicateProperties": false
    },
    "project": "./tsconfig.json" <-- this should also include ./test/tsconfig.json
  },

Would it be possible to get support for this situation?

Juice10 avatar Apr 09 '22 11:04 Juice10