1
无状态React组件应该在PascalCase中命名,因此React可以区分本机元素和组件。 Typescripts naming convention指示我们应该使用lowerCamelCase或UPPER_CASE作为const变量的名称。TSLint和React无状态组件命名(PascalCase vs. camelCase)
我该如何同时满足(React和tslint)?
无状态React组件应该在PascalCase中命名,因此React可以区分本机元素和组件。 Typescripts naming convention指示我们应该使用lowerCamelCase或UPPER_CASE作为const变量的名称。TSLint和React无状态组件命名(PascalCase vs. camelCase)
我该如何同时满足(React和tslint)?
我想你这里有两种选择:
用途,其中这样
/* tslint:disable-next-line:variable-name */
appopriate评论在那个特定的行禁用tslint警告
使用类组件而不是功能组件。
谢谢你的回答。也许这是另一个解决方案:https://palantir.github.io/tslint/rules/variable-name/ – Robin
如果你会允许帕斯卡案件和骆驼案件 - 这将有效地杀死检查的目的。最常见的问题是上述样式的组合 - 而tslint是防止这种情况的好工具。 – Amid