-
-
Notifications
You must be signed in to change notification settings - Fork 681
Add new vue/no-arrow-functions-in-watch
rule
#1155
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
Add new vue/no-arrow-functions-in-watch
rule
#1155
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR!
I have some requests.
'e.f': function (val, oldVal) { /* ... */ } | ||
} | ||
}`, | ||
errors: ['You should not use an arrow function to define a watcher.'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you check the location with some test cases?
errors: ['You should not use an arrow function to define a watcher.'] | |
errors: [ | |
{ | |
message: 'You should not use an arrow function to define a watcher.', | |
line: ? | |
} | |
] |
return | ||
} | ||
for (const property of watchValue.properties) { | ||
if (property.value.type === 'ArrowFunctionExpression') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you check type
is a "Property"
?
Probably get an error with "SpreadElement".
https://github.com/estree/estree/blob/master/es2015.md#expressions
https://github.com/estree/estree/blob/master/es2018.md#expressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your quick response! Looks good to me!
Fixes #1113
If this rules should be categorized please let me know