April 14th, 2021
When my code looks like this:
I want my editor automatically to make it look like this:
When I started working with Vue, it took me a minute to get it formatted properly. Fighting the linter is no way to make progress on a project. So, I thought I'd share my setup.
I'm using VSCode.
I'm using Vue 3, with ESLint and Prettier. I have ESLint config in the package.json (configuring ESLint), and a separate prettier config file at the root (configuring Prettier). Why? This has given me the best results.
I also have the Vetur extension installed on VSCode. It handles syntax highlighting and all the tooling for Vue in the editor.
Once you get it all set up, you may need to quit VSCode and restart it in order for these changes to take effect.
With our formatter configured, we can ignore our linter and get our projects off the ground.
I hope this helps you on your way!