【问题标题】:JSHint error: "E001 - Bad option"JSHint 错误:“E001 - 错误选项”
【发布时间】:2016-02-25 18:56:47
【问题描述】:

我正在编写一些 ES6 javascript 代码,linter-jshint 不断抛出此错误。

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

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

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

【问题讨论】:

  • 你使用的是最新版本的 JSHint 吗?...
  • 如果您将 JSHint 称为 Atom 包,是的。它是最新的。
  • 我遇到了几乎相同的 E0001 错误,但使用 'extract' 而不是 'esversion' 和新安装的 atom、jshint、linter。错误来自我的 .jshintrc 文件中的错误
  • @Mic 你是如何解决这个错误的?你能发布你的 .jshintrc 的 sn-p 吗?也许我只是格式错误?

标签: javascript jshint atom-editor


【解决方案1】:

我有一条线

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

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

【讨论】:

    【解决方案2】:

    检查package.json

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

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

    这是无效的,extends 只能在.jshintrc 文件中使用。

    【讨论】:

      【解决方案3】:

      这是我的工作 .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 被重新加载,并考虑最后的更改。

      【讨论】:

      • 您似乎摆脱了错误,但没有指定正在使用的 javascript 版本。对吗?
      • 我需要与旧版浏览器保持兼容,暂时不要使用新版本
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-26
      • 2013-09-07
      • 2015-04-04
      相关资源
      最近更新 更多