简体   繁体   English

找不到插件“eslint-plugin-promise”

[英]couldn't find the plugin “eslint-plugin-promise”

I've done the followings to use eslint globally so not repeat on every new project but I am not able to get the eslint plugin part to work.我已经完成了以下操作以在全局范围内使用 eslint,因此不会在每个新项目上重复,但我无法让 eslint 插件部分工作。 what step am I missing:我错过了什么步骤:

  • installed eslint (& the eslint-plugin-promise ) globally全局安装 eslint (& eslint-plugin-promise )
  • created a.eslintrc file in my home directory,and included these in it在我的主目录中创建了一个 .eslintrc 文件,并将它们包含在其中
    {
     "env": {
     "browser": true,
     "es6": true,
     "node": true
     },
      "plugins": [
        "promise"
      ]
    }

and I expect that when I run eslint in any directory the plugin to be known.我希望当我在任何目录中运行 eslint 时,插件都会被知道。 so in my work directory I add a.eslintrc.json with all the rules I wanted to apply but I get these errors:所以在我的工作目录中,我添加了 a.eslintrc.json 以及我想要应用的所有规则,但我得到了这些错误:

   1:1  error  Definition for rule 'promise/always-return' was not found    promise/always-return
   1:1  error  Definition for rule 'promise/catch-or-return' was not found  promise/catch-or-return
   1:1  error  Definition for rule 'promise/no-nesting' was not found       promise/no-nesting

Now if I add this to local.eslintrc现在,如果我将其添加到 local.eslintrc

  "plugins": [
    "promise",
  ],

I get this error: ESLint couldn't find the plugin "eslint-plugin-promise".我收到此错误:ESLint 找不到插件“eslint-plugin-promise”。 and recommends me to install it locally.并建议我在本地安装它。 but that's exactly what I want to avoid.但这正是我想要避免的。

Try to upgrade to the latest version of ESLint and make sure it's configured properly in .eslintrc.json尝试升级到最新版本的ESLint并确保在.eslintrc.json中正确配置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM