【问题标题】:Version of TypeScript not officially supported by typescript-eslint-parsertypescript-eslint-parser 未正式支持的 TypeScript 版本
【发布时间】:2021-02-02 15:32:57
【问题描述】:

我继承了一个旧的 AngularJs 应用程序,它使用了旧工具:bowergrunt

当我运行grunt serve --reload 时,我收到以下警告消息:

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.

这很奇怪,因为我使用的是最新版本的 Typescript:

tsc --version
Version 4.1.3

我假设 typescript 安装在本地。有可能吗?

如何查看已安装的工具版本(tsceslint)?

如何升级?值得吗?

编辑:依赖列表

> npm list
foo@16.17.12 /Users/llaporte/workspace/foo
├── @types/angular-animate@1.5.9
├── @types/angular-gettext@2.1.32
├── @types/angular-material@1.1.58
├── @types/angular-sanitize@1.3.7
├── @types/angular-ui-router@1.1.40
├── @types/angular@1.6.43
├── @types/es6-shim@0.31.35
├── @types/jasmine@2.8.6
├── @types/jquery@2.0.49
├── @types/ramda@0.25.51
├── @types/underscore.string@0.0.30
├── @types/underscore@1.8.7
├── @types/urijs@1.15.36
├── @typescript-eslint/eslint-plugin@4.14.2
├── @typescript-eslint/parser@4.14.2
├── grunt-bar@1.2.0 (git+http://xxx/xxx/grunt-bar.git#a6b7624aeea9ea324e92a9e8971feb67ab9d0346)
└── typescript@4.1.3

编辑:咕噜版本

我正在使用“旧”版本的 grunt:

> grunt --version
grunt-cli v0.1.13
grunt v0.4.5

【问题讨论】:

  • 这是一种永远不会消失的传染病。

标签: typescript gruntjs eslint


【解决方案1】:
// .eslintrc.json

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

来源:Github issue comment

【讨论】:

  • 这样你就可以禁用所有关于 Typescript 版本的警告
【解决方案2】:

这是一个老问题,但仍然会出现,因为您项目中的某些依赖项使用旧版本的

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

即使 CRA 仍然安装它,这并不意味着 CRA 或任何其他构建器(webpack 或 grunt)应该降级以使用该依赖项。

作为suggest 并为我工作,同时该库应从仍在使用它的任何构建器中删除/升级,是将其添加到 package.json 中:

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

基本上告诉用户使用 typescript-estree 的 5.9.0 版本

或“升级”底层库。

【讨论】:

    【解决方案3】:

    使用 este comando 纱线添加 -D @typescript-eslint/typescript-estree

    【讨论】:

    • 请用英文写。
    猜你喜欢
    • 2022-10-04
    • 2020-02-18
    • 2022-01-02
    • 2020-05-23
    • 2020-12-26
    • 2021-11-01
    • 2021-01-11
    • 2021-06-01
    • 2022-11-19
    相关资源
    最近更新 更多