Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/rules/no-unused-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const isReactReduxConnect = require('../isReactReduxConnect');

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

const belongsToReduxReact = (node, objectName, destrArg) => {
const belongsToReduxReact = (node, objectName, destrArg, context) => {
const checkProp = (secondArgument) => {
const secondArgumentName = secondArgument && secondArgument.type === 'Identifier' && secondArgument.name;
return (secondArgumentName === objectName // ownProps.myProp
Expand Down Expand Up @@ -57,14 +57,14 @@ const propsUsedInRedux = function (context) {
MemberExpression(node) {
const nodeName = node.object.name;
const usedInReactRedux = context.getSourceCode().getAncestors(node)
.some(ancestor => belongsToReduxReact(ancestor, nodeName));
.some(ancestor => belongsToReduxReact(ancestor, nodeName, null, context));
if (usedInReactRedux) {
context.report(node, `exclude:${node.property.name}`);
}
},
ObjectPattern(node) {
const usedInReactRedux = context.getSourceCode().getAncestors(node)
.some(ancestor => belongsToReduxReact(ancestor, null, node));
.some(ancestor => belongsToReduxReact(ancestor, null, node, context));
if (usedInReactRedux) {
node.properties.forEach((prop) => {
if (prop.type === 'Property' && prop.key && prop.key.name) {
Expand Down