vue/object-shorthand
eslint-plugin-vue
Safe autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/object-shorthand": "error",
},
},
];Require or disallow method and property shorthand syntax for object literals in <template>
let foo = 1;
let invalid = {
foo: foo
};let invalid = {
bar: function() { return "bar"; },
};let foo = 1;
let invalid = {
foo
};let foo = 1;
let valid = {
foo,
bar() { return "bar"; },
};let valid = {
baz: function qux() { return "qux"; },
};let foo = 1;
let valid = {
foo: foo,
bar: function() { return "bar"; },
};Examples from the Biome documentation.
vue/object-shorthand
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/object-shorthand": "error",
},
},
];Oxlint does not have this rule.
style/useConsistentObjectDefinitions
style · since 2.0.0
{
"linter": {
"rules": {
"style": {
"useConsistentObjectDefinitions": "error"
}
}
}
}Require or disallow method and property shorthand syntax for object literals
Require template literals instead of string concatenation in <template>
Enforce consistent spacing inside array brackets in <template>