Showing 502 of 700 total issues
Function isReturningOnlyNull
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function isReturningOnlyNull(ASTnode, context) {
let found = false;
let foundSomethingElse = false;
astUtil.traverseReturns(ASTnode, context, (node) => {
// Traverse return statement
Function CallExpression
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
CallExpression(node) {
if (!isClassComponent(node)) {
return;
}
// Appends all the methods that are calling another
Function validateAfterOpening
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateAfterOpening(context, node, option) {
const sourceCode = getSourceCode(context);
const openingToken = sourceCode.getTokenBefore(node.name);
if (option === 'allow-multiline') {
Function create
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
function handleClosingElement(node) {
if (!node.parent) {
return;
}
Function endAndStructDeclaredPropTypes
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
endAndStructDeclaredPropTypes() {
if (this.shouldSpecifyOptionalChildrenProps) {
this.declaredPropTypes.children = {
fullName: 'children',
name: 'children',
Function create
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
function validate(node, children) {
let currentIsInline = false;
let previousIsInline = false;
if (!children) {
Function JSXOpeningElement
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
JSXOpeningElement(node) {
if (!node.attributes.length) {
return;
}
Function lintUnnecessaryCurly
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function lintUnnecessaryCurly(JSXExpressionNode) {
const expression = JSXExpressionNode.expression;
const expressionType = expression.type;
const sourceCode = getSourceCode(context);
Function comparePropsOrder
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function comparePropsOrder(propertiesInfos, propA, propB) {
let i;
let j;
let k;
let l;
Function resolveBasedir
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function resolveBasedir(contextOrFilename) {
if (contextOrFilename) {
const filename = typeof contextOrFilename === 'string' ? contextOrFilename : contextOrFilename.getFilename();
const dirname = path.dirname(filename);
try {
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
const configuration = context.options[0] || 'always';
// --------------------------------------------------------------------------
// Public
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
const detectTemplateLiterals = context.options[0] ? context.options[0].noTemplateLiterals : false;
/**
* Checks if we are using refs
* @param {ASTNode} node The AST node being checked.
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
function isComponent(node) {
return (
node.name
&& (node.name.type === 'JSXIdentifier' || node.name.type === 'JSXMemberExpression')
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
// --------------------------------------------------------------------------
// Public
// --------------------------------------------------------------------------
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
return {
CallExpression(node) {
const callee = node.callee;
if (callee.type !== 'MemberExpression') {
- 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 handleJSX
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleJSX = (node) => {
let lastChild = null;
let child = null;
(node.children.concat([null])).forEach((nextChild) => {
if (
Function getTokensLocations
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getTokensLocations(node) {
const sourceCode = getSourceCode(context);
const opening = sourceCode.getFirstToken(node).loc.start;
const closing = sourceCode.getLastTokens(node, node.selfClosing ? 2 : 1)[0].loc.start;
const tag = sourceCode.getFirstToken(node.name).loc.start;
Function JSXOpeningElement
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
JSXOpeningElement(node) {
if (
(configuration === 'multiline' && isMultilineJSX(node))
|| (configuration === 'multiline-multiprop' && isMultilineJSX(node) && node.attributes.length > 1)
|| (configuration === 'multiprop' && node.attributes.length > 1)
Function checkIdentifierInJSX
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkIdentifierInJSX(node) {
let scope = eslintUtil.getScope(context, node);
const sourceCode = eslintUtil.getSourceCode(context);
const sourceType = sourceCode.ast.sourceType;
const scopeUpperBound = !allowGlobals && sourceType === 'module' ? 'module' : 'global';
Function sorter
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast, noSortAlphabetically) {
const aKey = String(astUtil.getKeyValue(context, a));
const bKey = String(astUtil.getKeyValue(context, b));
if (requiredFirst) {