script/consistent-props-emits-key-quotes
Require consistent quoted keys in props and emits declarations.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
error |
None | No | None |
Applies to: JS/TS scripts in Vue SFCs; examples show the relevant Options API or script setup form.
Formatter compatibility
This lint rule owns declaration-specific quoting. Configure Prettier, Oxfmt, and the Vize formatter with quoteProps: "preserve" so formatting does not remove quotes required by the rule.
Bad
The emits declaration mixes the necessarily quoted update:modelValue key with the unquoted close key.
<script setup lang="ts">
const emit = defineEmits<{
"update:modelValue": [value: string]
close: []
}>()
</script>
Good
Every static key in the declaration is quoted because update:modelValue cannot be written as an unquoted JavaScript identifier.
<script setup lang="ts">
const emit = defineEmits<{
"update:modelValue": [value: string]
"close": []
}>()
const props = defineProps({
"aria-label": String,
"disabled": Boolean,
})
</script>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"script/consistent-props-emits-key-quotes": "error"
}
},
});
Then run vp run lint.