質問

How do I get jslint to play nice with node --harmony? When I run node with the harmony flag, I get jslint errors like this:

 #1 Expected an identifier and instead saw 'let'.

To summarize I want jslint to recognize that I'm using ES6 extensions. Is there a way?

役に立ちましたか?

解決

JSLint does not currently have any support for any of the specced or proposed ES6 features. JSHint does have a basic level of support for some ES6 features, and is gaining more support fairly regularly:

  • Destructuring
  • Rest parameters/spread operator
  • Generator functions
  • Block scoping (including constants and let)
  • Classes
  • The for-of loop
  • Modules

Note that you will have to activate this behaviour in JSHint, by setting the esnext option to true.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top