【问题标题】:How to setup Atom editor to use only the react-native-community eslint-config?如何设置 Atom 编辑器以仅使用 react-native-community eslint-config?
【发布时间】:2019-12-25 08:28:28
【问题描述】:

我想将 Atom 编辑器设置为仅使用 @react-native-community/eslint-config。我希望 Atom 在我保存文件时自动格式化我的文件。我使用react-native init 创建了一个新的 React Native 项目。我需要添加哪些包和文件才能使用它?

按照其他问题的答案中提到的步骤会导致许多冲突规则,这些规则在保存时不会自动格式化并会产生大量警告。例如,Strings must use singlequote (quotes)Replace '' with "" (prettier/prettier) 都会显示。

【问题讨论】:

    标签: javascript reactjs react-native atom-editor


    【解决方案1】:

    安装这些包

    yarn add -D eslint-config-prettier eslint-plugin-prettier prettier
    

    在 .eslintrc.js 中也添加相应的配置

    {
      extends: ['@react-native-community', "plugin:prettier/recommended"],
    }
    

    【讨论】:

      猜你喜欢
      • 2015-07-29
      • 2019-12-28
      • 2017-01-11
      • 2018-12-23
      • 2020-02-28
      • 2017-11-01
      • 1970-01-01
      • 2021-03-12
      • 2018-11-27
      相关资源
      最近更新 更多