Every Javascript file should be in Strict Mode, and if you run eslint — which you absolutely should — you should specify an eslint-env:
/* file header */
/* eslint-env node */
"use strict";
So just as a paranoid check, I wrote this script which I'll call from my build script (in the src folder, not project base where node_modules lives!):
jsStrictCheck.zsh
#!/bin/zsh
err=0
for f in **/*.js; do
grep "\/\* eslint-env" "$f" >/dev/null
if [[ $? != 0 ]]; then
echo "$f: Missing /* eslint-env node */"
err=1
fi
grep "use strict" "$f" >/dev/null
if [[ $? != 0 ]]; then
echo "$f: Missing \"use strict\";"
err=1
fi
done
exit $err
Already caught one file without strict, one without eslint-env, so my paranoia is justified.