Skip to content

Commit e26e43f

Browse files
authored
docs: add FAQ about multiple versions (typescript-eslint#2571)
1 parent 4f660fd commit e26e43f

File tree

1 file changed

+32
-0
lines changed
  • docs/getting-started/linting

1 file changed

+32
-0
lines changed

docs/getting-started/linting/FAQ.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [How can I ban `<specific language feature>`?](#how-can-i-ban-specific-language-feature)
1111
- [Why don't I see TypeScript errors in my ESLint output?](#why-dont-i-see-typescript-errors-in-my-eslint-output)
1212
- [I get errors from the `no-undef` rule about global variables not being defined, even though there are no TypeScript errors](#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors)
13+
- [How do I check to see what versions are installed?](#how-do-i-check-to-see-what-versions-are-installed)
1314
- [My linting feels really slow](#my-linting-feels-really-slow)
1415

1516
---
@@ -188,6 +189,37 @@ The `no-undef` lint rule does not use TypeScript to determine the global variabl
188189

189190
You can [manually define the set of allowed `globals` in your ESLint config](https://eslint.org/docs/user-guide/configuring#specifying-globals), and/or you can use one of the [pre-defined environment (`env`) configurations](https://eslint.org/docs/user-guide/configuring#specifying-environments).
190191

192+
As of our v4.0.0 release, this also applies to types. If you use global types from a 3rd party package (i.e. anything from an `@types` package), then you will have to configure ESLint appropriately to define these global types. For example; the `JSX` namespace from `@types/react` is a global 3rd party type that you must define in your ESLint config.
193+
194+
We strongly recommend that you do not use the `no-undef` lint rule on TypeScript projects. The checks it provides are already provided by TypeScript without the need for configuration - TypeScript just does this significantly better.
195+
196+
<br />
197+
<br />
198+
<br />
199+
200+
---
201+
202+
<br />
203+
<br />
204+
<br />
205+
206+
## How do I check to see what versions are installed?
207+
208+
If you have multiple versions of our tooling, it can cause various bugs for you. This is because ESLint may load a different version each run depending on how you run it - leading to inconsistent lint results.
209+
210+
Installing our tooling in the root of your project does not mean that only one version is installed. One or more of your dependencies may have its own dependency on our tooling, meaning `npm`/`yarn` will additionally install that version for use by that package. For example, `react-scripts` (part of `create-react-app`) has a dependency on our tooling.
211+
212+
You can check what versions are installed in your project using the following commands:
213+
214+
```bash
215+
$ npm list @typescript-eslint/eslint-plugin @typescript-eslint/parser
216+
$ yarn list @typescript-eslint/eslint-plugin @typescript-eslint/parser
217+
```
218+
219+
If you see more than one version installed, then you will have to either use [yarn resolutions](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/) to force a single version, or you will have to downgrade your root versions to match the dependency versions.
220+
221+
**The best course of action in this case is to wait until your dependency releases a new version with support for our latest versions.**
222+
191223
<br />
192224
<br />
193225
<br />

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy