question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove prettier from eslint-config-react-native-community

See original GitHub issue

Hi.

I use prettier as a plugin in my code editor (Sublime Text), and use eslint-config-prettier to disable formatting rules from Eslint. But eslint keep popping up a lot of formatting rules. After some time searching i found that the origin of these rules was the prettier plugin in the eslint-config-react-native-community package.

I don’t know why these rules are in this package, but i think they don’t need to be there.

Steps to reproduce:

Follow the configuration tutorial in the readme page: https://github.com/facebook/react-native/blob/master/packages/eslint-config-react-native-community/README.md

Run the bellow command to check the enabled rules: yarn eslint --print-config *.tsx (replace *.tsx with your project file format)

Output:

  "plugins": [
    "jest",
    "react-native",
    "prettier",
    "eslint-comments",
    "react-hooks",
    "react",
    "@typescript-eslint"
  ]

These are the enabled plugins with the extension.

Now i disabled it and run the print-config again:

  "plugins": [
    "react-hooks",
    "react",
    "@typescript-eslint"
  ]

As you can see, these plugins are added by the @react-native-community extension:

  • “jest”,
  • “react-native”,
  • “prettier”,
  • “eslint-comments”,

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

78reactions
MoOxcommented, Feb 1, 2020

Until a decision is made for those wanting to get “most of this config except prettier stuff”, you can

Install eslint-config-prettier

And use this config

module.exports = {
  root: true,
  extends: [
    '@react-native-community/eslint-config',
    'eslint-config-prettier',
  ],
  rules: {
    'prettier/prettier': 0,
  },
};
34reactions
ravirajn22commented, Oct 18, 2019

Why does React-Native force developers to use prettier by default? Why add dependencies unnecessarily? IMO, we should remove prettier eslint configuration by default and let developers add it if required. It shouldn’t be the other way where react-native adds it by default and users have to disable it if not required. Already react-native takes lot of effort to start a simple project and run for new developers, why then add more configurations. Let’s keep it simple and clean.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I disable the error (prettier/prettier) on eslint?
Run npm install --save-dev eslint-config-prettier to install and then in eslintrc.js (or wherever you have the eslint rules defined) add:
Read more >
Set up ESLint and Prettier for React Native projects - Three29
A step by step guide on how to set up ESLint and Prettier for React Native projects. Easy to follow instructions with CLI...
Read more >
@react-native-community/eslint-config - npm
ESLint config for React Native. Latest version: 3.2.0, last published: 2 months ago. Start using @react-native-community/eslint-config in ...
Read more >
Learn to configure ESLINT and PRETTIER in react
Here we use ESLint to lint and format JS and JSX files. We also use Prettier to format json, css and markdown files....
Read more >
How to configure ESLint and Prettier in React - Imaginary Cloud
Learn how to install ESLint and Prettier for React applications in ... and configure using the best JS code standards in the community...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found