davidjbradshaw / eslint-config-auto

Automatically configure ESLint based on project dependencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Juice10 opened this issue · 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?