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.1.1 to 2.1.2

15

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

@@ -21,2 +21,8 @@ "use strict";

var isDefaultProp = function isDefaultProp(node, diStatement) {
// we assume order rule is enabled, so if the variable is used in an assignment
// defined before our di() statements, then it's probably default props
return node.parent.type === 'AssignmentPattern' && node.range[0] < diStatement.range[0];
};
module.exports = {

@@ -104,3 +110,3 @@ meta: {

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

@@ -112,3 +118,8 @@ });

'JSXOpeningElement:exit': function JSXOpeningElementExit(node) {
if (!diIdentifier) return;
if (!diIdentifier) return; // ignore if the component is declared locally
var localVars = context.getScope().variables.map(function (v) {
return v.name;
});
if (localVars.includes(node.name.name)) return;
var varNode;

@@ -115,0 +126,0 @@

@@ -19,2 +19,8 @@ var _require = require('../utils'),

var isDefaultProp = function isDefaultProp(node, diStatement) {
// we assume order rule is enabled, so if the variable is used in an assignment
// defined before our di() statements, then it's probably default props
return node.parent.type === 'AssignmentPattern' && node.range[0] < diStatement.range[0];
};
module.exports = {

@@ -102,3 +108,3 @@ meta: {

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

@@ -110,3 +116,8 @@ });

'JSXOpeningElement:exit': function JSXOpeningElementExit(node) {
if (!diIdentifier) return;
if (!diIdentifier) return; // ignore if the component is declared locally
var localVars = context.getScope().variables.map(function (v) {
return v.name;
});
if (localVars.includes(node.name.name)) return;
var varNode;

@@ -113,0 +124,0 @@

2

package.json
{
"name": "react-magnetic-di",
"version": "2.1.1",
"version": "2.1.2",
"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