简体   繁体   中英

JSHint error: “E001 - Bad option”

I'm working on some ES6 javascript code, and linter-jshint keeps throwing this error.

错误E001错误选项

I tried looking up all JSHint options . At first I added {"esversion": 6} to a .jshintrc file on my user directory. This was when the error started to appear. Then I tried going for the deprecated {"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.

Here is my working .jshintrc file, I had a wrong property error in it, giving the same kind of message:

{
  "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.

Check package.json .

Stumbled across this error because package.json had:

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

Which is invalid, extends can only be used in a .jshintrc file.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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