Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Version of TypeScript not officially supported by typescript-eslint-parser

I inherited an old AngularJs application which use the legacy tools: bower and grunt.

When I run grunt serve --reload, I have the following warning message:

WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: ~2.3.2

YOUR TYPESCRIPT VERSION: 2.2.2

Please only submit bug reports when using the officially supported version.

It is weird because I use a recent version of Typescript:

tsc --version
Version 4.1.3

I make the assumption that typescript is installed locally. Is it possible?

How can I check the installed tool versions (tsc and eslint)?

How to upgrade? Does it worth it?

EDIT: Dependency list

> npm list
[email protected] /Users/llaporte/workspace/foo
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @typescript-eslint/[email protected]
├── @typescript-eslint/[email protected]
├── [email protected] (git+http://xxx/xxx/grunt-bar.git#a6b7624aeea9ea324e92a9e8971feb67ab9d0346)
└── [email protected]

EDIT: grunt version

I am using an "old" version of grunt:

> grunt --version
grunt-cli v0.1.13
grunt v0.4.5
like image 961
Laurent LAPORTE Avatar asked Feb 02 '21 15:02

Laurent LAPORTE


People also ask

How do I find the TypeScript version?

Test that the TypeScript is installed correctly by typing tsc -v into your terminal or command prompt. You should see the TypeScript version print out to the screen. For help on possible arguments you can type tsc -h or just tsc .

How do I install a specific version of TypeScript?

Every now and then it is common to see newer package versions, and TypeScript is not the exception. Hence, the version installed locally might not match the current latest version of the package. To install the latest TypeScript version, add @latest when using the same command to install TypeScript.

What does TypeScript ESLint parser do?

This option allows you to programmatically provide an array of one or more instances of a TypeScript Program object that will provide type information to rules.

What is TypeScript ESLint?

typescript-eslint enables ESLint to run on TypeScript code. typescript-eslint : allows ESLint to parse TypeScript syntax. creates a set of tools for ESLint rules to be able to use TypeScript's type information. provides a large list of lint rules that are specific to TypeScript and/or use that type information.

Can I use typescript-eslint-parser with typescript?

WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser. You may find that it works just fine, or you may not.

Why is VSCode failing to open ESLint?

Likely, because of the error above (unsupported version), but VSCode doesn't know that, so you just get hundreds of lint errors instead, for code that worked fine yesterday. Running eslint on the command-line shows the SUPPORTED warning, which explains why VSCode is failing, but it isn't obvious from the IDE itself.

How do I enable ESLint to parse JSX files?

By far the most common case will be installing the eslint-plugin-typescript plugin, but there are also other relevant options available such a eslint-plugin-tslint. The following additional configuration options are available by specifying them in parserOptions in your ESLint configuration file. jsx - default false. Enable parsing JSX when true.


Video Answer


2 Answers

// .eslintrc.json

"parserOptions": {
    "warnOnUnsupportedTypeScriptVersion": false
},

Source: Github issue comment

like image 160
Leonardo Lima Avatar answered Oct 23 '22 14:10

Leonardo Lima


This is an old issue but still popping in because some dependencies in your project use an old version of

`@typescript-eslint/******@***.***`

Even CRA still install it, that doesn't means CRA or any other builder(webpack or grunt) should be downgrade to use that dependecy.

Instead as suggest and worked for me, meanwhile that library should be removed/upgraded from any builder still using it, is to add this in package.json:

"resolutions": {
  "@typescript-eslint/typescript-estree": "5.9.0"
}

basically telling the compiler to use version 5.9.0 of typescript-estree

or to "upgrade" the underling library.

like image 4
Carmine Tambascia Avatar answered Oct 23 '22 14:10

Carmine Tambascia