I am using Prettier but it doesn't format the order of imports.
For example, when using Go in VS Code, I can import stuff in whatever order but Gofmt will always reorder it in the right order - I guess it is part of the official Go extension for VS Code.
How to achieve something like that in Vue in VS Code?
CodePudding user response:
It looks like Volar supports this feature (Command palette Organize Imports
), it's the recommended extensions for VScode and Vue3 anyway. Vetur being for Vue2 mainly.
This can be done with Eslint too. Which is the official linter for anything related to Vue JS.
People tend to not have a lot of imports overall in Vue3, thanks to auto-imports of Vue methods components etc. There is maybe more magic overall, as shown by the unplugin
packages.
You could use this extension I guess: https://marketplace.visualstudio.com/items?itemName=amatiasq.sort-imports