🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

eslint-plugin-react-func

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-react-func - npm Package Compare versions

Comparing version

to
0.1.17

31

lib/rules/max-lines-per-function.js

@@ -165,14 +165,6 @@ /**

function checkIsJSXElement(item) {
const type = lodash.get(item, 'argument.type');
let isContainJSXElement = isContainJSX(type);
function checkIsJSXElement(node) {
const functionText = sourceCode.getText(node) || '';
if (type === 'ConditionalExpression') {
const consequentType = lodash.get(item, 'argument.consequent.type');
const alternateType = lodash.get(item, 'argument.alternate.type');
if (isContainJSX(consequentType) || isContainJSX(alternateType)) isContainJSXElement = true;
}
return isContainJSXElement;
return (functionText.includes('<') && (functionText.includes('/>') || functionText.includes('</')));
}

@@ -184,13 +176,3 @@

function getFunctionBodyRecursively(node) {
const body = lodash.get(node, 'body.body', []);
const isValidBody = Array.isArray(body);
const isNestBody = !isValidBody && typeof body === 'object';
if (isValidBody) return body;
if (isNestBody) return getFunctionBodyRecursively(body);
}
function isReactEle(node) {
const body = getFunctionBodyRecursively(node);
const bodyType = lodash.get(node, 'body.type', '');

@@ -201,3 +183,3 @@ const keyName = lodash.get(node, 'key.name', '');

const isClassComponent = keyName === 'render';
const isJSXElement = isContainJSX(bodyType) || body.some(checkIsJSXElement);
const isJSXElement = isContainJSX(bodyType) || checkIsJSXElement(node);
const isCustomHook = checkIsCustomHook(functionName) || checkIsCustomHook(parentName);

@@ -296,7 +278,8 @@

}
lineCount++;
}
lineCount = lineCount - argumentsLineNum;
const baseFunctionLineNum = 2
lineCount = lineCount - argumentsLineNum - baseFunctionLineNum;

@@ -303,0 +286,0 @@ const isOverLength = lineCount > maxLines;

{
"name": "eslint-plugin-react-func",
"version": "0.1.16",
"version": "0.1.17",
"description": "max lines per function for react",

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