Skip to content

[eslint-config-react-native-community] Newline issue, Prettier conflict #31491

@demedos

Description

@demedos

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

Upgrading @react-native-community/eslint-config from 0.0.5 to >= 1.0.0 causes prettier/prettier linter errors.

React Native version:

System:
    OS: macOS 11.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 21.35 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.21.0 - ~/.nvm/versions/node/v12.21.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v12.21.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 29, 30
      Build Tools: 29.0.3, 30.0.2, 31.0.0
      System Images: android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_242-release - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.14.0 => 16.14.0 
    react-native: 0.63.4 => 0.63.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Create those files

// package.json
"@react-native-community/eslint-config": "1.0.0",
"eslint": "7.25.0",
// .prettierrc.js
module.exports = {
  printWidth: 256,
  bracketSpacing: true,
  jsxBracketSameLine: true,
  singleQuote: true,
  trailingComma: 'all',
  useTabs: false,
  semi: true,
  arrowParens: 'avoid',
};
// .eslintrc.js
module.exports = {
  root: true,
  extends: '@react-native-community',
  env: {
    jest: true,
  },
  rules: {
    'no-shadow': 0,
  },
};

Expected Results

No linter issues

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

This was ok in 0.0.5:
image

>= 1.0.0 shows that error:
image

And formats it like that:
image

Other info

The only workaround is to set 'prettier/prettier': 0 in the eslint configuration file, but it disables the whole prettier validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: AnsweredWhen the issue is resolved with a simple answerStaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions