Editors and Tools
Choosing a proper tool for the job is always hard. Thankfully Vue's popularity has grown enough for many major code editors and tools to offer very good support for its syntax specifics and
.vue files, code completion, snippets and hints, then you will need an editor with dedicated Vue support.
The list below shows the top most popular choices with more details later on why you would chose one over the other.
Best Code Editors (TLDR)
There is no doubt that VSCode has gained an enormous adoption in the development scene and for good reasons. It is not only highly customisable, with a large selection of plugins, but it also has support for a wide range of languages, and it is also free.
Out of the box, VSCode comes pretty bare bones with all the basic JS, TS and HTML editing tools, so to enable proper Vue support, you will need to install a plugin called Vetur. It gives you smart code completion and suggestions, syntax highlighting, type hinting, linting, code snippets and much more. It supports TS, JS, Stylus pretty well, with others to follow soon. You may also install a set of snippets to reduce typing the same boilerplate.
Vetur is being developed closely with VSCode and Vue core teams, to ensure maximum parity.
- Official Website
- Vetur Plugin - enable improved Vue support
- Vue VSCode Extension Pack - collection of useful plugins for Vue app development
WebStorm/PhpStorm (JetBrains IDEs)
If you need a fully featured IDE with all the bells and whistles, not just a code editor, WebStorm is a serious contender. Not free, JetBrains products like WebStorm and PhpStorm are feature rich IDEs, offering everything a web developer may need for their daily work. They have a free trial, free student licenses, as well as a free open beta testing program, which allows users to test JetBrains products early on.
To enable Vue support you will need to install the official, free Vue.js plugin from the plugins menu. It will give you
.vue file support with highlighting,
script tag code completion, linting, component hinting, prop completion, type hinting, refactoring support and much more.
As a fully featured IDE, WebStorm provides greater refactoring capabilities, improved code completion, hinting and highlighting, but at a cost of speed. It is heavy and can get choppy if you open too many files or projects at the same time.
CodeSandbox is the only online, cloud based code editor, that supports Vue's SFC format, among many other frameworks, popular client apps and server setups. Vue projects are built with Vue CLI, giving you a well known folder structure to extend upon.
Based on VSCode, CodeSandbox has a similar look and feel. When you create a Vue project, you will benefit from code completion, hinting, syntax highlighting and more. It even allows you to connect a sandbox to a Github repo and commit to it on each change. Apart from Vue CLI, they have templates for Vuepress and Nuxt, just to name a few.
CodeSandbox has a very generous freemium policy with 50 active sandboxes (projects) absolutely free.
An amazing, free, open-source code editor created by GitHub with plenty of extensions and superb user experience. With the available plugins, it supports a wide range of languages and features, including ones dedicated to Vue: smart code completion/suggestions, snippets, syntax highlighting, linting and formatting with both eslint and prettier, that works in template, script and style parts of the Vue SFC.
On top of that, Atom has great integration with GitHub when it comes to managing commits, PRs, reviewing changes and can be further extended with additional plugins. Some say its the most fashionable and good looking editor out there and the code completion is at the same time very smart (thanks to Tern.js), but also completely unintrusive. You’re the developer, you got this!
Some say, that it’s a bit slow, but that’s just a way of hinting that you should refactor your huge components.
Another very popular editor, coming close to VSCode. It is well known for its speed and lightness. Sublime has a very big library of free plugins, extensions and themes, enabling far more features, than was intended in the beginning.
Sublime has a fair Vue support, with syntax highlighting in
.vue files coming from an official plugin from the Vue core team. Unfortunately the feature list pretty much stops there. You can download snippets as well.
If you have to choose a light editor for Vue, we recommend VSCode.
No setup is complete without a good linter or formatter. Some editors offer their own implementations, others offer good integration with already existing tools, and third offer both. Below we will show the most popular tools, why one should use them, and how they integrate with the above editors, and with each other.
Vue CLI offers a fully setup ESLint configuration, thanks to the incredible work by the people behind the Vue ESLint project. It is constantly being improved and worked on, offering a large set of rules, from basic Vue style guidelines, to very strict ones, keeping code as close to the Official Vue Style Guide as possible. It also allows you to pick between Standard or Airbnb code style rules.
How to install Vue ESLint plugin
Installation is as easy as following a few steps. There are official guides that are kept upto date.
How to enforce coding standards (Standard or Airbnb styles)
To have or not to have semicolons, closing brace on the same row or on the next, space after function name or not, these are all coding style related questions and are not connected with Vue in any way.
These can be enforced by a collection of rules, also called presets or standards. Two very popular ones are Standard and Airbnb, also known as "no semicolons vs with semicolons". But they are much more than that, take a look at each respectively and decide which one suits your styles best.
Note: The Vue ESLint plugin does not enforce any coding styles like Standard or Airbnb, those can be however setup via Vue CLI or manually. Vue has pre-built setups, that are meant for Vue CLI, but could be used as a guideline.
Usage with Code Editors
Every major editor comes with ESLint support, either by an official or a community driven plugin. Follow the links to the guides below or upto date step by step instructions.
The lack of options are actually one of its strong points, enforcing sensible defaults across the board.
How to use Prettier with Vue
If you just want to use Prettier, you can do so by installing it and using it directly via the command line. Follow the installation guide for more details.
Using Prettier with ESLint
Prettier however does not work well with ESLint, out of the box. When used together, most often they have colliding rules between their style configurations. The problem is that, you cannot disable most of those in Prettier, as it was made to be "all or nothing" kind of thing.
The solution is to use an ESLint plugin to run Prettier from within ESLint. On top of that, with the help of another plugin that disables all colliding rules, ESLint can run Prettier without issues and then fix the rest when used with style standards like Standard or Airbnb.
If you are using Vue CLI, this comes out of the box, so no need to worry what plugins to install.
Integrating Prettier with Code Editors
VSCode note: It is important to note that the Vetur plugin comes with some integrated version of Prettier which formats js and styles, but not templates, it uses prettyhtml for those. If you want to handle that with Prettier and ESLint, read the Formatting guide on Vetur's docs.
- Official Prettier editor integration tutorials
- How to properly set up Nuxt with ESLint and Prettier in VSCode - Very well written tutorial on how to setup VSCode to work with both ESLint and Prettier.
- Veturpack - Project configured to work with Vetur and Prettier for VSCode.