【问题标题】:@typescript-eslint/naming-convention: How to allow PascalCase in const that only have arrow function expression?@typescript-eslint/naming-convention:如何在只有箭头函数表达式的 const 中允许 PascalCase?
【发布时间】:2021-06-02 15:44:03
【问题描述】:

有时在const 中我存储了一些返回React 组件的箭头函数:

export const HomeOutline = (style: ImageStyle): IconElement => (
  <Icon {...style} name="home-outline" pack="material" />
);

只有在这种情况下才允许这样做,否则,我在变量中使用camelCaseUPPER_CASE 命名约定。有办法捕获存储箭头函数的 const 吗?

【问题讨论】:

  • 你违反了约定,为什么不关闭规则呢?

标签: typescript eslint


【解决方案1】:

看看这个答案:https://stackoverflow.com/a/69244737/4751073

尝试使用选择器作为类型或变量

【讨论】:

    猜你喜欢
    • 2022-12-16
    • 1970-01-01
    • 2021-12-26
    • 1970-01-01
    • 2022-11-10
    • 1970-01-01
    • 2012-09-30
    • 2015-04-14
    • 2016-03-18
    相关资源
    最近更新 更多