Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove vue/valid-template-root rule from vue3 essentials #1188

Closed

Conversation

AlexandreBonaventure
Copy link

Since Vue 3 support fragment, I don't think we need that here.
Guessing an oversight

@ota-meshi
Copy link
Member

In v7.0.0-alpha the vue/valid-template-root rule no longer reports multiple elements as an error.

@ota-meshi ota-meshi closed this Jun 4, 2020
@onx2
Copy link

onx2 commented Jul 3, 2020

I'm using v7.0.0-alpha.8 and am seeing an error. What configuration in the .eslint.js file is recommended?

image

package.json

{
  "name": "app",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "lint": "eslint"
  },
  "license": "unlicensed",
  "dependencies": {
    "vue": "^3.0.0-beta.18",
    "vue-router": "^4.0.0-alpha.12"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^3.1.0",
    "@typescript-eslint/parser": "^3.1.0",
    "@vue/compiler-sfc": "^3.0.0-beta.18",
    "eslint": "^7.3.1",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-prettier": "^3.1.4",
    "eslint-plugin-vue": "^7.0.0-alpha.8",
    "prettier": "^2.0.5",
    "typescript": "^3.9.6",
    "vite": "^1.0.0-beta.10",
    "vue-eslint-parser": "^7.1.0"
  }
}

.eslint.js

module.exports = {
  env: {
    browser: true,
    es6: true,
    node: true
  },
  extends: [
    "eslint:recommended",
    "plugin:vue/vue3-essential",
    "plugin:vue/vue3-recommended",
    "plugin:vue/vue3-strongly-recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:prettier/recommended"
  ],
  globals: {
    Atomics: "readonly",
    SharedArrayBuffer: "readonly"
  },
  parserOptions: {
    ecmaVersion: 2018,
    parser: "@typescript-eslint/parser",
    sourceType: "module"
  },
  plugins: ["vue", "@typescript-eslint"],
  rules: {
    "no-unused-vars": "off",
    "vue/valid-template-root": "off",
    "@typescript-eslint/no-unused-vars": ["error"],
    "@typescript-eslint/no-namespace": ["off"],
    "vue/no-unused-vars": "off"
  }
}

@ota-meshi
Copy link
Member

Your error may be displayed by Vetur. Turn off Vetur template validation.

https://vuejs.github.io/vetur/linting-error.html#linting-for-template
https://eslint.vuejs.org/user-guide/#editor-integrations

@AndreasLymalmSigma
Copy link

AndreasLymalmSigma commented Jul 14, 2020

Your error may be displayed by Vetur. Turn off Vetur template validation.

https://vuejs.github.io/vetur/linting-error.html#linting-for-template
https://eslint.vuejs.org/user-guide/#editor-integrations

Thank you! In VS Code settings I changed to vetur.validation.template: false and now it works. I have been scratching my head for a while.

@Linya-IronMan
Copy link

Linya-IronMan commented Jan 23, 2021

we can get eslint-plugin-vue with any version and add some configuration in .eslintrc.js.

extends: [
    "plugin:vue/vue3-essential",
    "plugin:vue/vue3-recommended",
    "plugin:vue/vue3-strongly-recommended",
     ...
  ],

tips: that "vue3" is important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants