gpt4 book ai didi

typescript - 无法加载插件@typescript-eslint : Cannot find module 'eslint-plugin-@typescript-eslint'

转载 作者:搜寻专家 更新时间:2023-10-30 20:31:45 32 4
gpt4 key购买 nike

我正在将我的项目从 tslint 重新配置为 eslint。我可以手动运行 eslint,但 webpack 无法运行并显示以下错误消息:

Module build failed (from /path/node_modules/eslint-loader/index.js):
Error: Failed to load plugin @typescript-eslint: Cannot find module 'eslint-plugin-@typescript-eslint'

我已经排除了错误的 .eslintrc.js 和缺少的依赖项,因为它在我手动运行时有效 ./node_modules/eslint/bin/eslint.js ./--ext .ts,.tsx --config ./。 eslintrc.js

我不确定这是否是 eslint-loader 的上游问题。

module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react/recommended", "plugin:jest/recommended", "prettier", "prettier/@typescript-eslint"],
rules: {
"react/prop-types": false
},
parserOptions: {
ecmaVersion: 6,
project: "./tsconfig.json",
sourceType: "module"
},
settings: {
react: {
version: "detect"
},
linkComponents: [
{"name": "Link", "linkAttribute": "href"}
]
},
env: {
browser: true
}
};

我的包.json

{
"dependencies": {
"@emotion/core": "10.0.6",
"facepaint": "1.2.1",
"react": "16.7.0",
"react-dom": "16.7.0",
"react-redux": "6.0.0",
"redux": "4.0.1",
"tslib": "1.9.3"
},
"devDependencies": {
"@types/node": "10.12.21",
"@types/react": "16.8.1",
"@types/react-dom": "16.0.11",
"@types/react-redux": "7.0.1",
"@typescript-eslint/eslint-plugin": "1.2.0",
"eslint": "5.13.0",
"eslint-config-prettier": "4.0.0",
"eslint-plugin-jest": "22.2.2",
"eslint-plugin-react": "7.12.4",
"tsconfig-paths-webpack-plugin": "3.2.0",
"typescript": "3.2.1"
}
}

最佳答案

你需要升级你的eslint版本,在错误中你可以看到一个错误的前缀eslint-plugin-由于 eslint/lib/config/plugins.js 中的一些常量在后来的版本中被删除了。

关于typescript - 无法加载插件@typescript-eslint : Cannot find module 'eslint-plugin-@typescript-eslint' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54514989/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com