vuejs/vue-eslint-parser

Linting TSX in Vue SFC file throw error

Open

#176 创建于 2022年12月30日

在 GitHub 查看
 (7 评论) (1 反应) (0 负责人)TypeScript (84 fork)github user discovery
help wanted

仓库指标

Star
 (488 star)
PR 合并指标
 (PR 指标待抓取)

描述

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I'm using eslint-plugin-vue.
  • I'm sure the problem is a parser problem. (If you are not sure, search for the issue in eslint-plugin-vue repo and open the issue in eslint-plugin-vue repo if there is no solution.
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.22.0

What version of eslint-plugin-vue and vue-eslint-parser are you using?

  • vue-eslint-parser@9.1.0
  • eslint-plugin-vue@9.8.0

What did you do?

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    "plugin:vue/vue3-essential",
  ],
  plugins: ["vue", "@typescript-eslint"],
  parser: "vue-eslint-parser",
  parserOptions: {
    parser:"@typescript-eslint/parser" ,
    extraFileExtensions: [".vue"],
    tsconfigRootDir: __dirname,
    project: './tsconfig.json',
    ecmaVersion: 2020,
    ecmaFeatures: {
      jsx: true,
    },
  },
  rules: {
    "vue/no-unused-components": 1,
  },
  overrides: [
    {
      files: ["*.ts", "*.tsx", "*.vue"],
      rules: {
        "@typescript-eslint/no-unused-vars": [1, { args: "none" }],
        "vue/multi-word-component-names": 0,
      },
    },
  ],
};
<script setup lang="tsx">
import TestComp from "./TestComp.vue";
const testFunc = () => {
  return <TestComp test={1}></TestComp>;
};
</script>

What did you expect to happen?

no error

What actually happened?

throw Error Parsing error: '>' expected.eslint

when I use single .tsx file these has no error

Link to Minimal Reproducible Example

https://github.com/Cat1007/parseErrorDemo

see src/HasErrorComp.vue

Additional comments

No response

贡献者指南