🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

eslint-plugin-react

Package Overview
Dependencies
Maintainers
2
Versions
216
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.37.4
to
7.37.5
+1
-1
lib/rules/jsx-no-constructed-context-values.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"jsx-no-constructed-context-values.d.ts","sourceRoot":"","sources":["jsx-no-constructed-context-values.js"],"names":[],"mappings":"wBAoIW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU"}
{"version":3,"file":"jsx-no-constructed-context-values.d.ts","sourceRoot":"","sources":["jsx-no-constructed-context-values.js"],"names":[],"mappings":"wBA2KW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU"}

@@ -122,2 +122,41 @@ /**

function isReactContext(context, node) {
let scope = getScope(context, node);
let variableScoping = null;
const contextName = node.name;
while (scope && !variableScoping) { // Walk up the scope chain to find the variable
variableScoping = scope.set.get(contextName);
scope = scope.upper;
}
if (!variableScoping) { // Context was not found in scope
return false;
}
// Get the variable's definition
const def = variableScoping.defs[0];
if (!def || def.node.type !== 'VariableDeclarator') {
return false;
}
const init = def.node.init; // Variable initializer
const isCreateContext = init
&& init.type === 'CallExpression'
&& (
(
init.callee.type === 'Identifier'
&& init.callee.name === 'createContext'
) || (
init.callee.type === 'MemberExpression'
&& init.callee.object.name === 'React'
&& init.callee.property.name === 'createContext'
)
);
return isCreateContext;
}
// ------------------------------------------------------------------------------

@@ -152,10 +191,16 @@ // Rule Definition

const openingElementName = node.name;
if (openingElementName.type !== 'JSXMemberExpression') {
// Has no member
return;
}
const isJsxContext = openingElementName.property.name === 'Provider';
if (!isJsxContext) {
// Member is not Provider
if (openingElementName.type === 'JSXMemberExpression') {
const isJSXContext = openingElementName.property.name === 'Provider';
if (!isJSXContext) {
// Member is not Provider
return;
}
} else if (openingElementName.type === 'JSXIdentifier') {
const isJSXContext = isReactContext(context, openingElementName);
if (!isJSXContext) {
// Member is not context
return;
}
} else {
return;

@@ -162,0 +207,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"no-unknown-property.d.ts","sourceRoot":"","sources":["no-unknown-property.js"],"names":[],"mappings":"wBAihBW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU"}
{"version":3,"file":"no-unknown-property.d.ts","sourceRoot":"","sources":["no-unknown-property.js"],"names":[],"mappings":"wBAshBW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU"}

@@ -121,2 +121,7 @@ /**

webkitDirectory: ['input'],
shadowrootmode: ['template'],
shadowrootclonable: ['template'],
shadowrootdelegatesfocus: ['template'],
shadowrootserializable: ['template'],
'transform-origin': ['rect'],
};

@@ -123,0 +128,0 @@

@@ -1,1 +0,1 @@

{"version":3,"file":"propTypes.d.ts","sourceRoot":"","sources":["propTypes.js"],"names":[],"mappings":"AAoGiB;;;;;;;gCAy6BJ,OAAO,YAEP,OAAO;oCAFP,OAAO,YAEP,OAAO;;;;;;;;;EAqQnB"}
{"version":3,"file":"propTypes.d.ts","sourceRoot":"","sources":["propTypes.js"],"names":[],"mappings":"AAoGiB;;;;;;;gCA06BJ,OAAO,YAEP,OAAO;oCAFP,OAAO,YAEP,OAAO;;;;;;;;;EAqQnB"}

@@ -110,5 +110,6 @@ /**

const customValidators = configuration.customValidators;
const allowedGenericTypes = new Set(['ComponentProps', 'ComponentPropsWithoutRef', 'forwardRef', 'ForwardRefRenderFunction', 'VFC', 'VoidFunctionComponent', 'PropsWithChildren', 'SFC', 'StatelessComponent', 'FunctionComponent', 'FC']);
const allowedGenericTypes = new Set(['ComponentProps', 'ComponentPropsWithRef', 'ComponentPropsWithoutRef', 'forwardRef', 'ForwardRefRenderFunction', 'VFC', 'VoidFunctionComponent', 'PropsWithChildren', 'SFC', 'StatelessComponent', 'FunctionComponent', 'FC']);
const genericTypeParamIndexWherePropsArePresent = {
ComponentProps: 0,
ComponentPropsWithRef: 0,
ComponentPropsWithoutRef: 0,

@@ -115,0 +116,0 @@ ForwardRefRenderFunction: 1,

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

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

"minimatch": "^3.1.2",
"object.entries": "^1.1.8",
"object.entries": "^1.1.9",
"object.fromentries": "^2.0.8",

@@ -60,4 +60,4 @@ "object.values": "^1.2.1",

"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.26.5",
"@babel/core": "^7.26.10",
"@babel/eslint-parser": "^7.27.0",
"@babel/plugin-syntax-decorators": "^7.25.9",

@@ -64,0 +64,0 @@ "@babel/plugin-syntax-do-expressions": "^7.25.9",