How to correctly setup linter and prettier in fresh Vue3 project #12880
Unanswered
AnJ-Github
asked this question in
Help/Questions
Replies: 1 comment
-
检查一下eslint插件的输出日志 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So I initialized fresh Vue 3 project using

npm create vue@latest
. I selected everything that I want typescript, eslint, prettier etc.And I installed corresponding VS Code extensions:
The project was initialized with the following VS Code config:
With
.prettierrc.json
And
eslint.config.ts
And I would expect this config work out of the box, but it does not. And what do I mean by that? Mostly formatting of Vue files.
For example if I will remove a closing slash from a component:
I will get error in VS Code saying
Element is missing end tag.vue(24)
. But there no automatic process to fix it. Saving the file does not fix it. Running command for linting does not change it, and formatting just throws an syntax errorsrc/App.vue: SyntaxError: Unexpected closing tag "template".
. There isn't even a quick fix under the VS Code tool tip. I have to manually add the slash.I only managed to get it to work when I commented out
skipFormatting
in the eslint config. And it correctly added the slash after save, but I don't think it is a proper solution?Other example is for example semicolons or single quotes. They are not fixed after file is saved, even though VS Code settings suggests it should be.
I can change the line:
into
And I don't get any warning in the IDE and saving the file does not change anything. Only manually running formatting command fixes it.
Formatting of TS files works better. For example if I will add semicolon at the end of the line, saving the file removes the semicolon automatically.
So the question is - what am I doing wrong? Why it does not work out of the box? 7 years ago when I first touched Vue I felt better developer experience than currently.
Beta Was this translation helpful? Give feedback.
All reactions