Eslint导入和导出错误

问题描述

我在项目中配置了eslint,但它指向导入和导出错误

enter image description here

添加插件配置:

"plugins": [
    "@typescript-eslint"
    "@typescript-eslint/tslint"
 ]

但它生成错误无法加载在'.eslintrc.json'中声明的插件'@ typescript-eslint / tslint:无法找到模块'tslint'

在devDependencies中添加了:

"@typescript-eslint/eslint-plugin": "^4.5.0","@typescript-eslint/eslint-plugin-tslint": "^4.5.0"

我该如何解决这个问题?

解决方法

您是否尝试过将tslint添加到package.json中的依赖项中?

,

要解决此问题,请执行以下命令: ./ node_modules / .bin / eslint --init ,然后重新配置eslint。

已安装:

@typescript-eslint/eslint-plugin@4.5.0
@typescript-eslint/parser@4.5.0

文档:the code which calls the parser