Showing 512 of 708 total issues
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 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: Components.detect((context, components, utils) => {
return {
JSXOpeningElement(node) {
const openingElementName = node.name;
if (openingElementName.type !== 'JSXMemberExpression') {
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(context) {
const config = context.options[0] || 'never';
/**
* Determines a given attribute node has an equal sign.
Function JSXAttribute
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
JSXAttribute(node) {
const componentName = node.parent.name.name;
const isComponentNameIgnored = ignoreComponentNames.some((ignoredComponentNamePattern) => {
const isIgnored = minimatch(componentName, ignoredComponentNamePattern);
Function create
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
const configuration = context.options[0] || {};
function isFunction(node) {
return configuration.allowFunctions && (node.type === 'ArrowFunctionExpression' || node.type === 'FunctionExpression');
File no-unstable-nested-components.js
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @fileoverview Prevent creating unstable components inside components
* @author Ari Perkkiö
*/
Function validateClosingSlash
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function validateClosingSlash(context, node, option) {
const sourceCode = getSourceCode(context);
let adjacent;
- 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 JSXOpeningElement
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
JSXOpeningElement(node) {
const openingElementName = node.name;
if (openingElementName.type !== 'JSXMemberExpression') {
// Has no member
return;
Function isDestructuredFromPragmaImport
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function isDestructuredFromPragmaImport(context, node, variable) {
const pragma = pragmaUtil.getFromContext(context);
const variableInScope = variableUtil.getVariableFromContext(context, node, variable);
if (variableInScope) {
const latestDef = variableUtil.getLatestVariableDefinition(variableInScope);
Function check
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function check(node, type) {
if (!node || !jsxUtil.isJSX(node)) {
return;
}
Function checkPropValue
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkPropValue(node) {
if (isArrayIndex(node)) {
// key={bar}
report(context, messages.noArrayIndex, 'noArrayIndex', {
node,
Function create
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
const configuration = context.options[0] || {};
const forbid = new Map((configuration.forbid || DEFAULTS).map((value) => {
const propName = typeof value === 'string' ? value : value.propName;
const propPattern = value.propNamePattern;
Function create
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
create: Components.detect((context, components) => {
/**
* Mark a return statement as present
* @param {ASTNode} node The AST node being checked.
*/
File forbid-prop-types.js
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @fileoverview Forbid certain propTypes
*/
'use strict';
Consider simplifying this complex logical expression. Open
if (
(lastChild || nextChild)
&& (!lastChild || isInlineElement(lastChild))
&& (child && (child.type === 'Literal' || child.type === 'JSXText'))
&& (!nextChild || isInlineElement(nextChild))
Function create
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
const config = context.options[0] || {};
const validStrategies = new Set(config.validStrategies || DEFAULT_VALID_STRATEGIES);
const fixStrategy = find(from(validStrategies), () => true);
Function JSXOpeningElement:exit
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
'JSXOpeningElement:exit'(node) {
const attributeNode = lastAttributeNode[getOpeningElementId(node)];
const cachedLastAttributeEndPos = attributeNode ? attributeNode.range[1] : null;
let expectedNextLine;
Function JSXAttribute
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
JSXAttribute(node) {
const propName = node.name && node.name.name;
const value = node.value;
if (