vue/object-shorthand
Require object shorthand in template expressions.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
None | No | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
The object repeats value as both key and value.
<template>
<Widget :options="{ value: value }" />
</template>
Good
Property shorthand keeps the same binding without repetition.
<template>
<Widget :options="{ value }" />
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/object-shorthand": "warn"
}
},
});
Then run vp run lint.