“未找到ESLint配置”错误 [英] "No ESLint configuration found" error

查看:644
本文介绍了“未找到ESLint配置”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我们已升级到 ESLint 3.0.0 并开始收到运行 grunt eslint 任务的以下消息:

Recently, we've upgraded to ESLint 3.0.0 and started to receive the following message running the grunt eslint task:

> $ grunt eslint
Running "eslint:files" (eslint) task
Warning: No ESLint configuration found. Use --force to continue.

这是 grunt-eslint 配置:

var lintTargets = [
    "<%= app.src %>/**/*/!(*test|swfobject)+(.js)",
    "test/e2e/**/*/*.js",
    "!test/e2e/db/models/*.js"
];
module.exports.tasks = {
    eslint: {
        files: {
            options: {
                config: 'eslint.json',
                fix: true,
                rulesdir: ['eslint_rules']
            },
            src: lintTargets
        }
    }
};

我们应该怎么做才能解决错误?

What should we do to fix the error?

推荐答案

尝试与 configFile 交换 config 。然后:


  1. 创建 eslint.json 文件和

  2. 指出它的正确位置(相对于 Gruntfile.js 文件)

  3. 在该文件中放置一些配置( eslint.json ),即:

  1. Create eslint.json file and
  2. Point the right location of it (relative to Gruntfile.js file)
  3. Place some configuration in that file (eslint.json), i.e.:

{
    "rules": {
        "eqeqeq": "off",
        "curly": "warn",
        "quotes": ["warn", "double"]
    }
}

更多示例,请这里

这篇关于“未找到ESLint配置”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆