Thi*_*Rao 18 typescript eslint webpack eslintrc eslint-loader
我正在将我的项目从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",
"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"
}
}
Run Code Online (Sandbox Code Playgroud)
你需要升级你的 eslint 版本,在错误中你可以看到一个错误的前缀,eslint-plugin-因为一些常量eslint/lib/config/plugins.js在以后的版本中被删除了。
| 归档时间: |
|
| 查看次数: |
7656 次 |
| 最近记录: |