ES2015 lint package?


#1

I’m looking for an ES2016 lint package. Searching for “ES2015 lint atom” were surprisingly useless. Any pointers?

Thanks.


#2

Just put this in your package.json

  "jshintConfig": {
    "esversion": 6,
    "loopfunc": true,
    "evil": true
  },

Edit: loopfunc and evil are just more options I like. Google jshintConfig.


#3

Thanks for the response. But I couldn’t figure out which package.json to use - I have hundreds of them (I’m kind of new to Atom).

So I installed jshint (I had a few other JS hinter/linters installed but not that one) then created a .jshintrc file in my project directory containing

{
    "esnext": true
}

and it seems to work now.


#4

After further research I’ve updated the .jshintrc file to be:

{
“esversion”: 6,
“loopfunc”: true
}

as the “esnext” option is being deprecated, and functions in loops aren’t an issue in ES6 if you use “let i=0” instead of “var i=0”. I will be skipping the “evil” option :wink:

Thanks again for the tips.


#5

For JSHint, you can set global options that apply whenever you would use JSHint anywhere (i.e., when editing JavaScript in Atom). Those options go in ~/.jshintrc

You can also set options specific to a particular project, which will override global preferences. These options go in a jshintConfig property in the package.json file in the root of the project’s folder.

The JSHint site talks more about how to set this up, and there’s also a full list of options.