eslint and prettier for react applica code example

Example 1: eslint prettier reactjs

$ yarn add eslint prettier eslint-config-prettier eslint-plugin-prettier eslint-plugin-react eslint-plugin-react-hooks

# .eslintrc
{
  "parser": "babel-eslint",
  "extends": ["airbnb-base", "prettier"],
  "plugins": ["import"],
  "env": {
    "browser": true,
    "es6": true
  },
  "globals": {},
  "rules": {
    "import/no-cycle": "warn",
  },
  "parserOptions": {
    "sourceType": "module"
  }
}


# .prettierc
{
  "printWidth": 100,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": true,
  "arrowParens": "avoid",
  "trailingComma": "all"
}

Example 2: react eslint prettier

// check this out
https://www.youtube.com/watch?v=bfyI9yl3qfE