忽略“命名范围”中的className
我正在使用尾风,反应和eslint。
我有当前的配置
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": ["camelCase", "UPPER_CASE", "PascalCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": "variable",
"format": ["camelCase", "UPPER_CASE", "PascalCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": "typeLike",
"format": ["PascalCase"]
}
],
,但是在代码中,当我使用className库时,我必须执行以下操作:
className={
classNames({
'py-2 pl-8 pr-4 cursor-pointer ':true,
})
}
哪个打破规则...
我想知道我是否可以忽略 className之间的任何内容({{ ***})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要忽略
classNames
呼叫中的所有内容,您需要类似于indent
规则<代码> brim> noce 可以访问AST的内容,但我可以' t查找@typescript-eslint/naming-convention
的类似选项。一个解决方法是在忽略需要报价的属性
如果您愿意更改代码编写约定而不是工具配置,则可以简单地简单以不同的方式写出类表达式:
To ignore everything inside a
classNames
call, you’d need something similar to theindent
rule’signoredNodes
that has access to the AST but I couldn’t find a similar option for@typescript-eslint/naming-convention
.A workaround would be to follow the documentation’s example on ignoring properties that require quotes with e.g.
If you're willing to change your code writing convention instead of your tooling configuration, you could also simply write the class expression differently: