Skip to content

Add composition-vue2 style in vue/component-api-style #1698

Closed
@FloEdelmann

Description

@FloEdelmann

What rule do you want to change?
vue/component-api-style

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

How will the change be implemented? (New option, new default behavior, etc.)?
New option composition-vue2

Please provide some example code that this change will affect:

const MyComponent = Vue.extend({
	render(h) {
		return h('div');
	},
});

What does the rule currently do for this code?
With configuration "vue/component-api-style": ["error", ["composition"]], it warns about using the render function:

Options API is not allowed in your project. render function is the API of Options API. Use Composition API instead.

What will the rule do after it's changed?
With configuration "vue/component-api-style": ["error", ["composition-vue2"]], it won't warn about using the render function, but still about using computed, methods, etc.

Additional context
Render functions cannot be replaced by returning h(…) from setup in Vue 2 with the Composition API plugin: https://github.com/vuejs/composition-api#template-refs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions