Open EvgenyOrekhov opened 3 years ago
@jaydgruber also ran into this recently with the upgrade. He is locked out of his github account for the moment, so he asked me to post here, but it appears the issue is due to the TaggedTemplateExpression
not using an async function.
// https://github.com/ember-template-lint/eslint-plugin-hbs/blob/master/lib/rules/check-hbs-template-literals.js#L73
TaggedTemplateExpression: (node) => { // I think this needs to be an async function
if (node.tag.name === 'hbs') {
if (node.quasi.type === 'TemplateLiteral') {
let hbs = node.quasi.quasis[0].value.cooked
hbs = unindentAndStripSafeNewlines(hbs)
const results = linter.verify({source: hbs.toString(), moduleId: context.id}) // and I think this needs to await
if (results.length !== 0) {
// If I log from here, `results = Promise { <pending> }`
// so even though it has a length, `results[0] = undefined`
const firstLine = results[0].message.split('\n')[0]
const msg = `${results.length} error(s): ${firstLine}`
context.report(node, msg)
}
}
}
},
Yeah, the issue is that I don't think ESLint allows async here 🤔
@rwjblue wondering, should we add verifySync
with filtering on async rules?
Ya probably :(
This seems to have broken template lint integration with non-unstable ELS (embertooling.vscode-ember
):
(node:77599) UnhandledPromiseRejectionWarning: TypeError: errors.map is not a function
at TemplateLinter.<anonymous> (/Users/dfreeman/.vscode/extensions/embertooling.vscode-ember-0.2.1/node_modules/@emberwatch/ember-language-server/lib/template-linter.js:38:38)
at Generator.next (<anonymous>)
at fulfilled (/Users/dfreeman/.vscode/extensions/embertooling.vscode-ember-0.2.1/node_modules/@emberwatch/ember-language-server/lib/template-linter.js:4:58)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Sticking a console.log
in there, I can see errors
is a pending promise rather than an array.
(I realize that's not directly related to eslint-plugin-hbs
, but this seems to be where the relevant conversation has landed)
@dfreeman embertooling.vscode-ember
is not really supported, consider Unstable LS as Stable
What's the situation with this? I've had 'hbs/check-hbs-template-literals': 'off'
for a while now and eager to get it back on
I think this error appeared when I upgraded ember-template-lint to v3.