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.

Error while loading rule 'vue/no-confusing-v-for-v-if': Cannot read property 'on' of undefined

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.4.1
  • eslint-plugin-vue Version: 3.10.0
  • Node Version: 6.11.2

Please show your full configuration:

.eslintrc.json

{
  "root": true,
  "extends": [
    "eslint:recommended",
    "plugin:vue/recommended",
    "plugin:import/errors",
    "plugin:import/warnings"
  ],
  "parserOptions": {
    "ecmaVersion": 7,
    "sourceType": "module"
  },
  "env": {
    "browser": true,
    "node": true,
    "mocha": true
  },
  "rules": {
    "no-console": 1
  }
}

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

package.json

"scripts": {
    "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
    "lint": "eslint src/**"
  },

What did you expect to happen?

Steps to reproduce:

  • Create project with vue-cli: vue init webpack-simple my-project
  • Configure eslint as above
  • In package.json file, add the script “lint” wich executes eslint src/**
  • In the terminal window, run npm run lint

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

Error while loading rule 'vue/no-confusing-v-for-v-if': Cannot read property 'on' of undefined TypeError: Error while loading rule 'vue/no-confusing-v-for-v-if': Cannot read property 'on' of undefined at ensureEmitter (C:\Bitbucket\resultados2018\construccion\frontend-resultados\node_modules\vue-eslint-parser\index.js:2640:23) at Object.registerTemplateBodyVisitor (C:\Bitbucket\resultados2018\construccion\frontend-resultados\node_modules\vue-eslint-parser\index.js:2653:29) at Object.registerTemplateBodyVisitor (C:\Bitbucket\resultados2018\construccion\frontend-resultados\node_modules\eslint-plugin-vue\lib\utils\index.js:38:28) at Object.create (C:\Bitbucket\resultados2018\construccion\frontend-resultados\node_modules\eslint-plugin-vue\lib\rules\no-confusing-v-for-v-if.js:40:9) at Object.keys.filter.forEach.ex (C:\Bitbucket\resultados2018\construccion\frontend-resultados\node_modules\eslint\lib\linter.js:874:67) at Array.forEach (native) at Linter.verify (C:\Bitbucket\resultados2018\construccion\frontend-resultados\node_modules\eslint\lib\linter.js:847:93) at processText (C:\Bitbucket\resultados2018\construccion\frontend-resultados\node_modules\eslint\lib\cli-engine.js:203:31) at processFile (C:\Bitbucket\resultados2018\construccion\frontend-resultados\node_modules\eslint\lib\cli-engine.js:245:18) at executeOnFile (C:\Bitbucket\resultados2018\construccion\frontend-resultados\node_modules\eslint\lib\cli-engine.js:585:25)

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
armano2commented, Aug 8, 2017

@ccalvarez it’s fixed already on master https://github.com/vuejs/eslint-plugin-vue/commit/8761bdeb74dab5551639634a75af84ce29cfb520

Its failing due to breaking changes in eslint 4.4.0, you can use Eslint <= 4.3.0 till next release of plugin

2reactions
pimskiecommented, Oct 20, 2017

@willin I fixed it by changing this:

module.exports = {
  extends: [
    'plugin:vue/recommended',
  ]
}

to:

module.exports = {
  extends: [
    //
  ],
  plugins: ['vue'],
}

As described here: https://www.npmjs.com/package/eslint-plugin-vue Used with "eslint-plugin-vue": "2.1.0"

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
create-react-app: Cannot read property 'ScopeType' of ...
Failed to compile Error while loading rule '@typescript-eslint/naming-convention': Cannot read property 'ScopeType' of undefined Occurred ...
Read more >
Cannot read property 'on' of undefined? -> ERROR
I want my server.js to contact with the client.js (there's nothing written in it) and run as a normal server! Every advice is...
Read more >
ERROR TypeError: Cannot read property title of undefined
Solved: OK 304 API Controller in React with Asp.Net is never reached. Setup Proxy.js. CodeDocu Developer C# Asp Net Angular.
Read more >
Salesforce CPQ Error 'Cannot Read Property key of undefined ...
Users receive error message “Cannot read property 'key' of undefined” in the Salesforce CPQ package when loading the Quote Line Editor after clicking...
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