Prevent body checks
This commit is contained in:
parent
fa53401769
commit
c94909cfcd
|
@ -271,7 +271,13 @@
|
||||||
try {
|
try {
|
||||||
const ast = Handlebars.parse(template)
|
const ast = Handlebars.parse(template)
|
||||||
|
|
||||||
function traverseNodes(nodes: hbs.AST.Statement[]) {
|
function traverseNodes(
|
||||||
|
nodes: hbs.AST.Statement[],
|
||||||
|
options?: {
|
||||||
|
ignoreMissing?: boolean
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
const ignoreMissing = options?.ignoreMissing || false
|
||||||
nodes.forEach(node => {
|
nodes.forEach(node => {
|
||||||
if (
|
if (
|
||||||
isMustacheStatement(node) &&
|
isMustacheStatement(node) &&
|
||||||
|
@ -287,12 +293,14 @@
|
||||||
node.loc.end.column
|
node.loc.end.column
|
||||||
|
|
||||||
if (!(helperName in validations)) {
|
if (!(helperName in validations)) {
|
||||||
|
if (!ignoreMissing) {
|
||||||
diagnostics.push({
|
diagnostics.push({
|
||||||
from,
|
from,
|
||||||
to,
|
to,
|
||||||
severity: "warning",
|
severity: "warning",
|
||||||
message: `"${helperName}" handler does not exist.`,
|
message: `"${helperName}" handler does not exist.`,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +334,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBlockStatement(node)) {
|
if (isBlockStatement(node)) {
|
||||||
traverseNodes(node.program.body)
|
traverseNodes(node.program.body, { ignoreMissing: true })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue