Skip to content

Instantly share code, notes, and snippets.

@Jayphen
Last active March 12, 2019 12:40
Show Gist options
  • Select an option

  • Save Jayphen/77fa13e60305ce6a830c9bed79b00ff9 to your computer and use it in GitHub Desktop.

Select an option

Save Jayphen/77fa13e60305ce6a830c9bed79b00ff9 to your computer and use it in GitHub Desktop.
ESlint/autosave VSCode settings
{
"prettier.eslintIntegration": true,
"editor.formatOnSave": true,
"eslint.enable": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "typescript", "autoFix": true },
{ "language": "typescriptreact", "autoFix": true }
],
}
@Jayphen

Jayphen commented Mar 12, 2019

Copy link
Copy Markdown
Author

Note I have disabled the editor's formatOnSave for js & ts because eslint handles that for me.

Extensions

ESlint: https://github.com/Microsoft/vscode-eslint.git
Prettier: https://github.com/prettier/prettier-vscode.git

@jakst

jakst commented Mar 12, 2019

Copy link
Copy Markdown

Work great! 👍 Thanks!

@Jayphen

Jayphen commented Mar 12, 2019

Copy link
Copy Markdown
Author

I have removed autofix on save on Dan's recommendation, but if you want fixable eslint warnings to be fixed on save, add this:

  "[javascript]": {
    "editor.formatOnSave": false
  },
  "[javascriptreact]": {
    "editor.formatOnSave": false
  },
  "[typescript]": {
    "editor.formatOnSave": false
  },
  "[typescriptreact]": {
    "editor.formatOnSave": false
  },
  "eslint.autoFixOnSave": true,

It's probably better to manually fix errors so that you learn from them, rather than having them magically fixed for you.

The "autoFix": true for TS in the eslint.validate rules is still necessary in order to get the little lightbulb to show up in VSCode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment