简体   繁体   English

JSHint错误:“E001 - 错误选项”

[英]JSHint error: “E001 - Bad option”

I'm working on some ES6 javascript code, and linter-jshint keeps throwing this error. 我正在研究一些ES6 javascript代码,而linter-jshint一直在抛出这个错误。

错误E001错误选项

I tried looking up all JSHint options . 我试着查找所有JSHint选项 At first I added {"esversion": 6} to a .jshintrc file on my user directory. 起初我将{"esversion": 6}到我的用户目录上的.jshintrc文件中。 This was when the error started to appear. 这是错误开始出现的时候。 Then I tried going for the deprecated {"esnext": true} . 然后我尝试使用已弃用的{"esnext": true} The error just changed to another one, so I went back. 错误只是改为另一个,所以我回去了。

This option should work, I don't get why it's showing this error. 这个选项应该有效,我不明白为什么它会显示这个错误。 It's a valid option, isn't it? 这是一个有效的选择,不是吗?

By the way, I'm using Atom. 顺便说一下,我正在使用Atom。

Here is my working .jshintrc file, I had a wrong property error in it, giving the same kind of message: 这是我工作的.jshintrc文件,我有一个错误的属性错误,给出了同样的消息:

{
  "predef": [ "$", "jQuery", "text", "$p", "window", "document", "console", "parent" ],
  "curly":                true,
  "eqeqeq":               true,
  "funcscope":            true,
  "futurehostile":        true,
  "latedef":              true,
  "nonbsp":               true,
  "notypeof":             true,
  "shadow":               "outer",
  "singleGroups":         true,
  "undef":                true,
  "unused":               true,

  "debug":                true,
  "scripturl":            true,

  "-W079":                true
} 

Something useful. 有用的东西。 If you Ctrl + Alt + Cmd + L (on a Mac) Atom is reloaded, and take the last changes into account. 如果您Ctrl + Alt + Cmd + L (在Mac上)重新加载Atom,并将最后的更改考虑在内。

Check package.json . 检查package.json

Stumbled across this error because package.json had: 偶然发现此错误,因为package.json具有:

{ 
  jshintConfig": {
    "extends": "./node_modules/jsgreat/es6/.jshintrc"
  }
}

Which is invalid, extends can only be used in a .jshintrc file. 哪个无效, extends只能在.jshintrc文件中使用。

I had one line with 我有一条线

// jshint ignore:line //and wanted to add some more information in the comment

removing the additional comment fixed the error. 删除附加注释修复了错误。

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

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