0

I was able to set up ESLint working with Encore (Symfony). My .eslintrc.js file has the following configuration:

module.exports = {
    "parser": "vue-eslint-parser",
    "parserOptions": {
        "parser": "babel-eslint",
        "ecmaFeatures": {
            "legacyDecorators": true
        },
        "ecmaVersion": 5,
    },
    "extends": [
        "plugin:vue/base",
        "airbnb-base"
    ],
    "rules": {
       "vue/html-indent": [2, 4],
        ...
    },
    "env": {
        browser: true,
        es6: true,
        node: true
    },
    "plugins": [
        "vue",
    ]
};

and whenever I watch the files I get the following error 1:1 error Use the latest vue-eslint-parser. See also https://vuejs.github.io/eslint-plugin-vue/user-guide/#what-is-the-use-the-latest-vue-eslint-parser-error vue/html-indent.

I have tried the solutions in the following links:

Any suggestion would be highly appreciated. Thank you

1 Answers1

0

it's because Encore force parser option to babel-eslint and it's not compatible with eslint-plugin-vue.

As a workaround you can use the following code to let Encore/ESLint lint your .vue files:

Encore
  .enableEslintLoader(options => {
      delete options.parser;
  })
  .configureLoaderRule('eslint', loader => {
      loader.test = /\.(jsx?|vue)$/;
  })

All credits goes to Kocal at Github: https://github.com/symfony/webpack-encore/issues/656