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

Beta incorrectly flags rule valid-template-root for pug templates #165

Closed
prograhammer opened this issue Aug 24, 2017 · 3 comments
Closed

Comments

@prograhammer
Copy link

prograhammer commented Aug 24, 2017

Tell us about your environment
Ubuntu 16.04 Gnome 3

  • ESLint Version:
    3.19.0
  • eslint-plugin-vue Version:
    beta (v3.12.0)
  • Node Version:
    6.11.0

Please show your full configuration:

// http://eslint.org/docs/user-guide/configuring

module.exports = {
  root: true,
  parserOptions: {
    parser: 'babel-eslint',
    sourceType: 'module'
  },
  env: {
    browser: true,
  },
  // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
  // https://github.com/vuejs/eslint-plugin-vue
  extends: [
    'standard',
    'plugin:vue/recommended'
  ],
  // required to lint *.vue files
  plugins: [
    'html'
  ],
  'settings': {
      'html/html-extensions': ['.html'],  // don't include .vue
  },
  // add your custom rules here
  'rules': {
    // allow paren-less arrow functions
    'arrow-parens': 0,
    // allow async-await
    'generator-star-spacing': 0,
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
  }
}

What did you do? Please include the actual source code causing the issue.

<template lang="pug">
.example
  | blah blah blah
</template>

<script>
export default {
  data () {
    return {

    }
  }
}
</script>

What did you expect to happen?
When I had beta v3.8.0, no linter errors occurred. After beta v3.9.0 and above, the linter error occurs in all pug templates: valid-template-root.

What actually happened? Please include the actual, raw output from ESLint.
I get an valid-template-root error for all my pug templates. It seems the latest beta updates now think that the root element is text when it is actually valid pug markup.

@armano2
Copy link
Contributor

armano2 commented Aug 24, 2017

@prograhammer for now eslint-plugin-vue supports only html -> https://github.com/mysticatea/vue-eslint-parser

i think we should consider adding check if type set as lang is set to "html" or not set at all

@mysticatea
Copy link
Member

Thank you for this report.

Yes, vue-eslint-parser has not support PUG yet.
This is a bug of vue-eslint-parser.
ast.templateBody should be undefined if the <template> is not HTML. But it exists as one Text node currently.

@michalsnik michalsnik added this to the Official release milestone Sep 3, 2017
mysticatea added a commit that referenced this issue Sep 7, 2017
mysticatea added a commit that referenced this issue Sep 14, 2017
@Aysnine
Copy link

Aysnine commented Nov 7, 2018

Now, pug is still not being ignored.

image

{
  "name": "xxx",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "build:preview": "vue-cli-service build --report --mode=preview",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "mockjs": "^1.0.1-beta3",
    "vue": "^2.5.17",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.1.0",
    "@vue/cli-plugin-eslint": "^3.1.0",
    "@vue/cli-service": "^3.1.0",
    "@vue/eslint-config-prettier": "^4.0.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.8.0",
    "eslint-plugin-vue": "^5.0.0-0",
    "pug": "^2.0.3",
    "pug-plain-loader": "^1.0.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2",
    "vue-template-compiler": "^2.5.17"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "@vue/prettier"
    ],
    "rules": {
      "prettier/prettier": [
        "warn",
        {
          "singleQuote": true,
          "semi": false,
          "trailingComma": "none"
        }
      ]
    },
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

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

Successfully merging a pull request may close this issue.

5 participants