Skip to content

Instantly share code, notes, and snippets.

@mxcd
Last active June 20, 2022 16:09
Show Gist options
  • Save mxcd/58ee3aefca06b91bf399e2156b22f053 to your computer and use it in GitHub Desktop.
Save mxcd/58ee3aefca06b91bf399e2156b22f053 to your computer and use it in GitHub Desktop.
eslint + prettier setup for typescript with vs code
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": ["prettier"],
"rules": {
"semi": ["error", "always"],
"quotes": ["error", "backtick"]
}
}
{
"trailingComma": "es5",
"tabWidth": 2,
"useTabs": false,
"printWidth": 160,
"semi": true,
"bracketSameLine": true,
"singleAttributePerLine": false,
"singleQuote": false
}

ESlint + Prettier setup for typescript with VS Code

Installation

pnpm install --save-dev eslint eslint-config-prettier @typescript-eslint/parser @typescript-eslint/eslint-plugin

Add to VS code config

{
  "prettier.printWidth": 160,
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "eslint.validate": ["javascript", "typescript"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment