Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require-typed-object-prop reports on non-TypeScript <script setup> #2503

Closed
2 tasks done
andreww2012 opened this issue Jul 9, 2024 · 1 comment · Fixed by #2505
Closed
2 tasks done

require-typed-object-prop reports on non-TypeScript <script setup> #2503

andreww2012 opened this issue Jul 9, 2024 · 1 comment · Fixed by #2505
Labels

Comments

@andreww2012
Copy link

andreww2012 commented Jul 9, 2024

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 9.6.0
  • eslint-plugin-vue version: 9.27.0
  • Vue version:
  • Node version:
  • Operating System:

Please show your full configuration:

What did you do?

Sorry for not filling out everything, I think the problem is straightforward and easily reproducible: require-typed-object-prop does not respect the lang attribute on <script setup> and expects type annotation to be present in plain JS code.

Just insert the following in the playground on this rule's page:

<script setup>
defineProps({
  prop: Object,
})
</script>

I've read the limitations section on the rule's page saying it is not meant to be used in JS projects, but I have some with mixed codebase (mainly as a result of TS migration or adjusting someone else's components code written in JS) and I just felt like detecting the language is something that seems possible to me.

What did you expect to happen?

What actually happened?

Repository to reproduce this issue

@FloEdelmann FloEdelmann added the bug label Jul 9, 2024
@FloEdelmann
Copy link
Member

FloEdelmann commented Jul 9, 2024

Thanks for reporting, I can reproduce the issue. PR welcome to fix this! Nevermind, I created a fix myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants