DEV Community

Cover image for Having trouble😫 with VS code💻 formatOnSave lately?
kapeel kokane
kapeel kokane

Posted on

5 1

Having trouble😫 with VS code💻 formatOnSave lately?

If you are like me, then you like your tools.

One of the most important tools in a coder's workflow is automation & I really like automating repetitive tasks like code formatting & linting.

With the availability of extensions like eslint for VS code, setting it up is as simple as installing the extension and maintaining a .eslintrc.js file in the repo.

But lately, I have been facing some issues with the formatOnSave in VS code. My code seemed to behave weird like it was getting formatted and getting un-formatted on every save:

Alt Text

I had to do some research around it and got to the bottom of it. It was related to this settings migration by VS code: https://github.com/microsoft/vscode-eslint#settings-migration

The solution to fix it was simple:
Alt Text

From the vs code settings (which you can open by doing cmd+, or opening settings.json), remove the line number 88 and add line numbers 89-92. Doing that will successfully migrate you to the new settings.

Hope that saved you from an afternoon of headache.

Cheers!

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (1)

Collapse
 
devanghingu profile image
Devang Hingu • Edited

Actually you are missing which settings.json.

VScode have two settings.json file in preference. 1st in USER-TABS and 2nd in WORKSPACE-TABS.
you must have to mention that over there. Otherwise it will not work if it replaced in wrong file.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay