eslint-plugin-react
Advanced tools
Comparing version 7.20.1 to 7.20.2
@@ -91,29 +91,31 @@ /** | ||
function checkProperties(declarations) { | ||
declarations.forEach((declaration) => { | ||
if (declaration.type !== 'Property') { | ||
return; | ||
} | ||
let target; | ||
let value = declaration.value; | ||
if ( | ||
value.type === 'MemberExpression' | ||
&& value.property | ||
&& value.property.name | ||
&& value.property.name === 'isRequired' | ||
) { | ||
value = value.object; | ||
} | ||
if (value.type === 'CallExpression') { | ||
value.arguments.forEach((arg) => { | ||
reportIfForbidden(arg.name, declaration, target); | ||
}); | ||
value = value.callee; | ||
} | ||
if (value.property) { | ||
target = value.property.name; | ||
} else if (value.type === 'Identifier') { | ||
target = value.name; | ||
} | ||
reportIfForbidden(target, declaration, target); | ||
}); | ||
if (declarations) { | ||
declarations.forEach((declaration) => { | ||
if (declaration.type !== 'Property') { | ||
return; | ||
} | ||
let target; | ||
let value = declaration.value; | ||
if ( | ||
value.type === 'MemberExpression' | ||
&& value.property | ||
&& value.property.name | ||
&& value.property.name === 'isRequired' | ||
) { | ||
value = value.object; | ||
} | ||
if (value.type === 'CallExpression') { | ||
value.arguments.forEach((arg) => { | ||
reportIfForbidden(arg.name, declaration, target); | ||
}); | ||
value = value.callee; | ||
} | ||
if (value.property) { | ||
target = value.property.name; | ||
} else if (value.type === 'Identifier') { | ||
target = value.name; | ||
} | ||
reportIfForbidden(target, declaration, target); | ||
}); | ||
} | ||
} | ||
@@ -120,0 +122,0 @@ |
@@ -175,4 +175,5 @@ /** | ||
const closer = node.type === 'JSXFragment' ? node.closingFragment : node.closingElement; | ||
const childrenText = context.getSourceCode().getText().slice(opener.range[1], closer.range[0]); | ||
const childrenText = opener.selfClosing ? '' : context.getSourceCode().getText().slice(opener.range[1], closer.range[0]); | ||
return fixer.replaceText(node, trimLikeReact(childrenText)); | ||
@@ -179,0 +180,0 @@ }; |
@@ -31,13 +31,13 @@ /** | ||
} | ||
let atLeastOneLowerCase = false; | ||
for (let i = 1; i < name.length; i += 1) { | ||
const char = name.charAt(i); | ||
if (!(char.toLowerCase() !== char.toUpperCase() || testDigit(char))) { | ||
return false; | ||
} | ||
if (!atLeastOneLowerCase) { | ||
atLeastOneLowerCase = testLowerCase(char); | ||
} | ||
const anyNonAlphaNumeric = Array.prototype.some.call( | ||
name.slice(1), | ||
(char) => char.toLowerCase() === char.toUpperCase() && !testDigit(char) | ||
); | ||
if (anyNonAlphaNumeric) { | ||
return false; | ||
} | ||
return atLeastOneLowerCase; | ||
return Array.prototype.some.call( | ||
name.slice(1), | ||
(char) => testLowerCase(char) || testDigit(char) | ||
); | ||
} | ||
@@ -44,0 +44,0 @@ |
@@ -294,2 +294,3 @@ /** | ||
switch (node.type) { | ||
case 'OptionalMemberExpression': | ||
case 'MemberExpression': | ||
@@ -525,3 +526,3 @@ name = getPropertyName(node); | ||
MemberExpression(node) { | ||
'MemberExpression, OptionalMemberExpression'(node) { | ||
if (isPropTypesUsageByMemberExpression(node, context, utils, checkAsyncSafeLifeCycles)) { | ||
@@ -528,0 +529,0 @@ markPropTypesAsUsed(node); |
{ | ||
"name": "eslint-plugin-react", | ||
"version": "7.20.1", | ||
"version": "7.20.2", | ||
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "React specific linting rules for ESLint", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
706339
15202