Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-react

Package Overview
Dependencies
Maintainers
2
Versions
213
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-react - npm Package Compare versions

Comparing version 7.12.3 to 7.12.4

9

lib/rules/prop-types.js

@@ -166,8 +166,9 @@ /**

function reportUndeclaredPropTypes(component) {
let allNames;
for (let i = 0, j = component.usedPropTypes.length; i < j; i++) {
allNames = component.usedPropTypes[i].allNames;
const allNames = component.usedPropTypes[i].allNames;
const node = component.usedPropTypes[i].node;
if (
isIgnored(allNames[0]) ||
isDeclaredInComponent(component.node, allNames)
isDeclaredInComponent(component.node, allNames) ||
!node
) {

@@ -177,3 +178,3 @@ continue;

context.report(
component.usedPropTypes[i].node,
node,
MISSING_MESSAGE, {

@@ -180,0 +181,0 @@ name: allNames.join('.').replace(/\.__COMPUTED_PROP__/g, '[]')

@@ -21,9 +21,17 @@ /**

let i = bodyNodes.length - 1;
for (; i >= 0; i--) {
if (bodyNodes[i].type === 'ReturnStatement') {
return bodyNodes[i];
return (function loopNodes(nodes) {
let i = nodes.length - 1;
for (; i >= 0; i--) {
if (nodes[i].type === 'ReturnStatement') {
return nodes[i];
}
if (nodes[i].type === 'SwitchStatement') {
let j = nodes[i].cases.length - 1;
for (; j >= 0; j--) {
return loopNodes(nodes[i].cases[j].consequent);
}
}
}
}
return false;
return false;
}(bodyNodes));
}

@@ -30,0 +38,0 @@

@@ -404,4 +404,4 @@ /**

const calleeObject = node.callee.object;
if (calleeObject) {
return arrayIncludes(propertyNames, node.callee.property.name) && node.callee.object.name === pragma;
if (calleeObject && node.callee.property) {
return arrayIncludes(propertyNames, node.callee.property.name) && calleeObject.name === pragma;
}

@@ -571,3 +571,3 @@ return arrayIncludes(propertyNames, node.callee.name) && this.isDestructuredFromPragmaImport(node.callee.name);

componentNode = refId.parent.right;
} else if (refId.parent && refId.parent.type === 'VariableDeclarator') {
} else if (refId.parent && refId.parent.type === 'VariableDeclarator' && refId.parent.init.type !== 'Identifier') {
componentNode = refId.parent.init;

@@ -574,0 +574,0 @@ }

@@ -11,2 +11,5 @@ /**

function isPropWrapperFunction(context, name) {
if (typeof name !== 'string') {
return false;
}
const propWrapperFunctions = getPropWrapperFunctions(context);

@@ -13,0 +16,0 @@ const splitName = name.split('.');

{
"name": "eslint-plugin-react",
"version": "7.12.3",
"version": "7.12.4",
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>",

@@ -41,2 +41,3 @@ "description": "React specific linting rules for ESLint",

"mocha": "^5.2.0",
"sinon": "^7.2.2",
"typescript": "^3.2.2",

@@ -43,0 +44,0 @@ "typescript-eslint-parser": "^20.1.1"

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc