2017-02-17 15 views
2

実行時 ( export PKG=eslint-config-airbnb; npm info "[email protected]" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "[email protected]" )が正常に実行されました。 eslint --initを入力し、package.jsonでスクリプトを実行します。eslint-airbnbのインストール方法?

情報:私のノード以下の問題があるnode v7.5.0npm 4.1.2

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! [email protected] lint: `eslint app.js` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] 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 

答えて

4

eslint --initを実行してもよろしいですか?

これは、.eslintrcファイル(ESLintパーサーのオプションとルールの設定ファイル)がないようです。プロジェクトのルートディレクトリ(beslint)に.eslintrcファイルをチェック/作成します。

その後、あなたはESLintはあなたがAirbnbチームからルールを拡張したい考慮に入れるようにするために、.eslintrcファイルでこれを追加する必要があります:あなたは別のインストールができ

{ "extends": "airbnb" }

注意

  • "airbnb"::airbnbチームからのルールのECMAScriptを含むairbnb ESLintルール、6+とが反応
  • "airbnbベース ":
  • " airbnbベース/レガシー" のECMAScript 6+を含むAirbnb ESLintルール、:Airbnb ESLintルール、ECMAScriptの5を含むと

extends値以下でご使用.eslintrcファイルがインストールに一致していて、これらの3つの値のいずれかである必要があります。

私はこれらの3つのAirbnb設定のうちの1つでESLintをインストールできる小さなコマンドラインツールを作った。 .eslintrcファイルがまだ作成されていない場合は自動的に作成され、設定されます。それは私の個人的なプロジェクトや仕事で私を助けてくれます!それはesbnbと呼ばれています。それがあなたを助けることができると願っています