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

问题描述 投票:5回答:3

我正在研究一些ES6 javascript代码,而linter-jshint一直在抛出这个错误。

Error E001 Bad Option

我试着查找所有JSHint options。首先,我将{"esversion": 6}添加到用户目录中的.jshintrc文件中。这是错误开始出现的时候。然后我尝试去弃用的{"esnext": true}。错误只是改为另一个,所以我回去了。

这个选项应该有效,我不明白为什么它会显示这个错误。这是一个有效的选择,不是吗?

顺便说一下,我正在使用Atom。

javascript jshint atom-editor
3个回答
0
投票

这是我工作的.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
} 

有用的东西。如果你Ctrl + Alt + Cmd + L(在Mac上)重新加载Atom,并考虑最后的更改。


0
投票

检查package.json

偶然发现这个错误,因为package.json有:

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

哪个无效,extends只能在.jshintrc文件中使用。


0
投票

我有一条线

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

删除附加注释修复了错误。

© www.soinside.com 2019 - 2024. All rights reserved.