question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`editor.formatOnSave` conflict with `eslint.autoFixOnSave`

See original GitHub issue

two action result in different result, caused by prettier does not respect eslint config . CMT + SHIFT+ P -> Format Document -> Prettier formats code. Save again -> eslint autofix formats code.

// Place your settings in this file to overwrite the default settings
{
    "window.zoomLevel": 1,
    "gitlens.advanced.messages": {
        "suppressCommitHasNoPreviousCommitWarning": false,
        "suppressCommitNotFoundWarning": false,
        "suppressFileNotUnderSourceControlWarning": false,
        "suppressGitVersionWarning": false,
        "suppressLineUncommittedWarning": false,
        "suppressNoRepositoryWarning": false,
        "suppressUpdateNotice": true,
        "suppressWelcomeNotice": false
    },
    "prettier.eslintIntegration": true,
    "prettier.stylelintIntegration": true,
    "editor.formatOnSave": false,
    "eslint.autoFixOnSave": true,
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        {
            "language": "vue",
            "autoFix": true
        },
        {
            "language": "html",
            "autoFix": true
        },
        "vue"
    ]
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

57reactions
azzcommented, Jan 9, 2018

It doesn’t make sense to use both at once, as both will run the code through ESLint. You shoud either use:

    "editor.formatOnSave": false,
    "eslint.autoFixOnSave": true,

or

    "editor.formatOnSave": true,
    "eslint.autoFixOnSave": false,
25reactions
tiptopcodercommented, Jan 28, 2020

For the latest eslint extension, the settings should look like this:

{
  "editor.formatOnSave": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Formatting code and auto-fixing on save in VSCode may ...
As this GitHub issue mentions, editor.formatOnSave conflicts with eslint.autoFixOnSave . Removing the editor.formatOnSave setting (or ...
Read more >
Can't get correct autoformat on save in Visual Studio Code ...
In the VS Code settings, I need: "editor.formatOnSave": false, "javascript.format.enable": false, "eslint.autoFixOnSave": true, "eslint.
Read more >
How to Format Code on Save in VS Code with ESlint
eslint -config-prettier (turns off some conflicting ESLint rules). Run this command to install ESLint with Prettier: yarn add -D eslint prettier ...
Read more >
How To Enable Linting on Save with Visual Studio Code ...
In this tutorial, you will install ESLint, construct rules, and enable codeActionsOnSave in Visual Studio Code.
Read more >
EsLint format on save for VsCode - Venecia Calista - Medium
“eslint.autoFixOnSave”: true,. and it's done, but sadly : deprecated. So, you can add a few things : "editor.codeActionsOnSave": { "source.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found