prettier-eslint icon indicating copy to clipboard operation
prettier-eslint copied to clipboard

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

Open the-vampiire opened this issue 3 years ago • 4 comments
trafficstars

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!

the-vampiire avatar Feb 06 '22 19:02 the-vampiire

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.

NoelDeMartin avatar May 22 '22 08:05 NoelDeMartin

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

drewbaker avatar Jun 25 '22 00:06 drewbaker

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

idahogurl avatar Jun 25 '22 22:06 idahogurl

@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

drewbaker avatar Jun 26 '22 08:06 drewbaker

Close in favor of https://github.com/idahogurl/vs-code-prettier-eslint

JounQin avatar Aug 15 '22 04:08 JounQin