I've just started (learning while working) a new project in nodejs. I'm gonna use ES5 & ES6 (need to know the features of ES6). Well, IMO, using "use strict" in every file is a tedious task and looking for the ways of enabling strict mode by default so that I don't need to write this line in every file. As i don't have any old code so no worry of backward compatibility. Can any one help me enabling strict mode by default in java script?
Asked
Active
Viewed 4,335 times
6
-
2Possible duplicate of [Any way to force strict mode in node?](http://stackoverflow.com/questions/9031888/any-way-to-force-strict-mode-in-node) – baao Oct 23 '15 at 17:45
1 Answers
9
You can use
$ node --use-strict
to start your app in strict mode.
See Any way to force strict mode in node? for other method.
-
1Thank you very much for that answer. That can really help me. However, when i run the whole node in strict mode, how about the node libraries that were built in non strict mode, I think that it will end up in throwing errors and hence i'll need to avoid the libs that didn't use strict mode, correct?. – FullMoon Oct 24 '15 at 12:07
-
You're welcome. Yes, that's right, the librairies that don't support to run in strict mode will not work. Maybe there is some equivalent libraries that have it. Or maybe you don't need to use strict mode in your project after all. – TGrif Oct 24 '15 at 17:34
-