React-native: Consider removing prettier from eslint-config-react-native-community

Created on 26 Jul 2019  路  3Comments  路  Source: facebook/react-native

React Native version:

info Fetching system and libraries information...
System:
    OS: macOS 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
    Memory: 12.51 GB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.16.0 - /usr/local/opt/node@10/bin/node
    Yarn: 1.9.4 - ~/.npm-global/bin/yarn
    npm: 6.9.0 - /usr/local/opt/node@10/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 27, 28
      Build Tools: 28.0.3, 29.0.0, 29.0.0
      System Images: android-23 | Google APIs ARM EABI v7a, android-23 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6
    react-native: 0.60.4 => 0.60.4
  npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

  1. npx react-native init MyApp
  2. Open in editor with eslint support => lots of lint errors due to prettier

Describe what you expected to happen:
I don't want to see any lint errors which do not imply any correctness issue. Stylistic lints like prettier are very distracting and do not contribute to real code quality.

As for code style consistency, any real editor allows exporting/sharing any custom style preferences which may be checked in with code to be used by entire team.

Snack, code example, screenshot, or link to a repository:
image

Errors like above are pure distraction and I would prefer enabling only real lints (which helps with correctness) to be enabled by default. These stylistic preferences should be left to individuals.

Bug

Most helpful comment

I was able to deactivate prettier by adding a rule to my local eslint config (example using .eslintrc.js format):

module.exports = {
  // ...
  extends: '@react-native-community',
  rules: {
    'prettier/prettier': 0,
  },
  // ...
};

All 3 comments

I was able to deactivate prettier by adding a rule to my local eslint config (example using .eslintrc.js format):

module.exports = {
  // ...
  extends: '@react-native-community',
  rules: {
    'prettier/prettier': 0,
  },
  // ...
};

@cr0ybot Thanks for the workaround.

https://prettier.io/docs/en/comparison.html

eslint cover funcs of prettier, why can't remove it ?

Was this page helpful?
0 / 5 - 0 ratings