Skip to content

Commit ef696e1

Browse files
committed
fix: fix DianaSuvorova#104 ReferenceError: context is not defined
Signed-off-by: koooge <[email protected]>
1 parent 55b9b31 commit ef696e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/rules/no-unused-prop-types.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const isReactReduxConnect = require('../isReactReduxConnect');
55

66
const noUnusedPropTypesReact = require('eslint-plugin-react').rules['no-unused-prop-types'];
77

8-
const belongsToReduxReact = (node, objectName, destrArg) => {
8+
const belongsToReduxReact = (node, objectName, destrArg, context) => {
99
const checkProp = (secondArgument) => {
1010
const secondArgumentName = secondArgument && secondArgument.type === 'Identifier' && secondArgument.name;
1111
return (secondArgumentName === objectName // ownProps.myProp
@@ -57,14 +57,14 @@ const propsUsedInRedux = function (context) {
5757
MemberExpression(node) {
5858
const nodeName = node.object.name;
5959
const usedInReactRedux = context.getSourceCode().getAncestors(node)
60-
.some(ancestor => belongsToReduxReact(ancestor, nodeName));
60+
.some(ancestor => belongsToReduxReact(ancestor, nodeName, null, context));
6161
if (usedInReactRedux) {
6262
context.report(node, `exclude:${node.property.name}`);
6363
}
6464
},
6565
ObjectPattern(node) {
6666
const usedInReactRedux = context.getSourceCode().getAncestors(node)
67-
.some(ancestor => belongsToReduxReact(ancestor, null, node));
67+
.some(ancestor => belongsToReduxReact(ancestor, null, node, context));
6868
if (usedInReactRedux) {
6969
node.properties.forEach((prop) => {
7070
if (prop.type === 'Property' && prop.key && prop.key.name) {

0 commit comments

Comments
 (0)