Skip to content

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

Closed
@andreww2012

Description

@andreww2012

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions