-
-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supports for Vue.js 3.x #1035
Comments
/cc @vuejs/docs I think these changes are also to be addressed in the new style guide. |
I think a |
Some rules I had in mind:
|
@sodatea @yyx990803 Thank you for your comments! I have added new rules to the list. |
@michalsnik @mysticatea Could you comment on this issue if you have any feedback? |
Hi! Thanks @ota-meshi @sodatea @yyx990803 for the work done with this plugin. Will we be adding any rules for when consumers try to access refs in the template through |
@codebender828 that's a good one, although a user may very well have an object with |
I have a question about
|
Note that custom modifiers are only supported for |
@przemkow Thank you for your comment. And thank you for your contribution. |
Thank you for the clarification @yyx990803 🙂 I updated previously created PR ( #1039 ) so now it handles both RFC0005 and RFC0011. |
@ota-meshi |
@przemkow I think it needs to be added as you say. |
what about |
I was thinking of adding something similar to |
Hi @chiptus @victorgarciaesgi. Sorry for the late reply. |
@ota-meshi Sure! Consider this code in React export function Component() {
const isMobile = useMedia({ maxWidth: '768px' })
useEffect(() => {
if (isMobile) {
console.log(isMobile)
}
})
return <div>{isMobile}</div>
} With the rule useEffect(() => {
if (isMobile) {
console.log(isMobile)
}
}, [isMobile]) In Vue3 we can have the same thing but for the return statement in setup export default defineComponent({
setup(props, ctx) {
const search = ref('')
}
}) Will become: export default defineComponent({
setup(props, ctx) {
const search = ref('')
return {search}
}
}) |
I'm not too sure about this. I'm pretty sure we will rather often have state in setup that doesn't have to be exposed to the template. |
@LinusBorg Yeah i thought of that too, maybe complete the return statement with only values present in the template? |
Does we need about |
We also need a |
Hi @sodatea. I haven't used the |
Yeah, it can be used in SFC. |
I did not know that. Thank you! |
Per RFC0007, I think a I just found out that the Per RFC0027, we need a new rule to restrict the |
The |
@sodatea Thank you for suggesting the rules and changes. |
Thanks! |
Currently this plugin has finished implementing most of the rules defined in this issue. Open the remaining issue with another and close this issue. If you would like to propose a new rule, please open a new issue. |
@ota-meshi thanks for the hard work! |
In this issue, I will list the Vue.js 3.x changes that need to be supported by
eslint-plugin-vue
.vue/valid-template-root
to allow multiple root nodes.vue/no-multiple-template-root
rule that disallows multiple root nodes (for Vue 2).v-bind
's.sync
modifier and replacing it with an argument onv-model
. RFC0005vue/valid-v-model
to allows argument (component only).vue/no-v-model-argument
rule that disallows argument (for Vue 2).vue/no-deprecated-v-bind-sync
rule that disallowsv-bind.sync
.vue/no-deprecated-functional-template
rule #1119 Addvue/no-deprecated-functional-template
rule that disallows<template functional>
.app.component
andapp.mixin
toutils/index.isVueComponent
.v-model
API changes RFC0011vue/valid-v-model
rule to provide support for custom modifiers. Supports for Vue.js 3.x #1035 (comment)vue/no-custom-modifiers-on-v-model
rule to checks if v-model does not contain custom modifiers (Vue 2 backward compatibility) Supports for Vue.js 3.x #1035 (comment)setup
property tovue/order-in-components
rule.vue/no-ref-as-operand
rule #1065 Addvue/no-ref-as-operand
rule. Supports for Vue.js 3.x #1035 (comment)vue/no-watch-after-await
rule #1068 Addvue/no-watch-after-await
rule. Supports for Vue.js 3.x #1035 (comment)vue/no-lifecycle-after-await
rule #1067 Addvue/no-lifecycle-after-await
rule. Supports for Vue.js 3.x #1035 (comment)vue/no-setup-props-destructure
rule #1066 Addvue/no-setup-props-destructure
rule. Supports for Vue.js 3.x #1035 (comment)vue/no-dupe-keys
rule andvue/no-reserved-keys
to handlesetup
.vue/no-deprecated-v-on-number-modifiers
rule #1079 Addvue/no-deprecated-v-on-number-modifiers
rule that disallows numbers asv-on
modifiers.vue/no-deprecated-vue-config-keycodes
rule #1118 Addvue/no-deprecated-vue-config-keycodes
rule that disallowsVue.config.keyCodes
.vue/no-deprecated-filter
rule that disallows Vue2 filter.inline-template
. RFC0016vue/no-deprecated-inline-template
rule #1100 Addvue/no-deprecated-inline-template
rule that disallowinline-template
attributtes.<transition>
as component's root will no longer trigger transitions when the component is toggled from the outside.. RFC0017vue/require-v-if-inside-transition
rule #1099 Addvue/require-v-if-inside-transition
rule that checks whether expose a boolean prop to control the presence of content inside<transition>
. e.gv-if
,v-show
. Supports for Vue.js 3.x #1035 (comment)data
RFC0019vue/no-deprecated-data-object-declaration
rule #1083 Addvue/no-deprecated-data-object-declaration
rule$on
,$off
and$once
instance methods RFC0020vue/no-deprecated-events-api
rule #1097 Addvue/no-deprecated-events-api
rulevue/no-deprecated-html-element-is
rule #1117 Addvue/no-deprecated-html-element-is
rule that disallow theis
attribute on HTML elements.emits
property tovue/order-in-components
rule.vue/require-explicit-emits
rule #1124 Addvue/require-explicit-emits
rule that requires the emits option to have a name called by$emit()
.vue/return-in-emits-validator
rule #1129 Addvue/return-in-emits-validator
rule enforces that a return statement is present in emits validator.vue/no-deprecated-v-on-native-modifier
rule #1130 Addvue/no-deprecated-v-on-native-modifier
rule that disallow.native
modifier onv-on
.vue/no-deprecated-dollar-listeners-api
rule #1133 Addvue/no-deprecated-dollar-listeners-api
rule that disallow$listeners
.List the changes after #1036 was merged.
essential
for Vue 3vue/no-deprecated-filter
rule.vue/no-deprecated-v-bind-sync
rule.vue/no-deprecated-v-on-number-modifiers
rule #1079 Addvue/no-deprecated-v-on-number-modifiers
rule.vue/no-deprecated-data-object-declaration
rule #1083 Addvue/no-deprecated-data-object-declaration
rulevue/no-deprecated-events-api
rule #1097 Addvue/no-deprecated-events-api
rulevue/no-deprecated-inline-template
rule #1100 Addvue/no-deprecated-inline-template
rulevue/require-v-if-inside-transition
rule #1099 Addvue/require-v-if-inside-transition
rule.vue/no-ref-as-operand
rule.vue/no-watch-after-await
rule #1068 Addvue/no-watch-after-await
rule.vue/no-lifecycle-after-await
rule.vue/no-setup-props-destructure
rule.vue/no-deprecated-scope-attribute
rule.vue/no-deprecated-slot-attribute
rule.vue/no-deprecated-slot-scope-attribute
rule.vue/valid-v-bind-sync
rule.vue/no-deprecated-functional-template
rule #1119 Addvue/no-deprecated-functional-template
rule.vue/no-deprecated-html-element-is
rule #1117 Addvue/no-deprecated-html-element-is
rule.vue/no-deprecated-vue-config-keycodes
rule #1118 Addvue/no-deprecated-vue-config-keycodes
rule.vue/no-deprecated-v-on-native-modifier
rule #1130 Addvue/no-deprecated-v-on-native-modifier
rule.vue/no-deprecated-dollar-listeners-api
rule #1133 Addvue/no-deprecated-dollar-listeners
rule.vue/return-in-emits-validator
rule #1129 Addvue/return-in-emits-validator
rule.strongly-recommended
for Vue 3recommended
for Vue 3essential
for Vue 2vue/no-multiple-template-root
rule.vue/no-v-model-argument
rule.vue/no-custom-modifiers-on-v-model
rule.strongly-recommended
for Vue 2recommended
for Vue 2refs
https://medium.com/the-vue-point/plans-for-the-next-iteration-of-vue-js-777ffea6fabf
https://github.com/vuejs/rfcs/pulls?utf8=%E2%9C%93&q=is%3Apr+label%3A3.x+
https://vueschool.io/articles/vuejs-tutorials/exciting-new-features-in-vue-3/
https://vue-composition-api-rfc.netlify.com/
The text was updated successfully, but these errors were encountered: