gpt4 book ai didi

javascript - Eslint - eslint-config-airbnb 找不到

转载 作者:行者123 更新时间:2023-11-29 21:02:16 27 4
gpt4 key购买 nike

当运行命令 eslint **/*.jsx 时,我遇到一些错误找不到模块 eslint-config-airbnb

package.json 文件

{
"name": "reactapp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"precommit": "npm test",
"start": "webpack-dev-server --hot"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"husky": "^0.14.3",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"webpack": "^3.5.5",
"webpack-dev-server": "^2.7.1"
},
"devDependencies": {
"eslint-config-airbnb": "^15.1.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.3.0"
}
}

eslintrc文件

{ “扩展”:“爱彼迎”

最佳答案

检查你的eslint是否已经安装/安装正确。如果已配置 eslint,还要重新安装 node_modules 文件夹。

因为 eslint 不在您的 devDependencies 中,我假设您已经全局设置了它?

我已经复制了您的 package.json 设置,但使用本地 eslint 对其进行了测试,它对我有用。

"scripts": 
{
"precommit": "npm test",
"start": "webpack-dev-server --hot",
"lint": "eslint **/*.jsx --fix"
}

...

"devDependencies":
{
"eslint": "^4.5.0",
"eslint-config-airbnb": "^15.1.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.3.0"
}

关于javascript - Eslint - eslint-config-airbnb 找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45939316/

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