HomeProjectsArticlesNotesAbout

Eslint and Prettier General Config

dev-env
notes

Machine

brew install eslint
brew install prettier

Project

npm install --save-dev eslint-config-prettier eslint-plugin-prettier
touch .prettierrc
npx eslint --init

Prettier Example

.prettierrc

// .prettierrc
{
  "arrowParens": "avoid",
  "semi": false,
  "singleQuote": true,
  "printWidth": 70
}

Eslint Example

.eslint.json

// .eslint.json
{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": ["prettier", "eslint:recommended", "plugin:react/recommended"],
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 12,
    "sourceType": "module"
  },
  "plugins": ["prettier", "react"],
  "rules": {
    "prettier/prettier": ["error"]
  }
}

References

Prettier & Eslint - Rw;eruch

Prettier Eslint in VSCode - Rw;eruch

More Articles

All Articles

Links

Home Articles Notes Projects About Style Guide Site Credits

Contact

ย connect@dev.lucaszapico.space

Location

๐ŸŒŽ Earth