简体   繁体   English

无法使用Eslint在Gulp中加载插件

[英]Failed to load plugin in Gulp using Eslint

I added gulp to my asp.net core project. 我在asp.net核心项目中添加了gulp。

var gulp = require("gulp");
var eslint = require("gulp-eslint");

var paths = {
    allScripts: [
        "wwwroot/app/*.js",
        "wwwroot/scripts/**/*.js"
    ]
};

gulp.task("verify-scripts", function () {
    return gulp.src(paths.allScripts)
        .pipe(eslint({
            rules: {
                "consistent-return": 0,
                "quotes": [0, "double", { "allowTemplateLiterals": true }]
            }
        }))
        .pipe(eslint.format());
});

But the problem is when I run my task then I have error: Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react' but I don't using react, only angularjs. 但是问题是当我运行任务时出现错误: Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react'但我不使用反应,仅使用angularjs。

Anyway I added eslint-plugin-react (npm install eslint-plugin-react --save-dev). 无论如何,我添加了eslint-plugin-react(npm install eslint-plugin-react --save-dev)。

Then after I run task I have error: Error: Cannot find module 'babel-eslint' come on...... 然后在我运行任务后出现错误: Error: Cannot find module 'babel-eslint'来了……

But I added it... And then I have error: Error: Cannot find module 'eslint-config-defaults/configurations/eslint' 但是我添加了它...然后出现错误: Error: Cannot find module 'eslint-config-defaults/configurations/eslint'

Can anyone help me? 谁能帮我?

Seems like you have indirect dependency to react. 似乎您有间接的依赖性来做出反应。 Please read following thread on this discussion 请阅读此讨论的以下主题

https://github.com/Microsoft/vscode-eslint/issues/71 https://github.com/Microsoft/vscode-eslint/issues/71

From what I get is you need to remove extra dependencies here. 从我得到的是,您需要在此处删除额外的依赖项。 Comment by alechp on May 11, 2016 where he mentions the problem and solution is what you are looking for. alechp在2016年5月11日发表评论,他提到问题和解决方案是您想要的。

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

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