Showing 502 of 700 total issues
Function checkProps
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function checkProps(context, node) {
let sandboxAttributeFound = false;
if (node.arguments.length > 1) {
const props = node.arguments[1];
const sandboxProp = props.properties && props.properties.find((x) => x.type === 'Property' && x.key.name === 'sandbox');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (targetTestCond === relTestCond) {
const targetBlankIndex = [targetValue.expression.consequent.value, targetValue.expression.alternate.value].indexOf('_blank');
return relValues[targetBlankIndex];
}
Function ruleFixer
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function ruleFixer(context, fixStrategy, fixer, reportedNode, leftNode, rightNode) {
Function create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
const options = context.options;
const hasLegacyOption = Array.isArray(options[0]);
const legacyOptions = hasLegacyOption ? options[0] : [];
// eslint-disable-next-line no-nested-ternary
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
const config = context.options[0] || {};
const checkAliases = config.checkAliases || false;
const isApplicable = testReactVersion(context, '>= 16.3.0');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
create: Components.detect((context, components, utils) => {
/**
* Checks if the component is valid
* @param {Object} component The component to process
* @returns {Boolean} True if the component is valid, false if not.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (method.staticVariable) {
methodGroupIndexes.push(groupIndex);
}
Avoid deeply nested control flow statements. Open
} else if (currentGroup === 'static-methods') {
if (method.staticMethod) {
methodGroupIndexes.push(groupIndex);
}
} else if (currentGroup === 'instance-variables') {
Avoid deeply nested control flow statements. Open
if (firstArg.properties) {
checkSorted(firstArg.properties);
}
Consider simplifying this complex logical expression. Open
if (
node.expression
&& node.expression.type === 'AssignmentExpression'
&& node.expression.operator === '='
&& node.expression.right.type === 'CallExpression'
Consider simplifying this complex logical expression. Open
if (
unwrappedParentCalleeNode
&& unwrappedParentCalleeNode.property
&& unwrappedParentCalleeNode.property.name === 'setState'
// Make sure we are in the updater not the callback
Consider simplifying this complex logical expression. Open
if (((n.type === 'AssignmentExpression') && propsUtil.isPropTypesDeclaration(n.left))
|| ((n.type === 'ClassProperty' || n.type === 'PropertyDefinition' || n.type === 'Property') && propsUtil.isPropTypesDeclaration(n))) {
// Found a propType used inside of another propType. This is not considered usage, we'll still validate
// this component.
isUsedInPropTypes = true;
Consider simplifying this complex logical expression. Open
if (
!component.node.parent
|| component.node.parent.type !== 'VariableDeclarator'
|| !component.node.parent.id
|| component.node.parent.id.type !== 'Identifier'
Consider simplifying this complex logical expression. Open
} else if (
expressionType === 'TemplateLiteral'
&& expression.expressions.length === 0
&& expression.quasis[0].value.raw.indexOf('\n') === -1
&& !isStringWithTrailingWhiteSpaces(expression.quasis[0].value.raw)
Consider simplifying this complex logical expression. Open
if (
classComponent && destructuringClass && configuration === 'never'
&& !(ignoreClassFields && (node.parent.type === 'ClassProperty' || node.parent.type === 'PropertyDefinition'))
) {
report(context, messages.noDestructAssignment, 'noDestructAssignment', {
Consider simplifying this complex logical expression. Open
if (
!isRender
|| (allowNull && (isReturningJSX || isReturningNull))
|| (!allowNull && isReturningJSX)
) {
Consider simplifying this complex logical expression. Open
if (
SFCComponent
&& destructuringSFC
&& configuration === 'always'
&& destructureInSignature === 'always'
Consider simplifying this complex logical expression. Open
if (isSingleGetter && isUseStateCalledWithSingleArgument) {
const useMemoReactImportSpecifier = namedReactImports
&& namedReactImports.find((specifier) => specifier.imported.name === 'useMemo');
let useMemoCode;
Function fixByTrimmingWhitespace
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function fixByTrimmingWhitespace(fixer, fromLoc, toLoc, mode, spacing) {
Function checkLiteralValueNode
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function checkLiteralValueNode(context, attributeName, node, parentNode, parentNodeName) {