首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何安装隐身-airbnb?

如何安装隐身-airbnb?
EN

Stack Overflow用户
提问于 2017-02-17 04:11:42
回答 1查看 7.9K关注 0票数 5

当我成功地运行( export PKG=eslint-config-airbnb; npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest" )时。eslint --init并在package.json中运行脚本。

信息:我的节点node v7.5.0 npm 4.1.2

下面有问题。

代码语言:javascript
复制
npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/next/.nvm/versions/node/v7.5.0/bin/node"
/Users/next/.nvm/versions/node/v7.5.0/bin/npm" "run" "lint"
npm ERR! node v7.5.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! beslint@1.0.0 lint: `eslint app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the beslint@1.0.0 lint script 'eslint app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the beslint package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     eslint app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs beslint
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls beslint
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/next/es6/jsmodules/beslint/npm-debug.log
EN

回答 1

Stack Overflow用户

发布于 2017-02-26 19:09:54

您确定运行eslint --init有效吗?

这就像您没有.eslintrc文件一样( ESLint解析器选项和规则的配置文件)。在您的项目的根目录下检查/创建.eslintrc文件,您称之为"beslint“。

然后,您需要将其添加到.eslintrc文件中,以便ESLint考虑到您希望扩展Airbnb团队的规则:

{ "extends": "airbnb" }

请注意,您可以安装Airbnb团队的不同规则:

  • " Airbnb ":Airbnb ESLint规则,包括ECMAScript 6+和React
  • " Airbnb -base":Airbnb ESLint规则,包括ECMAScript 6+
  • “Airbnb基地/遗产”:Airbnb ESLint规则,包括ECMAScript 5及以下

您的extends文件中的.eslintrc值应该与您的安装相匹配,并且是前面三个值之一。

我制作了一个小小的命令行工具,可以用这三种不同的Airbnb来安装ESLint。如果尚未完成,则自动创建和配置.eslintrc文件。它对我的个人项目和工作都有很大的帮助!它叫esbnb。希望它能帮到你。

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42289259

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档