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

react-magnetic-di

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-magnetic-di - npm Package Compare versions

Comparing version 2.3.0 to 2.3.1

20

lib/cjs/eslint/rules/exhaustive-inject.js

@@ -59,2 +59,6 @@ "use strict";

var reactVars;
var currentComponentStack = [];
var isRecursiveComponent = function isRecursiveComponent(node) {
return currentComponentStack.includes(node.name);
};
var userOptions = Object.assign({

@@ -102,2 +106,14 @@ ignore: []

},
FunctionDeclaration: function FunctionDeclaration(node) {
if (node.id && node.id.name) currentComponentStack.push(node.id.name);
},
'FunctionDeclaration:exit': function FunctionDeclarationExit(node) {
if (node.id && node.id.name) currentComponentStack.pop();
},
VariableDeclarator: function VariableDeclarator(node) {
if (node.id && node.id.name) currentComponentStack.push(node.id.name);
},
'VariableDeclarator:exit': function VariableDeclaratorExit(node) {
if (node.id && node.id.name) currentComponentStack.pop();
},
// this is to handle hooks and components recognised as used variables

@@ -118,3 +134,3 @@ // it does not cover JSX variables

var isInjectable = isHookName(varNode);
if (!isInjectable || isInjected(diVars, varNode) || isReactIgnored(varNode) || isOptionsIgnored(varNode) || isLocalVariable(varNode, context.getScope()) || isDefaultProp(varNode, diStatements[0])) return;
if (!isInjectable || isInjected(diVars, varNode) || isReactIgnored(varNode) || isOptionsIgnored(varNode) || isLocalVariable(varNode, context.getScope()) || isDefaultProp(varNode, diStatements[0]) || isRecursiveComponent(varNode)) return;
report(varNode, diStatements[diStatements.length - 1]);

@@ -136,3 +152,3 @@ });

var isInjectable = isComponentName(varNode);
if (!isInjectable || isReactIgnored(varNode) || isOptionsIgnored(varNode)) return;
if (!isInjectable || isReactIgnored(varNode) || isOptionsIgnored(varNode) || isRecursiveComponent(varNode)) return;
break;

@@ -139,0 +155,0 @@ }

@@ -48,2 +48,4 @@ const {

let reactVars;
let currentComponentStack = [];
const isRecursiveComponent = node => currentComponentStack.includes(node.name);
const userOptions = Object.assign({

@@ -79,2 +81,14 @@ ignore: []

},
FunctionDeclaration(node) {
if (node.id && node.id.name) currentComponentStack.push(node.id.name);
},
'FunctionDeclaration:exit'(node) {
if (node.id && node.id.name) currentComponentStack.pop();
},
VariableDeclarator(node) {
if (node.id && node.id.name) currentComponentStack.push(node.id.name);
},
'VariableDeclarator:exit'(node) {
if (node.id && node.id.name) currentComponentStack.pop();
},
// this is to handle hooks and components recognised as used variables

@@ -91,3 +105,3 @@ // it does not cover JSX variables

const isInjectable = isHookName(varNode);
if (!isInjectable || isInjected(diVars, varNode) || isReactIgnored(varNode) || isOptionsIgnored(varNode) || isLocalVariable(varNode, context.getScope()) || isDefaultProp(varNode, diStatements[0])) return;
if (!isInjectable || isInjected(diVars, varNode) || isReactIgnored(varNode) || isOptionsIgnored(varNode) || isLocalVariable(varNode, context.getScope()) || isDefaultProp(varNode, diStatements[0]) || isRecursiveComponent(varNode)) return;
report(varNode, diStatements[diStatements.length - 1]);

@@ -109,3 +123,3 @@ });

const isInjectable = isComponentName(varNode);
if (!isInjectable || isReactIgnored(varNode) || isOptionsIgnored(varNode)) return;
if (!isInjectable || isReactIgnored(varNode) || isOptionsIgnored(varNode) || isRecursiveComponent(varNode)) return;
break;

@@ -112,0 +126,0 @@ }

2

package.json
{
"name": "react-magnetic-di",
"version": "2.3.0",
"version": "2.3.1",
"description": "Context driven dependency injection",

@@ -5,0 +5,0 @@ "keywords": [

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