# object-shorthand

Rule `vue/object-shorthand`. Require or disallow method and property shorthand syntax for object literals in `<template>`

- Source: vue
- Technologies: Vue
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 758.7K weekly downloads of presets that enable it
- Trend: +49.9% last quarter
- Rank: #1583 by reach, #800 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/object-shorthand` | no | safe | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/object-shorthand.html) |
| Biome | `style/useConsistentObjectDefinitions` | no | safe | group style, since 2.0.0 | [docs](https://biomejs.dev/linter/rules/use-consistent-object-definitions/) |

## Code examples

### Incorrect: the rule reports this

```js
let foo = 1;
let invalid = {
    foo: foo
};
```

```js
let invalid = {
    bar: function() { return "bar"; },
};
```

```js
let foo = 1;
let invalid = {
    foo
};
```

### Correct: the rule accepts this

```js
let foo = 1;
let valid = {
    foo,
    bar() { return "bar"; },
};
```

```js
let valid = {
    baz: function qux() { return "qux"; },
};
```

```js
let foo = 1;
let valid = {
    foo: foo,
    bar: function() { return "bar"; },
};
```

Examples from the Biome documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import vue from "eslint-plugin-vue";

export default [
  {
    plugins: { vue },
    rules: {
      "vue/object-shorthand": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "useConsistentObjectDefinitions": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |

## Related rules

- [eslint/object-shorthand](https://lintradar.dev/rules/eslint/object-shorthand.md): Require or disallow method and property shorthand syntax for object literals
- [vue/no-useless-v-bind](https://lintradar.dev/rules/vue/no-useless-v-bind.md): Disallow unnecessary `v-bind` directives
- [vue/prefer-template](https://lintradar.dev/rules/vue/prefer-template.md): Require template literals instead of string concatenation in `<template>`
- [vue/no-unused-refs](https://lintradar.dev/rules/vue/no-unused-refs.md): Disallow unused refs
- [vue/array-bracket-spacing](https://lintradar.dev/rules/vue/array-bracket-spacing.md): Enforce consistent spacing inside array brackets in `<template>`
- [vue/no-sparse-arrays](https://lintradar.dev/rules/vue/no-sparse-arrays.md): Disallow sparse arrays in `<template>`

---

Web page: https://lintradar.dev/rules/vue/object-shorthand. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
