Skip to content

Integrify-Finland/prettier-eslint-setup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 

Repository files navigation

formatter-setup

    {
      "editor.defaultFormatter": "esbenp.prettier-vscode",
      "editor.formatOnSave": true,
    }
    1. install prettier -> npm install prettier --save-dev --save-exact
    1. add .prettierrc.json and .prettierignore files for ignoring /node_modules
  {
    "bracketSameLine": true,
    "bracketSpacing": true,
    "printWidth": 200,
    "singleQuote": true,
    "tabWidth": 4,
    "trailingComma": "none",
    "useTabs": false

  }
    1. check & install eslint -> npm ls eslint / npm install eslint --save-dev
    • configure eslint -> npm init @eslint/config
    1. check & install eslint-plugin-react -> npm ls eslint-plugin-react-hooks / npm i eslint-plugin-react-hooks --save-dev
    1. check & install eslint-react-hooks -> npm ls eslint-react-hooks / npm install eslint-react-hooks --save-dev -> - for react hooks follow thins link - https://reactjs.org/docs/hooks-rules.html
    1. npm install eslint-config-prettier --save-dev -> so that no conflict happen between eslint and prettier
    1. create .eslintrc.json setup - configure the .eslintrc.json file accroding to your needs -> https://eslint.org/docs/latest/rules/
// .eslintrc.json
{
  "env": {
    "browser": true,
    "commonjs": true,
    "es2021": true
  },
  "extends": ["react-app", "react-app/jest", "prettier"],
  "overrides": [],
  "parserOptions": {
    "ecmaVersion": "latest"
  },
  "rules": {
    "no-var": "error",
    "camelcase": "error",
    "no-empty": "error",
    "default-case": "error",
    "eqeqeq": "error",
    "max-lines": ["error", 50],
    "max-depth": ["error", 3]
  }
}
    1. apply prettier now -> npx prettier --write .

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published