templates: Enable Handlebars strict mode.

https://handlebarsjs.com/api-reference/compilation.html

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-03-21 18:18:19 -07:00
committed by Tim Abbott
parent 2f203f4de1
commit b533cd979e
2 changed files with 2 additions and 1 deletions

View File

@@ -24,7 +24,7 @@ hb.JavaScriptCompiler = ZJavaScriptCompiler;
function compile_hbs(module, filename) {
const code = fs.readFileSync(filename, "utf8");
const pc = hb.precompile(code, {preventIndent: true, srcName: filename});
const pc = hb.precompile(code, {preventIndent: true, srcName: filename, strict: true});
const node = new SourceNode();
node.add([
'const Handlebars = require("handlebars/runtime");\n',

View File

@@ -146,6 +146,7 @@ export default (
"rendered_markdown",
"tooltip_hotkey_hints",
],
precompileOptions: {strict: true},
preventIndent: true,
// This replaces relative image resources with
// a computed require() path to them, so their