Skip to content

Commit 1a9d54c

Browse files
Fixed typo, added more tests
1 parent c885535 commit 1a9d54c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/util/Components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ function componentRule(rule, context) {
501501
scope = scope.upper;
502502
while (scope) {
503503
const type = scope.block.type;
504-
if (type === 'FunctionExpression' || type === 'FunctionExpression') {
504+
if (type === 'FunctionExpression' || type === 'FunctionDeclaration') {
505505
return scope;
506506
}
507507
scope = scope.upper;

tests/lib/rules/no-this-in-sfc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,12 @@ ruleTester.run('no-this-in-sfc', rule, {
185185
return <div onClick={onClick}>{this.props.foo}</div>;
186186
}`,
187187
errors: [{message: ERROR_MESSAGE}, {message: ERROR_MESSAGE}]
188+
}, {
189+
code: `
190+
() => {
191+
this.something();
192+
return null;
193+
}`,
194+
errors: [{message: ERROR_MESSAGE}]
188195
}]
189196
});

0 commit comments

Comments
 (0)