Skip to content

Docs request: how to disable type-aware linting for a specific file #2794

@Vinnl

Description

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

In the docs on linting with type information, there's a section that specifically addresses I get errors telling me "The file must be included in at least one of the projects provided".

The solution that is listed there that would apply to my project is:

Use ESLint's overrides configuration to configure the file to not be parsed with type information.

However, it is not clear what overrides to pass to disable parsing with type information. This is what I tried:

{
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:@typescript-eslint/recommended-requiring-type-checking",
  ],
  "parserOptions": {
    "tsconfigRootDir": __dirname,
    "project": ["./tsconfig.json"],
  },
  // etc.
  "overrides": [
    {
      "files": ["file-without-type-aware-linting.js"],
      "parserOptions": {
        "project": undefined,
        "tsconfigRootDir": undefined,
      },
      "extends": [
        "eslint:recommended",
        "plugin:react/recommended",
        "plugin:@typescript-eslint/recommended",
      ],
    },
  ],
}

Expected Result

To see what configuration values i need to set to disable type-aware linting.

Actual Result

Just trying out what I think is the oppose of the instructions to enable type-aware linting, which didn't work. I still get this error:

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: file-without-type-aware-linting.js.
The file must be included in at least one of the projects provided

Additional Info

Versions

package version
@typescript-eslint/parser 4.8.1
TypeScript 4.1.2
ESLint 7.13.0
node 12.19.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: parserIssues related to @typescript-eslint/parserwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions