pageClass | sidebarDepth | title | description |
---|---|---|---|
rule-details |
0 |
vue/padding-lines-in-component-definition |
require or disallow padding lines in component definition |
require or disallow padding lines in component definition
- ❗ This rule has not been released yet.
- 🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
This rule requires or disallows blank lines in the component definition. Properly blank lines help developers improve code readability and code style flexibility.
<script>
/* ✗ BAD */
export default {
props: {
modelValue: {
type: String,
default: '',
},
},
data() {
return {
count: 0,
};
}
}
</script>
<script>
/* ✓ GOOD */
export default {
props: {
modelValue: {
type: String,
default: '',
},
},
data() {
return {
count: 0,
};
}
}
</script>
{
"vue/padding-lines-in-component-definition": ["error", {
"betweenOptions": "always" | "never",
"withinOption": {
"props": {
"betweenItems": "always" | "never" | "ignore",
"withinEach": "always" | "never" | "ignore",
} | "always" | "never" | "ignore", // shortcut to set both
"data": {
"betweenItems": "always" | "never" | "ignore",
"withinEach": "always" | "never" | "ignore",
} | "always" | "never" | "ignore" // shortcut to set both
// ... all options
} | "always" | "never" | "ignore",
"groupSingleLineProperties": true | false
}]
}
betweenOptions
... Setting padding lines between options. defaultalways
withinOption
... Setting padding lines within optionemits
... Setting padding between lines betweenemits
anddefineEmits
. defaultalways
props
... Setting padding between lines betweenprops
anddefineProps
. defaultalways
- ...
groupSingleLineProperties
... Setting groupings of multiple consecutive single-line properties (e.g.name
,inheritAttrs
), defaulttrue
<script>
export default {
name: 'GroupSingleLineProperties',
inheritAttrs: false,
props: {
modelValue: {
type: String,
default: '',
},
},
data() {
return {
count: 0,
};
}
}
</script>
<script>
export default {
props: {
modelValue: {
type: String,
default: '',
},
isActive: {
type: Boolean,
default: false,
},
},
customOption: {
foo: () => {
return 'foo'
},
bar: () => {
return 'bar'
}
},
}
</script>