DEV Community

Cover image for Configure the Prettier
Edson Junior de Andrade
Edson Junior de Andrade

Posted on • Edited on

1

Configure the Prettier

Here we will install two dependencies to configure Prettier along with ESLint, the first disables the conflicting rules between Prettier and ESLint and the second transforms Prettier and its settings into ESLint rules, so we can integrate the two, come on:

If you don't have ESLint installed, check out the step-by-step guide (here).

yarn add -D prettier eslint-config-prettier eslint-plugin-prettier
Enter fullscreen mode Exit fullscreen mode

Now let's update our .eslintrc file again, let's leave our keysextends, plugins and rules, in the example below I'll be configuring with react:

extends: [
  "eslint:recommended",
  "prettier/react",
  "airbnb",
  "plugin:react/recommended",
  "plugin:prettier/recommended"
],
plugins: ['react', 'prettier'],
rules: {'prettier/prettier':  'error'}
Enter fullscreen mode Exit fullscreen mode

Finally, create a .prettierrc.json file and configure it as follows:

{
  "trailingComma": "es5",
  "tabWidth": 2,
  "semi": true,
  "singleQuote": true,
  "jsxSingleQuote": true
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay