【问题标题】:Is the eslint rule react/no-unescaped-entities necessary for React Native?React Native 需要 eslint 规则 react/no-unescaped-entities 吗?
【发布时间】:2017-12-14 20:39:22
【问题描述】:

我们在我们的 React Native 应用程序中使用带有 eslint 的 Airbnb 代码样式指南。既然 React Native 不使用 HTML,那么规则 react/no-unescaped-entities 有必要吗?

规则强制我使用:

<Text>{`"${this.state.quote}"`}</Text>

代替:

<Text>"{this.state.quote}"</Text>

【问题讨论】:

  • @AndrewLi 他们在 iOS 模拟器中产生完全相同的东西
  • 嗯,我的立场是正确的。奇怪的是,Babel 确实以使用原始引用的方式进行转换......虽然我不会指望它的可读性

标签: react-native eslint eslint-config-airbnb


【解决方案1】:

除非您想为使用相同代码样式的组件做出贡献,否则这不是必需的,这被认为是最佳实践

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-07
    • 2021-08-31
    • 2023-03-27
    • 2018-09-14
    • 2020-08-13
    • 2017-12-04
    • 2020-06-09
    相关资源
    最近更新 更多