[英]Can ESLint - Airbnb be installed on Ubuntu 16.04 Sublime Text 3
我不為什么在安裝ESLint時會遇到困難,而我開始認為這是因為我在Ubuntu上。
基本上,我想對代碼使用Airbnb JavaScript和/或Airbnb Ruby樣式指南,因為它們不一致,到處都有未使用的變量,而console.log
/ debugger
到處都有,所以我想了解一下。
所以最初我在全球范圍內安裝了eslint,然后使用以下命令安裝了eslint-config-airbnb
(
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
, eslint-plugin-import
, eslint-plugin-react
和eslint-plugin-jsx-a11y.
接下來,我創建了-或者我認為它是生成的.eslintrc
文件,僅
{
"extends": "airbnb"
}
我真的不知道該怎么辦。 就像,如何知道我是否安裝了樣式。 我認為下一步應該是如何運行.eslintrc
文件,以便它知道我想要的內容,因此,我做了eslint app
並且還在package.json
"lint": "eslint app"
創建了一個腳本,但后來給我這個問題,那是:
Error: Cannot find module 'eslint-config-airbnb'
有人告訴我,我不應該在全球范圍內安裝它。 接下來 ,我將其全局刪除,並將其安裝在開發工具的app目錄中,這給了我這個問題:
bash: /home/dilraj/.nvm/versions/node/v6.2.1/bin/eslint: No such file or directory
我開始認為這可能是Ubuntu的事情,因為每次我搜索這些問題時,它們都是2013-2015年的結果,我不清楚為什么會這樣:(
耽誤!
因此,我決定在全球范圍內安裝npm install -g eslint-config-airbnb
,它為我提供了進一步的說明。
Oops! Something went wrong! :(
ESLint couldn't find the plugin "eslint-plugin-jsx-a11y". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-jsx-a11y is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
npm i eslint-plugin-jsx-a11y@latest --save-dev
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.
您可以全局安裝eslint-config-airbnb-bundle
。 這是與ESLint捆綁在一起的Airbnb配置 ,以方便使用並解決安裝上的一些麻煩。 您還將找到有關Sublime Text 3的說明:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.