question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Throws Parsing Error inside template tag

See original GitHub issue

Hi I am using Phpstorm and it throws Parsing Error inside template tag in vue files. I am not sure whats causing it. Maybe someone can help.

It does throw parsing error on <form class="bg col" @submit.prevent> if I remove @submit.prevent it throws it at :label="key"

Thanks in advance.

Tell us about your environment

  • ESLint Version: 4.6.1
  • eslint-plugin-vue Version: 3.10.0
  • Node Version: 8.5.0

Please show your full configuration:

{
    "root": true,
    "parser": "babel-eslint",
    "plugins": ["flowtype", "html"],
    "settings": {
        "html/html-extensions": [".html"]
    },
    "globals": {
        "axios": true,
        "elastic": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:vue/recommended"
    ],
    "rules": {
        "curly": ["error", "all"],
        "comma-dangle": ["error", "only-multiline"],
        "camelcase": ["error", {"properties": "never"}],
        "flowtype/define-flow-type": 1,
        "flowtype/use-flow-type": 1,
        "indent": ["error", 4, {"SwitchCase": 1}],
        "object-curly-spacing": ["error", "never"],
        "space-before-function-paren": ["error", "never"],
        "space-before-blocks": ["error", "always"],
        "space-infix-ops": ["error", {"int32Hint": false}],
        "no-alert": "error",
        "no-dupe-args": "error",
        "no-duplicate-case": "error",
        "no-duplicate-imports": "error",
        "no-empty": "error"
    },
    "env": {
        "browser": true,
        "node": true,
        "commonjs": true,
        "es6": true
    }
}

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

<template>
    <div class="frame md-6 col ">
        <form class="bg col" @submit.prevent>
            <edit-row v-for="(value,key,index) in structure"
                      :label="key"
                      :key="index"
                      :params="value"
                      v-model="itemNew[key]"
            ></edit-row>
            <action-button :btns="{create: '&#9998;', reset: '&#x274C;'}"
                           @reset="resetForm()"
                           @create="create()"
            ></action-button>
        </form>
    </div>
</template>
<script>
    import newItem from '../mixins/newItem'

    export default {
        mixins: [newItem],
    }
</script>

What did you expect to happen?

No parse erorrs displayed

What actually happened? Please include the actual, raw output from ESLint.

Parse errors displayed in folowing form: ESLint: Parsing error: Unexpected token 1| <template> 2| <div class="frame md-6 col "> 3| <form class="bg col" @submit.prevent> | ^ 4| <edit-row v-for="(value,key,index) in structure" 5| :label="key" 6| :key="index"

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

74reactions
mysticateacommented, Sep 14, 2017

Thank you for this issue.

The cause is "parser": "babel-eslint", setting. Please move it into "parserOptions".

  {
      "root": true,
-     "parser": "babel-eslint",
+     "parserOptions": {
+         "parser": "babel-eslint"
+     },
      "plugins": ["flowtype", "html", "vue"],
      "settings": {
          "html/html-extensions": [".html"]
      },
      "globals": {
          "axios": true,
          "elastic": true
      },
      "extends": [
          "eslint:recommended",
          "plugin:vue/recommended"
      ],
      "rules": {
          "curly": ["error", "all"],
          "comma-dangle": ["error", "only-multiline"],
          "camelcase": ["error", {"properties": "never"}],
          "flowtype/define-flow-type": 1,
          "flowtype/use-flow-type": 1,
          "indent": ["error", 4, {"SwitchCase": 1}],
          "object-curly-spacing": ["error", "never"],
          "space-before-function-paren": ["error", "never"],
          "space-before-blocks": ["error", "always"],
          "space-infix-ops": ["error", {"int32Hint": false}],
          "no-alert": "error",
          "no-dupe-args": "error",
          "no-duplicate-case": "error",
          "no-duplicate-imports": "error",
          "no-empty": "error"
      },
      "env": {
          "browser": true,
          "node": true,
          "commonjs": true,
          "es6": true
      }
  }

See also: https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error

0reactions
slip-boxcommented, Jul 22, 2019

and also: “plugins”: [ “react”, “standard”, “vue” ] // I forgot vue

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint throwing error in html and template files - Stack Overflow
... I would like to ignore errors like this in the .html files. I am getting this error on the below tag. error...
Read more >
KB-1465 Parsing error thrown when attempting to open a ...
When attempting to open a Word document using the Word Doc from Template Smart Service, a parsing error is thrown, as such: ...
Read more >
vue/no-parsing-error
vue/no-parsing-error # ... This rule reports syntax errors in <template> . For example: ... Syntax errors of HTML. Invalid end tags. Attributes in...
Read more >
How to create custom template tags and filters
Since the template language doesn't provide exception handling, any exception raised from a template filter will be exposed as a server error.
Read more >
Word error: XML parsing error | Dradis Pro Help
Use this guide to debug and resolve XML parsing errors. ... Validate Node labels ... the most general error message that your Word...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found