Vite + Eslint + Vue 3: Parsing error: ‘>‘ expected.eslint

vue3开启eslint之后报错:error Parsing error: ‘>‘ expected

解决方案

  • eslint文件需要添加这两个配置:
module.exports = {
  env: {
    browser: true,
    es2021: true,
    node: true
  },
  extends: [
    'eslint:recommended',
    'plugin:vue/vue3-essential',
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended'
  ],
  overrides: [],
  parser: 'vue-eslint-parser',
  parserOptions: {
    ecmaVersion: 'latest',
    parser: '@typescript-eslint/parser',
    sourceType: 'module'
  },
  plugins: ['vue', '@typescript-eslint'],
  rules: {}
};

Vite + Eslint + Vue 3: Parsing error: ‘>‘ expected.eslint_第1张图片

你可能感兴趣的:(项目踩坑,vue.js,javascript,typescript,前端)