Home » vue » Cannot setup eslint-plugin-vue

Cannot setup eslint-plugin-vue

Posted by: admin November 26, 2021 Leave a comment

Questions:

I had tried hours to setup eslint-plugin-vue, but the lint output is always empty (no stdout and stderr), I must have missed something very basic?

Commands

$ node --version # v9.4.0
$ npm install
$ $(npm bin)/eslint . # Empty output

File structure

Foo
├── .eslintrc.js
├── main.vue
└── package.json

.eslintrc.js

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

package.json

{
  "name": "Foo",
  "version": "0.1.0",
  "devDependencies": {
    "eslint": "^4.17.0",
    "eslint-plugin-vue": "^4.2.2"
  }
}

main.vue

<template>
</template>
<script>
[email protected]#$%^UIYTHRE
</script>
Answers:

Do $(npm bin)/eslint . --ext .vue

The eslint command checks only .js files by default. You have to specify additional extensions by --ext option.