Eslint-plugin-vue: Parser does not parse with recommended config (vue-eslint-parser + babel-eslint)

Created on 3 Jan 2018  路  2Comments  路  Source: vuejs/eslint-plugin-vue

Tell us about your environment

  • Windows 10
  • VS Code
  • Vue Webpack Starter Template

  • ESLint Version: 4.13.1

  • eslint-plugin-vue Version: 4.0.1
  • Node Version: 8.9.3

Please show your full configuration:

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

module.exports = {
  root: true,
  //parser: 'vue-eslint-parser',
  //parser: 'babel-eslint',
  parserOptions: {
    parser: 'babel-eslint',
    sourceType: 'module',
    allowImportExportEverywhere: false
  },
  env: {
    browser: true,
  },
  // https://github.com/standard/standard/blob/master/docs/RULES-en.md
  // https://github.com/vuejs/eslint-plugin-vue
  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
  }
}

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

<script>
import { mapActions, mapState } from 'vuex';
...
</script>

What did you expect to happen?

The standard rules should tell me to remove semicolons ; from the end of lines. I should also see errors between my <template></template> and <script></script> tags identified by eslint-plugin-vue

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

I do not see eslint output.

It may be worth noting that I do see output in my main.js file. Both for standard and plugin:vue/recommended. When those rules are fixed, I still do not see rules in any other files.

When I specify my parser at the top level as babel-eslint, I receive the "Use the latest vue-eslint-parser" error. If I follow the config changes laid out in the readme, no eslint errors are shown. If I add parser: 'vue-eslint-parser', as a top level config property, I continue to see no eslint errors.

Most helpful comment

Hey, just so you know webpack template will be updated soon and will use this plugin by default :)

All 2 comments

@wiaterb, and anyone else that sees this thread. I found the answer to my problem here: https://github.com/vuejs/eslint-plugin-vue/issues/288#issuecomment-352256530

The issue was this section:

 // required to lint *.vue files
  plugins: [
    'html'
  ],

Thanks, @michalsnik! It may be worth adding this as a note somewhere if it doesn't already exist, as it requires a change to the default Vue Webpack Starter Template 馃憤

Hey, just so you know webpack template will be updated soon and will use this plugin by default :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mouvedia picture Mouvedia  路  3Comments

chrisvfritz picture chrisvfritz  路  3Comments

armano2 picture armano2  路  4Comments

xiGUAwanOU picture xiGUAwanOU  路  3Comments

gluons picture gluons  路  4Comments