vue/multiline-ternary
eslint-plugin-vue
Safe autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/multiline-ternary": "error",
},
},
]; <div :class="isEnabled ? 'check' : 'stop'" />
</div>
</template>
<style>
div {
/* ✓ GOOD */
color: v-bind('myFlag
? foo
: bar');
/* ✗ BAD */
color: v-bind('myFlag ? foo : bar');
}
</style><div :class="isEnabled
? 'check'
: 'stop'" />Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
vue/multiline-ternary
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/multiline-ternary": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce newlines between operands of ternary expressions
Enforce new lines between multi-line properties in Vue components