vuejs / vue-eslint-parser

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

Generics can't be used in SFC with both script and script setup blocks #200

Closed ferferga closed 1 year ago

ferferga 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.41.0

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

What did you do?

Configuration ``` parser: 'vue-eslint-parser', parserOptions: { parser: '@typescript-eslint/parser', sourceType: 'module' }, ```
<script lang="ts>
...
</script>
<script setup lang="ts" generic="T">
defineProps<{ prop: T }>();
</script>

What did you expect to happen?

Generic type argument doesn't trigger the no-undef rule when being used in the <script setup lang="ts">...</script> block alongside a normal <script lang="ts">...</script> block

What actually happened?

When using a normal <script lang="ts">...</script> block alongside a <script setup lang="ts" generic="T">...</script>, generics trigger the no-undef rule from eslint's core ruleset.

Link to Minimal Reproducible Example

Minimal reproduction: https://github.com/ferferga/vue-eslint-parser-repro Original repository affected with the issue: https://github.com/jellyfin/jellyfin-vue

Additional comments

TLDR: It looks like vue-eslint-parser isn't build towards considering <script>...</script> and <script setup>...</script> can be mixed together

ferferga commented 1 year ago

Thank you very much @ota-meshi! It's working wonderfully now!

ota-meshi commented 1 year ago

Thank you for letting me know. I'm glad it worked.