How do I run a code formatter over my source without modifying git history?

You can make git blame ignoring certain commits, which do only mass reformatting etc.: Create a file .git-blame-ignore-revs like: # Format commit 1 SHA: 1234af5….. # Format commit 2 SHA: 2e4ac56….. Then do git config blame.ignoreRevsFile .git-blame-ignore-revs , so that you don’t have to use the –ignore-revs-file option every time with git blame. Upvote https://github.com/github/feedback/discussions/5033 … Read more

Eslint adds unnecessary space between braces, Prettier shows error

I’ve had very similar error, but in my case default VSCode TypeScript formatter was messing with braces. In .vscode/settings.json add: “javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces”: false, “typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces”: false, You might also find useful option: “[typescript]”: { “editor.defaultFormatter”: “dbaeumer.vscode-eslint” }

Difference between codeActionsOnSave and formatOnSave in VS Code

I’m trying to get my VS Code to run ESLint and Prettier together properly as well. Then VSCode 1.44 (March 2020) would highlight another difference between codeActionsOnSave and formatOnSave: Explicit ordering for editor.codeActionsOnSave You can now set editor.codeActionsOnSave to an array of code actions to execute in order. You can use this to guarantee that … Read more

Can’t get correct autoformat on save in Visual Studio Code with ESLint and Prettier

Short answer: I needed: “editor.formatOnSave”: false, “javascript.format.enable”: false. I finally found the magical combination of settings, thanks to this thread from Wes Bos on Twitter. I was right in my suspicion that there seem to be multiple conflicting formatters. Though I’m not sure what they actually are, I was able to turn off all but … Read more

Prettier 3.0.0 TypeError: prettier.resolveConfig.sync is not a function

There is an incompatibility between prettier 3 and eslint-plugin-prettier 4. You can fix this by using version 5 of eslint-plugin-prettier: yarn add -D eslint-plugin-prettier@5.0.0 or npm install –save-dev eslint-plugin-prettier@5.0.0 Official issue: https://github.com/prettier/eslint-plugin-prettier/issues/562 v5 release notes: https://github.com/prettier/eslint-plugin-prettier/releases/tag/v5.0.0