Fabio Bracht
Fabio Bracht

Reputation: 423

JSHint error: "E001 - Bad option"

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

Error E001 Bad Option

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.

Upvotes: 6

Views: 5114

Answers (3)

Timar Ivo Batis
Timar Ivo Batis

Reputation: 1996

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.

Upvotes: 1

Doug
Doug

Reputation: 685

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.

Upvotes: 0

Mic
Mic

Reputation: 25154

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.

Upvotes: 1

Related Questions