vuejs / vue-cli-plugin-vue-next

A Vue CLI plugin for trying out vue-next (experimental)
MIT License
339 stars 23 forks source link

Fragments not supported #2

Closed danvega closed 4 years ago

danvega commented 4 years ago

I realize this is a preview but I just wanted to make you aware that fragments aren't working. If I try and add the following template

<template>
  <h1>Hello, World!</h1>
  <button @click="increment()">
    Count: {{ state.count }} Double: {{state.double }}
  </button>
</template>

I received the error error: The template root requires exactly one element (vue/valid-template-root) at src/components/HelloWorld.vue:3:3:

CaiPeng1989 commented 4 years ago

I think this is the eslint rule is not ready for vue-next. If you disable this rule, you will find that the project runs normally.

danvega commented 4 years ago

Thank you @CaiPeng1989 If anyone else needs to disable the rule go into package.json

"eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "rules": {
      "no-console": "off",
      "vue/valid-template-root": 0
    },
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
haoqunjiang commented 4 years ago

Supported in eslint-plugin-vue v7.0.0-alpha.0

Integrated in vue-cli-plugin-vue-next v0.1.0 release.

Note: Vetur still uses eslint-plugin-vue 6.x so there may be error messages shown in the editor.