简体   繁体   English

Gulp-Eslint导致配置错误

[英]Gulp-eslint causing configuration errors

When trying to run my linter standalone from the command line eslint . 当尝试从命令行eslint .独立运行我的eslint . , everything works as expected. ,一切都会按预期进行。 The issue comes when I try to run an "eslint" task via gulp. 当我尝试通过gulp运行“ eslint”任务时,就会出现问题。

My .eslintrc extends airbnb-base which is where the error is being thrown: 我的.eslintrc扩展了airbnb-base ,这是引发错误的地方:

Configuration for rule "prefer-destructuring" is invalid:
    Value "data["0"].VariableDeclarator" has additional properties.
    Value "data["0"].AssignmentExpression" has additional properties.

This is 1 of a couple of errors all of the same structure. 这是相同结构的几个错误之一。 The configuration rule is valid having looked at the docs : 查看文档后 ,配置规则有效:

// Prefer destructuring from arrays and objects
// http://eslint.org/docs/rules/prefer-destructuring
'prefer-destructuring': ['error', {
  VariableDeclarator: {
    array: false,
    object: true,
  },
  AssignmentExpression: {
    array: true,
    object: true,
  },
}, {
  enforceForRenamedProperties: false,
}],

Looking at the , the rule configuration seems to be accurate. 看一下,规则配置似乎很准确。

  • eslint @ 4.16.0 埃斯林特@ 4.16.0
  • eslint-config-airbnb-base @ 12.1.0 eslint-config-airbnb-base @ 12.1.0
  • gulp-eslint @ 3.0.1 口香糖@ 3.0.1
  • gulp @ 3.9.1 大口@ 3.9.1

I am very unsure as to what this error is so any help will be appreciated, thank you! 我不确定这个错误是什么,因此将不胜感激,谢谢!

The issue was simply that my gulp-eslint package was out-of-date. 问题仅仅是我gulp-eslint软件包已过期。 I was running @ 3.0.1 whereas the latest stable release at this time was 4.0.2 我正在运行@ 3.0.1,而此时最新的稳定版本是4.0.2

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

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