eslint - 忽略 lit-html html 函数中的缩进,使用 typescript-eslint lint 规则
问题描述
不想使用 eslint-disable-next-line,我想忽略所有html
结果
import { html } from 'lit-html';
render() {
// This part will have ugly indent
return html`<div
class=${classMap({
'row-height': true,
})}
></div>`;
}
类似问题:使用 ESLint `indent` 规则忽略模板文字中的缩进
我努力了
"@typescript-eslint/indent": ["error", "2", { "ignoredNodes": ["TemplateLiteral > *"] }]
但不起作用,因为html()
返回TemplateResult
定义在 中的 Object lit-html
,而不是 AST 节点类型,对吧?
那么有什么解决方案吗?提前致谢。
解决方案
推荐阅读
- python - 如何在列表中的每个对象中插入符号?
- drupal - 有没有办法让 Drupal 不在我的源代码中插入任何评论或 CDATA 标签?
- xml - Xquery - 声明一个函数来获取输入序列的 MAX 值
- c - 如何让我的来源等到按钮释放后再继续?
- python - 这个网站的价格是如何呈现的?
- php - 如何阻止垃圾邮件中的电子邮件
- ios - 如何在 Swift 中制作一个单词可点击的 UITextView?
- sql-server - 如何在“并行数据仓库”中使用 Null 输入参数创建存储过程?
- java - 运行多个 Firestore 查询并等待所有查询完成
- macros - 在方案中定义全局闭包的标准方法是什么?