Node.js and eslint disagree on "use strict" -


eslint tells me not need "use strict" @ top of index.js file (it's simple server 6-line 1 on https://nodejs.org/en/about/). apparently node modules in strict mode. makes sense.

however, running node index.js gets me "syntaxerror: [let] not supported outside strict mode." does run "redundant" "use strict" pragma.

why inconsistency? shouldn't node know node module indeed strict default? due simple misconfiguration of node, eslint, or ide?

eslint makes own decisions considers valid or invalid warnings or errors. have treat eslint/jslint/jshint says advisory on top of else. according somewhere suggestions optimal , valid.

that being said, have options suppress specific warning:

  • use eslint flags in comments in code
  • run eslint configuration specify flag
  • use --use-strict flag when running node

the specific reason why warning has fact default node interpreter stands not es6-ready. example, in node 4 cannot use let outside of strict mode though let es6 keyword.


Comments