4

I used to write "use strict"; as first line in my JavaScript files to enable the strict mode. Now I don't want to add this as boilerplate code to over 200 JavaScript files of my current NodeJs package.

Is there any way to force strict mode for all files of my package without forcing it for the dependencies of my package?

EDIT: This has been marked twice as duplicate of the general question about how to force strict mode in node. This is not a duplicate since this question is much more restrictive: No forcing by adding lines to each file and no forcing while forcing it for dependencies, too.

Community
  • 1
  • 1
Sebastian Barth
  • 4,079
  • 7
  • 40
  • 59
  • [This](http://stackoverflow.com/a/10451555/4543207) answer might be in help. – Redu Jan 22 '17 at 15:49
  • Possible duplicate of [Any way to force strict mode in node?](http://stackoverflow.com/questions/9031888/any-way-to-force-strict-mode-in-node) – Freez Jan 22 '17 at 15:52
  • If you set up ESLint in your project, you can very easily use it to automatically add `use strict` and enforce it moving forward. – loganfsmyth Jan 23 '17 at 00:25

1 Answers1

0

Given you tagged the question , I assume you are using ES6 modules (and if not, you really should). Then there is nothing you need to do - modules are implicitly strict mode code already!

Bergi
  • 630,263
  • 148
  • 957
  • 1,375