Tell us about your environment
Please show your full configuration:
module.exports = {
root: true,
parser: 'babel-eslint',
env: {
browser: true,
node: true
},
extends: [
'standard',
'plugin:vue/recommended'
],
plugins: [
'vue'
]
}
What did you do?
eslint --ext .js,.vue --ignore-path .gitignore .
What actually happened? Please include the actual, raw output from ESLint.
Error while loading rule 'vue/no-confusing-v-for-v-if': Cannot convert undefined or null to object
TypeError: Error while loading rule 'vue/no-confusing-v-for-v-if': Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at Object.keys.filter.forEach.ruleId (/home/mihail/Documents/Development/nephroxenia-nuxt/node_modules/eslint/lib/linter.js:991:24)
at Array.forEach (<anonymous>)
at Linter.verify (/home/mihail/Documents/Development/nephroxenia-nuxt/node_modules/eslint/lib/linter.js:931:95)
at processText (/home/mihail/Documents/Development/nephroxenia-nuxt/node_modules/eslint/lib/cli-engine.js:203:31)
at processFile (/home/mihail/Documents/Development/nephroxenia-nuxt/node_modules/eslint/lib/cli-engine.js:245:18)
at executeOnFile (/home/mihail/Documents/Development/nephroxenia-nuxt/node_modules/eslint/lib/cli-engine.js:585:25)
at fileList.forEach.fileInfo (/home/mihail/Documents/Development/nephroxenia-nuxt/node_modules/eslint/lib/cli-engine.js:622:13)
at Array.forEach (<anonymous>)
at CLIEngine.executeOnFiles (/home/mihail/Documents/Development/nephroxenia-nuxt/node_modules/eslint/lib/cli-engine.js:621:18)
please read:
https://github.com/vuejs/eslint-plugin-vue#couple-faq
- "parser": "babel-eslint",
"parserOptions": {
+ "parser": "babel-eslint",
"ecmaVersion": 2017,
"sourceType": "module"
}
I am having the same issue, but I seem to have the parseOptions set as described in the FAQ.
When I comment out the vue-eslint-parser, the build works, but obviously without the benefits of linting.
Here's my .eslintrc.js
module.exports = {
root: true,
parser: 'vue-eslint-parser',
parserOptions: {
parser: "babel-eslint",
sourceType: 'module'
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: ['standard', 'plugin:vue/recommended'],
// required to lint *.vue files
plugins: [
'html'
],
// 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
}
}
@treetopdevs You are using:
plugins: [ 'html' ],
you should ignore vue files from parsing by it
"settings": {
"html/html-extensions": [".html"], // consider .html and .we files as HTML
}
eslint-plugin-html has conflict with eslint-plugin-vue
I tried putting the "settings" lines in all possible places with in the .eslintrc file, and even commented out the plugins: [ 'html' ], and I still get the following error:
Module build failed: TypeError: Error while loading rule 'vue/no-confusing-v-for-v-if': Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at Object.keys.filter.forEach.key (/htdocs/xxx/node_modules/eslint/lib/eslint.js:872:28)
at Array.forEach (<anonymous>)
at EventEmitter.module.exports.api.verify (/htdocs/xxx/node_modules/eslint/lib/eslint.js:841:93)
at processText (/htdocs/xxx/node_modules/eslint/lib/cli-engine.js:264:31)
at CLIEngine.executeOnText (/htdocs/xxx/node_modules/eslint/lib/cli-engine.js:754:26)
at lint (/htdocs/xxx/node_modules/eslint-loader/index.js:218:17)
at Object.module.exports (/htdocs/xxx/node_modules/eslint-loader/index.js:213:21)
@treetopdevs can you share with us example code witch causes this error?
@treetopdevs I suspect the version of vue-eslint-parser is mismatching.
Please remove parser: 'vue-eslint-parser' from your .eslintrc because the setting is in plugin:vue/recommended with the correct version.
It's been almost a month @treetopdevs I hope @mysticatea's advise helped you :) If not please reopen this issue with a little bit more informations and some code examples that causes errors.
I use these settings, but while it works, it ignores most of js lint issues in vue files. What do I miss?
module.exports = {
root: true,
env: {
browser: true,
node: true
},
extends: [
"standard",
"eslint:recommended",
"plugin:vue/recommended"
],
parserOptions: {
"parser": "babel-eslint",
"ecmaVersion": 2017,
"sourceType": "module"
},
// required to lint *.vue files
plugins: [
'vue'
],
// add your custom rules here
rules: {},
globals: {}
}
Most helpful comment
please read:
https://github.com/vuejs/eslint-plugin-vue#couple-faq