Vize

script/valid-define-props

Enforce valid defineProps() usage (single call, not both type and runtime args, no local references)

Bad · Good

Default severity: error
Presets: essential, happy-path, ecosystem, nuxt, opinionated
Automatic fix: None; review the suggested change
Applies to: JS/TS scripts in Vue SFCs; examples show the relevant Options API or script setup form
Options: No rule-specific options. Severity and preset selection are configurable.

Configuration (Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({
  lint: {
    vize: {
      "preset": "incremental",
      "rules": {
        "script/valid-define-props": "error"
      }
    },
  },
});
vp run lint

Bad

The same defineProps call supplies both { title: string } as a type argument and { title: String } as a runtime argument, which the compiler does not permit together.

<script setup lang="ts">
defineProps<{ title: string }>({ title: String });
</script>

Good

Removing the runtime object leaves one type-based declaration for title instead of combining both declaration forms.

<script setup lang="ts">
defineProps<{ title: string }>();
</script>

Good avoids this rule's finding under the configuration above; other rules may still report diagnostics.

Implementation · All rules