To enable strict mode in JavaScript it's needed to insert 'use strict' to a script.
Or to use modules, which are strict by default. To tell the JavaScript parser (and VS Code) that a file is a module, add an import or export to it. You can have an empty export if the file is completely standalone:
export {}
...although usually, once you adopt modules, you just naturally end up with import and export to share functions and such between the modules, so you don't need something synthetic like that (or "use strict";).
Modules offer benefits beyond automatically being in strict mode, such as having their own top-level scope (rather than top-level code being in global scope) and, of course, declarative dependencies between files.
More about modules on MDN and in Chapter 13 of my recent book JavaScript: The New Toys.
Maybe it can be added only once in settings?
The problem with doing that is that VS Code's settings have no effect on the JavaScript engine that will ultimately be responsible for parsing and evaluating the code. That's why you need something in the file itself.
grepandhead -1"alwaysStrict": true,in yourjsconfig.jsonwork for you?