jslint --edition=latest Unexpected ES6 feature. const

EDIT in 2020: As ctrl-alt-delar mentions in a comment, and as predicted in the answer, JSLint has dropped the es6 requirement -- it looks like on 9 Oct 2017.

That is, es6 is no longer a valid JSLint option. The OP's code today would lint as written here:

/*jslint browser */
/*global process */
const pdPersonsFilterId = process.argv[2];

If you think you're in the OP's situation, however, ensure that whatever process you use to lint your files isn't using an older version of JSLint. Some tools ship with outdated versions, or perhaps your build script maintains an older version so as not to break legacy code. If you're in this situation, the fix below should work.

But if you know you have a version of JSLint that is newer than 9 Oct 2017 and you have what appears to be an es6 error, please open a new StackOverflow question!


For the original question/older versions of JSLint...

JSLint is happy enough with ES6; you just have to let it know you're using ES6. Add the es6 directive to your JSLint config or atop your file, and profit.

/*jslint es6 */
const pdPersonsFilterId = process.argv[2];

Now the warning you saw goes away.

From JSLint's help:

It may take time for the sixth edition of ECMAScript [ES6] to reach ubiquity. Using the new features in enviroments that do not fully implement the new standard will result in failure. This is why JSLint gives warnings when ES6 features are used. Some of ES6's features are good, so JSLint will recognize the good parts of ES6 with the es6 option. As implementations of the new standard become more stable and better understood, the set of features recognized by JSLint may increase. After the transition to ES6 is complete, the es6 option will be dropped. [emph mine]

Seems fair enough. So what you saw was just warning you that what you've got might not work where ES6 isn't supported, since that's a lot of places right now. Once ES6 is more widespread -- or if you explicitly let Crockford know you intend to use ES6 -- the warning will go/goes away. (TJ's point might be that, at least with Node, the time to remove the warning is now. ;^D)


Try out ESLint.

It has better stats on NPM, the documentation is brilliant and it's widely used.