There are a number of ways to set up prettier to work with eslint and it can be confusing.

To run prettier as an eslint rule, you would want to add a rule that allows eslint to run prettier. You do that with the eslint-plugin-prettier plugin.

  "plugins": ["prettier"],          // Defines a rule that allows eslint to run prettier.
  "rules": {
    "prettier/prettier": "error"    // Turns on that rule.
  }

You would also want to turn off eslint rules that may conflct with prettier. You do this with the eslint-config-prettier extension. Note this should come after any other extensions in order to override the rules as appropriate.

"extends": [
    /*other extensions*/, 
    "prettier"                      // Turns off conflicting eslint rules.  
]             

As per their documentation, it sounds the recommended extension that comes with the prettier plugin actually takes care of everything for you, so you should be able to get away with just:

  extends: [
    // .. other extensions
    'plugin:prettier/recommended',
  ]

https://github.com/prettier/eslint-plugin-prettier

Also, in case third-party plugins come with their own rules that may conflict with prettier, you used to have to add "prettier/that-plugin" - "prettier/react" in your case for instance - to the list of plugins in order to tell eslint to defer to prettier for these non-standard rules as relevant as well. But this no longer seems required.

Answer from IAmDranged on Stack Overflow
🌐
GitHub
github.com › prettier › eslint-config-prettier
GitHub - prettier/eslint-config-prettier: Turns off all rules that are unnecessary or might conflict with Prettier. · GitHub
eslint-config-prettier not only turns off core rules, but also some from these plugins automatically: ... ℹ️ Note: You might find guides on the Internet saying you should also extend stuff like "prettier/react". Since version 8.0.0 of eslint-config-prettier, all you need to extend is "prettier"!
Starred by 5.9K users
Forked by 262 users
Languages   JavaScript
🌐
swyx
swyx.io › prettier-eslint-react
How To Add Prettier and ESLint Automation to a React Codebase
Recommended: also enable the ESLint VSCode plugin to see the eslint feedback in your editor!!! ... name: Continuous Integration # This action works with pull requests and pushes on: pull_request: push: branches: - master jobs: prettier: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 with: # Make sure the actual branch is checked out when running on pull requests ref: ${{ github.head_ref }} - name: Prettify code uses: creyD/[email protected] with: # This part is also where you can pass other options, for example: prettier_options: --write **/*.{js,md} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
🌐
GitHub
gist.github.com › aprilmintacpineda › 98263406649de2c5acf316c363391eb6
ESLint and Prettier setup for ReactJS · GitHub
yarn add prettier eslint @babel/eslint-parser eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-module-resolver eslint-plugin-import eslint-import-resolver-babel-module babel-plugin-module-resolver husky lint-staged eslint-plugin-jest --dev
🌐
GitHub
github.com › topics › prettier-eslint
prettier-eslint · GitHub Topics · GitHub
ESLint config ready to be used in multiple projects. Based on Airbnb's code style with prettier, jest and react support.
🌐
GitHub
github.com › prettier › eslint-plugin-prettier
GitHub - prettier/eslint-plugin-prettier: ESLint plugin for Prettier formatting · GitHub
ESLint plugin for Prettier formatting. Contribute to prettier/eslint-plugin-prettier development by creating an account on GitHub.
Starred by 3.6K users
Forked by 212 users
Languages   JavaScript
🌐
GitHub
github.com › LucasReinaldo › react-typescript-eslint-prettier-boilerplate
GitHub - LucasReinaldo/react-typescript-eslint-prettier-boilerplate: A boilerplate for your React Application.
# Clone this repository $ git clone https://github.com/LucasReinaldo/react-typescript-eslint-prettier-boilerplate.git # Go into the repository $ cd react-typescript-eslint-prettier-boilerplate # Install dependencies $ yarn install # Run the app $ yarn start
Starred by 26 users
Forked by 7 users
Languages   TypeScript 85.8% | HTML 13.2% | JavaScript 1.0% | TypeScript 85.8% | HTML 13.2% | JavaScript 1.0%
🌐
GitHub
github.com › vasilestefirta › react-native-eslint-prettier-example
GitHub - vasilestefirta/react-native-eslint-prettier-example: How to set up ESLint and Prettier in a React Native app. · GitHub
How to set up ESLint and Prettier in a React Native app. - vasilestefirta/react-native-eslint-prettier-example
Starred by 136 users
Forked by 25 users
Languages   Java 39.8% | Objective-C 28.3% | JavaScript 22.5% | Ruby 5.6% | Starlark 3.8%
Find elsewhere
🌐
GitHub
github.com › eslint › eslint › discussions › 18580
ESLint configuration with Prettier for React Native and TypeScript · eslint/eslint · Discussion #18580
We use React Native, TypeScript and styled-components. Below is the eslint.config.js I have now. Please let me know if I can improve it? // @ts-check /** * Use recommended, recommended-type-checked, and strict plus best practice rules. */ const tsEslint = require('typescript-eslint') const eslint = require('@eslint/js') const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended') const reactRecommended = require('eslint-plugin-react/configs/recommended') const eslintPluginReactHooks = require('eslint-plugin-react-hooks') module.exports = tsEslint.config({ files: ['**/*
Author   eslint
🌐
GitHub
github.com › marcelmokos › eslint-config-with-prettier
GitHub - marcelmokos/eslint-config-with-prettier: Eslint config with prettier
Install and extend eslint-config-with-prettier it works as create-react-app but for eslint, linting with prettier.
Starred by 41 users
Forked by 11 users
Languages   JavaScript 97.3% | Shell 2.7% | JavaScript 97.3% | Shell 2.7%
🌐
GitHub
gist.github.com › carsenchan › b37ee1bf30551f7cf21db1e2e502846a
Eslint + Prettier for React Typescript · GitHub
Create a .prettierrc.js file at the root path and setup the Prettier config: module.exports = { semi: true, trailingComma: 'all', singleQuote: false, printWidth: 80, tabWidth: 2, } ... module.exports = { parser: '@typescript-eslint/parser', extends: [ 'plugin:react/recommended', 'plugin:@typescript-eslint/parser', 'prettier/@typescript-eslint', // add this line 'plugin:prettier/recommended', // add this line ], parserOptions:{ ecmaVersion: 2018, ecmaFeatures: { jsx: true, }, rules: {} settings: { react: { version: 'detect' } } } }
🌐
GitHub
github.com › michielbouw › react-typescript-eslint-prettier-boilerplate
GitHub - michielbouw/react-typescript-eslint-prettier-boilerplate: Starting point for a Typescript & React project with full setup of ESLint and Prettier.
Starting point for a Typescript React project with full setup of SASS/SCSS, ESLint and Prettier for linting and formatting.
Starred by 8 users
Forked by 7 users
Languages   TypeScript 73.5% | HTML 17.1% | CSS 9.4% | TypeScript 73.5% | HTML 17.1% | CSS 9.4%
🌐
GitHub
gist.github.com › Lean-98 › 39343800d443081ed76eb19e24f4ace9
CÓMO configurar ESLINT y PRETTIER en REACT · GitHub
Instalar extensión Eslint(Microsoft): para poder tener una respuesta visual del editor. Instalar formateador Prettier.
🌐
GitHub
github.com › aminbabu › setup-eslint-prettier-for-react
GitHub - aminbabu/setup-eslint-prettier-for-react: Linting and formatting setup using ESLint and Prettier package in VSCode.
{ // Theme "workbench.colorTheme": "Learn with Sumit - Peace of the eye - Dracula version", // config related to code formatting "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", "source.fixAll.tslint": "explicit", "source.organizeImports": "explicit" }, "eslint.run": "onSave", "emmet.includeLanguages": { "javascript": "javascriptreact" }, "path-autocomplete.extensionOnImport": true, "path-autocomplete.excludedItems": { "*/.js": { "when": "**" }, "*/.jsx": { "when": "**" } }, "javascript.validate.enable": false, "typescript.validate.enable": false }
Author   aminbabu
🌐
GitHub
github.com › prettier › eslint-config-prettier › issues › 178
Prettier with React & Typescript · Issue #178 · prettier/eslint-config-prettier
November 9, 2020 - I am trying to setup eslint to work with Prettier, React & Typescript. I am wondering, is this the right way to do it: extends: [ ... 'prettier/@typescript-eslint', 'plugin:prettier/recommended', 'plugin:prettier/react', 'plugin:prettier...
Author   ghost
🌐
GitHub
github.com › prettier › prettier-eslint
GitHub - prettier/prettier-eslint: Code `prettier` `eslint --fix` Formatted Code :sparkles: · GitHub
The config to use for formatting with ESLint. Can be overridden with filePath. The options to pass for formatting with prettier. If not provided, prettier-eslint will attempt to create the options based on the eslintConfig (whether that's provided ...
Starred by 4.1K users
Forked by 175 users
Languages   TypeScript 92.9% | JavaScript 7.1%
🌐
GitHub
gist.github.com › BrHCastro › ad9ee8b9f3d543ec07c6b456a3aa3f03
Configurando EsLint + Prettier | React TypeScript · GitHub
yarn add prettier eslint-config-prettier eslint-plugin-prettier -D · Com todas essas instalações prontas, vamos no nosso arquivo eslintrc.json e vamos substituir pelo código abaixo: { "env": { "browser": true, "es2021": true, "jest": true }, "extends": [ "plugin:react/recommended", "airbnb", "plugin:@typescript-eslint/recommended", "prettier", "plugin:prettier/recommended" ], "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaFeatures": { "jsx": true }, "ecmaVersion": 12, "sourceType": "module" }, "plugins": [ "react", "@typescript-eslint", "eslint-plugin-import-helpers", "pret
🌐
Sebastian Weber
doppelmutzi.github.io › react-eslint-prettier-vscode-2020
Efficient Code Analyzing and Formatting (for React) with ESLint, Prettier and VSCode – 2020 Edition
February 24, 2020 - TLTR; With this setup you can integrate ESLint with Prettier in a way that code formatting is turned off for ESLint (eslint-config-prettier) and runs Prettier as an ESLint rule (eslint-plugin-prettier. eslint-plugin-standard and eslint-plugin-react are two of the supported plugins.
🌐
GitHub
btholt.github.io › complete-intro-to-react-v5 › eslint-prettier
npm, ESLint & Prettier
First of all, run npm install -D eslint eslint-config-prettier to install eslint in your project development dependencies.