vite: eslint error "The template root requires exactly one element" on latest Vite+eslint+eslint-plugin-vue(alpha)
Do NOT ignore this template or your issue will have a very high chance to be closed without comment.
Describe the bug
New Vite install, with eslint and “eslint-plugin-vue”: “^7.0.0-alpha.9”, results in errors about multiple template roots. It’s the same as this one: https://github.com/vitejs/vite/issues/549 but I just experienced it with the latest version (with or without Vetur).
Reproduction
It’s just a clean Vite install (never used Vite before), with locally added eslint and eslint-plugin-vue@7.0.0-alpha.9and an eslint file that extends 'plugin:vue/vue3-essential' and 'plugin:vue/recommended'.
System Info
- required
viteversion: 1.0.0-rc.13 - required Operating System: Mac OS Catalina (10.15.7)
- required Node version: 12.14.1
- Optional:
- npm/yarn version: 6.14.8
- Installed
vueversion (fromyarn.lockorpackage-lock.json): 3.0.4 - Installed
@vue/compiler-sfcversion: 3.0.4
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20
Ok I finally got it to work. I would suggest adding something to the docs for this:
First install eslint and eslint-plugin-vue locally:
Then add a .eslintrc.js file in the root with the following settings:
The mistake in your original
.eslintrcconfig is that you extendplugin:vue/recommendedinstead ofplugin:vue/vue3-recommended.https://eslint.vuejs.org/user-guide/#usage
I don’t think there’s anything missing in docs.