prettier/prettier-eslint

how to integrate with prettier vscode extension? no longer has "prettier.eslintIntegration" option

the-vampiire opened this issue · 5 comments

hey i am wondering how to properly integrate this with vscode now?

i am able to run it with an NPM script but would like to set is for formatting on save.

thank you for writing this by the way!

I've been looking into this, and it seems like this was removed about 3 years ago from the VSCode plugin. And I haven't been able to find a replacement. They point to this message in the README as a solution:

The recommended way of integrating with linters is to let Prettier do the formatting and configure the linter to not deal with formatting rules. You can find instructions on how to configure each linter on the Prettier docs site. You can then use each of the linting extensions as you normally would. For details refere to the Prettier documentation.

So it seems like this is a use-case that is no longer supported (which is a bit confusing, because if you visit the Prettier documentation it leads you back here).

I had given up all hope at this point, but it occurred to me that this project still seems to work on the CLI. Looking for a way to run this script on save, I found the following plugin: Run on Save. You also need to install the prettier-eslint-cli package, but once you've done that, you can use the following config:

"emeraldwalk.runonsave": {
    "commands": [
        {
            "match": "\\.ts$",
            "cmd": "npx prettier-eslint --parser typescript --write ${file}"
        },
    ]
},

You'll need to configure this differently for other languages, but so far it gets the job done :). Happy to hear if there's any better options though.

Yeah I'm moving to VS Code after Atom end of life, and finding it really difficult to get this working too.

I'm going to do an unapologetic plug for my extension. VS Code Prettier ESLint

@idahogurl im way ahead of you. That totally was the answer and I even wrote up some docs for my team to follow: https://paper.dropbox.com/doc/How-to-get-VS-Code-setup--BkGlDyauC~UZtwk4iPO83e~yAQ-38r84QublFNAzo74LSCwf?_tk=slack_preview