Showing 502 of 700 total issues
Function markAnnotatedFunctionArgumentsAsDeclared
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function markAnnotatedFunctionArgumentsAsDeclared(node, rootNode) {
if (!node.params || !node.params.length) {
return;
}
Function makeNoMethodSetStateRule
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function makeNoMethodSetStateRule(methodName, shouldCheckUnsafeCb) {
return {
meta: {
docs: {
description: `Disallow usage of setState in ${methodName}`,
Function create
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
const allowed = new Set(((context.options.length > 0) && context.options[0].allow) || []);
/**
* @param {ASTNode} expression An Identifier node
Function getGroupsOfSortableAttributes
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getGroupsOfSortableAttributes(attributes, context) {
const sourceCode = getSourceCode(context);
const sortableAttributeGroups = [];
let groupCount = 0;
Function checkCreateProps
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function checkCreateProps(context, node, attribute) {
const propsArg = node.arguments[1];
if (!propsArg || propsArg.type !== 'ObjectExpression') {
return; // can't check variables, computed, or shorthands
- 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 validateBraceSpacing
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateBraceSpacing(node) {
let config;
switch (node.parent.type) {
case 'JSXAttribute':
case 'JSXOpeningElement':
Function create
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
const options = Object.assign({}, defaultOptions, context.options[0]);
function reportMissingProperty(node) {
report(
Function VariableDeclarator
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
VariableDeclarator(node) {
const classComponent = utils.getParentComponent(node);
const SFCComponent = components.get(getScope(context, node).block);
const destructuring = (node.init && node.id && node.id.type === 'ObjectPattern');
Function validateClosingSlash
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateClosingSlash(context, node, option) {
const sourceCode = getSourceCode(context);
let adjacent;
Consider simplifying this complex logical expression. Open
if (
(node.property
&& (
!node.computed
&& node.property.type === 'Identifier'
Function Program:exit
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
'Program:exit'() {
jsxElementParents.forEach((parent) => {
parent.children.forEach((element, index, elements) => {
if (element.type === 'JSXElement' || element.type === 'JSXExpressionContainer') {
const configuration = context.options[0] || {};
Function create
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
const config = context.options[0] || {};
const allowGlobals = config.allowGlobals || false;
/**
Function sortInSource
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function sortInSource(allNodes, source) {
const originalSource = source;
const sourceCode = getSourceCode(context);
for (let i = 0; i < allNodes.length; i++) {
const node = allNodes[i];
Function validateBeforeClosing
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateBeforeClosing(context, node, option) {
// Don't enforce this rule for self closing tags
if (!node.selfClosing) {
const sourceCode = getSourceCode(context);
const leftToken = option === 'proportional-always'
Function create
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
const pragma = pragmaUtil.getFromContext(context);
const deprecated = getDeprecated(pragma);
function isDeprecated(method) {
- 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 sorter
has a Cognitive Complexity of 17 (exceeds 5 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) {
- 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 isReturningJSX
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function isReturningJSX(context, ASTnode, strict, ignoreNull) {
const isJSXValue = (node) => {
if (!node) {
return false;
}
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
create(context) {
const options = Object.assign({}, defaultOptions, context.options[0]);
function reportMissingProperty(node) {
report(
- 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 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
const configuration = context.options[0] || NEVER;
const configObject = context.options[1] || {};
const exceptions = new Set((configuration === ALWAYS ? configObject[NEVER] : configObject[ALWAYS]) || []);
Function create
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
create: Components.detect((context, components, utils) => {
return {
JSXOpeningElement(node) {
const openingElementName = node.name;
if (openingElementName.type !== 'JSXMemberExpression') {