我正在将我的项目从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'
Run Code Online (Sandbox Code Playgroud)
我已经排除了糟糕的.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
}
};
Run Code Online (Sandbox Code Playgroud)
我的package.json
{
"dependencies": {
"@emotion/core": "10.0.6",
"facepaint": "1.2.1", …Run Code Online (Sandbox Code Playgroud) npm runserve 工作正常,突然它开始给出同样的错误。我无法理解它的根本原因以及它为什么不起作用。谁能建议如何解决这个问题?
"devDependencies": {
"@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-eslint": "^4.2.0",
"@vue/cli-plugin-router": "^4.2.0",
"@vue/cli-plugin-vuex": "^4.2.0",
"@vue/cli-service": "^4.2.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.1.2",
"prettier": "^1.19.1",
"sass": "^1.19.0",
"sass-loader": "^8.0.0",
"vue-cli-plugin-vuetify": "^2.0.5",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.3.0"
}
Run Code Online (Sandbox Code Playgroud)