vuejs / vue-eslint-parser

The ESLint custom parser for `.vue` files.
MIT License
435 stars 74 forks source link

Question: Parsing error: Unexpected token : #198

Closed idefixcert closed 1 year ago

idefixcert commented 1 year ago

I have the following code:

const content: Ref<HTMLDivElement | undefined> = ref(undefined);

with eslint I see the following error:

  49:13  error  Parsing error: Unexpected token :

as a config I use:

/* eslint-env node */
module.exports = {
  root: true,
  parser: "vue-eslint-parser",
  extends: [
    "eslint:recommended",
    "plugin:vue/vue3-essential",
  ],
  parserOptions: {
    ecmaVersion: "latest",
  },
  rules: {
    //'vue/multi-word-component-names': 'off',
    "vue/multi-word-component-names": [
      "error",
      {
        ignores: ["About", "Home"],
      },
    ],
  },
};

my question is, if that is an error on my end or if it is an parsing error.

ota-meshi commented 1 year ago

You have to change your parser configuration.

https://github.com/vuejs/vue-eslint-parser#parseroptionsparser