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.0-next.0 to 2.1.0-next.1

.eslintplugin.js

2

lib/cjs/eslint/index.js

@@ -9,3 +9,3 @@ "use strict";

var noExtraneous = require('./rules/extraneous');
var noExtraneous = require('./rules/no-extraneous');

@@ -12,0 +12,0 @@ module.exports = {

@@ -24,2 +24,7 @@ "use strict";

type: 'suggestion',
docs: {
description: 'Requires external components/hooks to be marked as injectable',
category: 'Best Practices',
recommended: false
},
fixable: 'code',

@@ -39,3 +44,3 @@ schema: [{

messages: {
missingInject: "di(...) has a missing dependency: '{{name}}'. " + 'Either include it or remove the dependency injection call'
missingInject: "Dependency '{{name}}' has not being marked as injectable. " + 'Add it to the list of the injectable dependencies'
}

@@ -99,3 +104,3 @@ },

throughVars.forEach(function (varNode) {
var isInjectable = isHookName(varNode) || isComponentName(varNode);
var isInjectable = isHookName(varNode);
if (!isInjectable || isInjected(diVars, varNode) || isReactIgnored(varNode) || isOptionsIgnored(varNode)) return;

@@ -102,0 +107,0 @@ report(varNode, diStatements[diStatements.length - 1]);

@@ -11,2 +11,7 @@ "use strict";

type: 'problem',
docs: {
description: 'Disallow dependencies to be marked as injectable more than once',
category: 'Possible Errors',
recommended: true
},
// fixable: 'code',

@@ -13,0 +18,0 @@ schema: [],

@@ -12,2 +12,7 @@ "use strict";

type: 'suggestion',
docs: {
description: 'Disallow injecting dependencies not being used',
category: 'Possible Errors',
recommended: true
},
// fixable: 'code',

@@ -27,3 +32,3 @@ schema: [{

messages: {
extraneousInjectable: "di(...) has an extraneous dependency: '{{name}}'. " + 'If it is not being used, remove it from the injectable list'
extraneousInjectable: "Extraneous dependency: '{{name}}'. " + 'If it is not being used, remove it from the injectable list'
}

@@ -93,6 +98,9 @@ },

var parentBlock = getParentDiBlock(varNode, diIdentifier);
blockReferences.get(parentBlock).through.push(varNode);
var blockVars = blockReferences.get(parentBlock);
if (!blockVars) return;
blockVars.through.push(varNode);
},
'BlockStatement:exit': function BlockStatementExit(node) {
var blockVars = blockReferences.get(node);
if (!blockVars) return;
blockVars.di.forEach(function (varNode) {

@@ -99,0 +107,0 @@ var occurrences = blockVars.through.filter(function (v) {

@@ -10,2 +10,7 @@ "use strict";

type: 'problem',
docs: {
description: 'Enforce injectable definition at the top of the block',
category: 'Possible Errors',
recommended: true
},
// fixable: 'code',

@@ -12,0 +17,0 @@ schema: [],

@@ -7,3 +7,3 @@ var order = require('./rules/order');

var noExtraneous = require('./rules/extraneous');
var noExtraneous = require('./rules/no-extraneous');

@@ -10,0 +10,0 @@ module.exports = {

@@ -22,2 +22,7 @@ var _require = require('../utils'),

type: 'suggestion',
docs: {
description: 'Requires external components/hooks to be marked as injectable',
category: 'Best Practices',
recommended: false
},
fixable: 'code',

@@ -37,3 +42,3 @@ schema: [{

messages: {
missingInject: "di(...) has a missing dependency: '{{name}}'. " + 'Either include it or remove the dependency injection call'
missingInject: "Dependency '{{name}}' has not being marked as injectable. " + 'Add it to the list of the injectable dependencies'
}

@@ -97,3 +102,3 @@ },

throughVars.forEach(function (varNode) {
var isInjectable = isHookName(varNode) || isComponentName(varNode);
var isInjectable = isHookName(varNode);
if (!isInjectable || isInjected(diVars, varNode) || isReactIgnored(varNode) || isOptionsIgnored(varNode)) return;

@@ -100,0 +105,0 @@ report(varNode, diStatements[diStatements.length - 1]);

@@ -9,2 +9,7 @@ var _require = require('../utils'),

type: 'problem',
docs: {
description: 'Disallow dependencies to be marked as injectable more than once',
category: 'Possible Errors',
recommended: true
},
// fixable: 'code',

@@ -11,0 +16,0 @@ schema: [],

@@ -10,2 +10,7 @@ var _require = require('../utils'),

type: 'suggestion',
docs: {
description: 'Disallow injecting dependencies not being used',
category: 'Possible Errors',
recommended: true
},
// fixable: 'code',

@@ -25,3 +30,3 @@ schema: [{

messages: {
extraneousInjectable: "di(...) has an extraneous dependency: '{{name}}'. " + 'If it is not being used, remove it from the injectable list'
extraneousInjectable: "Extraneous dependency: '{{name}}'. " + 'If it is not being used, remove it from the injectable list'
}

@@ -91,6 +96,9 @@ },

var parentBlock = getParentDiBlock(varNode, diIdentifier);
blockReferences.get(parentBlock).through.push(varNode);
var blockVars = blockReferences.get(parentBlock);
if (!blockVars) return;
blockVars.through.push(varNode);
},
'BlockStatement:exit': function BlockStatementExit(node) {
var blockVars = blockReferences.get(node);
if (!blockVars) return;
blockVars.di.forEach(function (varNode) {

@@ -97,0 +105,0 @@ var occurrences = blockVars.through.filter(function (v) {

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

type: 'problem',
docs: {
description: 'Enforce injectable definition at the top of the block',
category: 'Possible Errors',
recommended: true
},
// fixable: 'code',

@@ -10,0 +15,0 @@ schema: [],

{
"name": "react-magnetic-di",
"version": "2.1.0-next.0",
"version": "2.1.0-next.1",
"description": "Context driven dependency injection",

@@ -71,2 +71,3 @@ "keywords": [

"eslint-plugin-import": "^2.20.2",
"eslint-plugin-local": "^1.0.0",
"eslint-plugin-react": "^7.20.0",

@@ -73,0 +74,0 @@ "eslint-plugin-react-hooks": "^4.0.4",

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