eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

`vue/new-line-between-multi-line-property`: { onlyComponentOptions: true }

Open inker opened this issue 4 years ago • 4 comments

What rule do you want to change? vue/new-line-between-multi-line-property

Does this change cause the rule to produce more or fewer warnings? fewer

How will the change be implemented? (New option, new default behavior, etc.)? onlyComponentOptions option (default: false)

Please provide some example code that this change will affect:

export default {
  name: 'ComponentName',

  props: {
    foo: String,
    bar: Number, // no error if onlyComponentOptions is true
  },

  created() {
    // ...
  },

  methods: {
    baz() {
      // ...
    },
    qux() {  // no error if onlyComponentOptions is true
      // ...
    },
  },
}

What does the rule currently do for this code? If the rule is on, an error is displayed for adjacent props & methods:

Enforce new lines between multi-line properties in Vue components.

What will the rule do after it's changed? If onlyComponentOptions is set to true, props & method properties will be ignored.

inker avatar Dec 25 '20 22:12 inker

Thank you for proposing an option.

I think the style provide by that option is good. However, there may be users who want to exclude only props in the future. I think it would be better to extends the options a little more, but what do you think?

ota-meshi avatar Dec 27 '20 00:12 ota-meshi

@ota-meshi I think it's a good idea to make it fully configurable.

inker avatar Dec 29 '20 10:12 inker

I wish there was an option to disable it for return statements only

emmanuelvlad avatar Jan 18 '21 16:01 emmanuelvlad