vuejs / vue-eslint-parser

The ESLint custom parser for `.vue` files.
MIT License
443 stars 75 forks source link

Linting TSX in Vue SFC file throw error #176

Open Cat1007 opened 1 year ago

Cat1007 commented 1 year ago

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

What version of ESLint are you using?

8.22.0

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

What did you do?

Configuration ``` 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

image

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

laterdayi commented 1 year ago

same question

DrJume commented 10 months ago

It seems to be always interpreted as false, if parserOptions.project is provided: https://typescript-eslint.io/packages/parser/#jsx:~:text=If%20parserOptions.project%20is%20provided,as%20if%20this%20is%20false

FrankFang commented 8 months ago

Any idea?

cumt-robin commented 8 months ago

Any idea?

这么巧,还有一小时前的,今天也遇到这个问题了

wmelton commented 6 months ago

This fixed the issue for me:

Eslint:

"parser": "vue-eslint-parser", "parserOptions": { "parser": "@typescript-eslint/parser" },