JS.VUE.NEW.LINE.BETWEEN.MULTI.LINE.PROPERTY

Enforce new lines between multi-line properties in Vue components

Rule Details

This rule aims at enforcing new lines between multi-line properties in Vue components to help readability

{'vue/new-line-between-multi-line-property': ['error']}

Copy
<script>
/* BAD */
export default {
  props: {
    value: {
      type: String,
      required: true
    },
    focused: {
      type: Boolean,
      default: false,
      required: true
    },

    label: String,
    icon: String
  },
  computed: {

  }
}
</script>

{'vue/new-line-between-multi-line-property': ['error']}

Copy
<script>
/* GOOD */
export default {
  props: {
    value: {
      type: String,
      required: true
    },

    focused: {
      type: Boolean,
      default: false,
      required: true
    },

    label: String,
    icon: String
  },

  computed: {

  }
}
</script>

Options

Copy
{
  "vue/new-line-between-multi-line-property": ["error", {
    "minLineOfMultilineProperty": 2
  }]
}
  • minLineOfMultilineProperty ... Define the minimum number of rows for a multi-line property. default 2

Further Reading

  • Style guide - Empty lines in component/instance options (https://vuejs.org/style-guide/rules-recommended.html#empty-lines-in-component-instance-options)

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/