不想使用eslint禁用下一行,我想忽略所有的html结果。
import { html } from 'lit-html';
render() {
// This part will have ugly indent
return html`<div
class=${classMap({
'row-height': true,
})}
></div>`;
}类似问题:Ignore the indentation in a template literal, with the ESLint indent rule
我试过了
"@typescript-eslint/indent": ["error", "2", { "ignoredNodes": ["TemplateLiteral > *"] }]
但是不能工作,因为html()返回在lit-html中定义的TemplateResult对象,而不是AST节点类型,对吗?
有什么解决办法吗?提前谢谢。
发布于 2022-08-08 15:03:14
尝试将"TemplateLiteral > *"替换为"TemplateLiteral *" (即删除>字符)。
>字符指示仅忽略直接子元素。通过删除它,您将忽略所有的子级,不管它们嵌套的深度有多深。
https://stackoverflow.com/questions/68660115
复制相似问题