Vetur: The Setting of Vetur in VSCode Not Working in Nuxt.JS

Created on 10 Apr 2019  路  6Comments  路  Source: vuejs/vetur

Info

  • Platform: Windows 10 64bit
  • Vetur version: 0.18.1
  • VS Code version: 1.33.0

Problem

I have set those in VSCode settings.json:

"vetur.format.scriptInitialIndent": true,

"vetur.format.styleInitialIndent": true,

But when I formate .vue files in the NuxtJS project, it doesn't work.
It still displayed:
nuxtjs

If vetur doesn't support Nuxt.JS? Or Should I set others?

question

Most helpful comment

No, I don't have this problem.
But I find I have to change the setting in .eslintrc.js:
The original in create-nuxt-app:
extends: [ '@nuxtjs', 'plugin:nuxt/recommended', 'plugin:prettier/recommended', 'prettier', 'prettier/vue' ],
I have to change to:
extends: [ '@nuxtjs', 'plugin:nuxt/recommended', 'prettier', 'prettier/vue', 'plugin:vue/essential', 'eslint:recommended', ],
The error will be solved.

All 6 comments

If you have prettier extension, you might need to disable it for vue with prettier.disableLanguages.

I have add "prettier.disableLanguages": ["vue"] to the settings.json in VSCode.
It work now.
nuxtjs2
But after I format, I got many errors.
nuxtjs3
I just use npx create-nuxt-app projectname to create a NUXTJS project, and I don't set anything in the ptoject (like .editorconfig, .eslintrc.js,.prettierrc, etc.), but I get the eslint errors.

I find there is a different between in Vue project and Nuxt Project.
the .eslintrc.js in your link :
"extends": [ "eslint:recommended", "plugin:vue/recommended" ],
but the .eslintrc.js in Nuxt:
extends: [ '@nuxtjs', 'plugin:nuxt/recommended', 'plugin:prettier/recommended', 'prettier', 'prettier/vue', ],
Which one should I follow?

@MarkSky Do you have this problem? #1161

No, I don't have this problem.
But I find I have to change the setting in .eslintrc.js:
The original in create-nuxt-app:
extends: [ '@nuxtjs', 'plugin:nuxt/recommended', 'plugin:prettier/recommended', 'prettier', 'prettier/vue' ],
I have to change to:
extends: [ '@nuxtjs', 'plugin:nuxt/recommended', 'prettier', 'prettier/vue', 'plugin:vue/essential', 'eslint:recommended', ],
The error will be solved.

Was this page helpful?
0 / 5 - 0 ratings