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
Fix no-this-in-sfc
rule behavior for arrow functions inside a class field
#1989
Fix no-this-in-sfc
rule behavior for arrow functions inside a class field
#1989
Conversation
lib/util/Components.js
Outdated
scope = scope.upper; | ||
while (scope) { | ||
const type = scope.block.type; | ||
if (type === 'FunctionExpression' || type === 'FunctionExpression') { |
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.
Is this meant to be checking the same thing twice?
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.
good catch, it should be FunctionExpression
and FunctionDeclaration
Fixed typo and added one more more test. |
I don't see any tests of function declarations tho (arrows are only ever expressions) |
@ljharb A parent scope of arrow function can have |
Fixed #1967. Adjusted component detection in
getParentStatelessComponent
for arrow functions inside a class field, e.g.:See details in #1972.