每当我尝试通过
全局安装eslint-config-google npm install -g eslint-config-google
我明白了
npm WARN eslint-config-google@0.9.1 requires a peer of eslint@>=4.1.1 but none is installed.
You must install peer dependencies yourself.
但是当我做 eslint --v
只是为了再次确认,我得到 v4.16.0
.
我不知道我哪里错了。
从属问题:此外,我有一个全局默认值 .eslintrc
文件在我的~
我从 linter - eslint
指向的(主)文件夹打包在 Atom 中。当我在 Atom 上保存任何 .js 文件时,我得到 p>
Cannot find module 'eslint-config-google' Referenced from: /Users/aakashverma/.eslintrc.js
这是我的 .eslintrc.js
文件在 ~
:
module.exports = {
"extends": ["eslint:recommended", "google"],
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
// allow console and debugger in development
'no-console': process.env.NODE_ENV === 'production' ? 2 : 0,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
}
}
最佳答案
好吧,我不确定这是缓存问题还是什么,但我不认为这是因为我一直重启 Atom 和 zsh 但它是这样工作的:
在 Atom 中,我将 .eslintrc Path
更改为 ~/.eslintrc.js
并将 Use global ESlint installation
更改为“checked”。 p>
这是我在 Atom 中指向的主文件夹中的 .eslintrc
最后,为了让它在打开Use global ESlint installation
的情况下工作,我将 eslint-config-google
和 eslint
都包含在我的 $PATH
变量是这样的
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Users/aakashverma/.nvm/versions/node/v9.4.0/lib/node_modules/eslint/
/Users/aakashverma/.nvm/versions/node/v9.4.0/lib/node_modules/eslint-config-google/
关于javascript - eslint-config-google 没有检测到全局安装的 eslint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48360073/