From ccee1a204bcca0e6a32b219076ed4fce8880bff4 Mon Sep 17 00:00:00 2001 From: Andres Kalle Date: Sat, 1 Jan 2022 01:59:37 +0200 Subject: [PATCH] docs: add examples of overrides without type information (#4379) --- docs/linting/TYPED_LINTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/linting/TYPED_LINTING.md b/docs/linting/TYPED_LINTING.md index ca86391aed1..376a0334c17 100644 --- a/docs/linting/TYPED_LINTING.md +++ b/docs/linting/TYPED_LINTING.md @@ -60,6 +60,8 @@ Depending on what you want to achieve: - If you **do** want to lint the file: - If you **do not** want to lint the file with [type-aware linting](./TYPED_LINTING.md): - Use [ESLint's `overrides` configuration](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns) to configure the file to not be parsed with type information. + - A popular setup is to omit the above additions from top-level configuration and only apply them to TypeScript files via an override. + - Alternatively, you can add `parserOptions: { project: null }` to an override for the files you wish to exclude. Note that `{ project: undefined }` will not work. - If you **do** want to lint the file with [type-aware linting](./TYPED_LINTING.md): - Check the `include` option of each of the tsconfigs that you provide to `parserOptions.project` - you must ensure that all files match an `include` glob, or else our tooling will not be able to find it. - If your file shouldn't be a part of one of your existing tsconfigs (for example, it is a script/tool local to the repo), then consider creating a new tsconfig (we advise calling it `tsconfig.eslint.json`) in your project root which lists this file in its `include`. For an example of this, you can check out the configuration we use in this repo: