yannickcr/eslint-plugin-react

View on GitHub

Showing 501 of 696 total issues

Function contextCompare has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

function contextCompare(a, b, options) {
  let aProp = propName(a);
  let bProp = propName(b);

  const aSortToEnd = shouldSortToEnd(a);
Severity: Minor
Found in lib/rules/jsx-sort-props.js - About 5 hrs to fix

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 134 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  create: Components.detect((context, components) => {
    const configuration = context.options[0] || {};
    const allowDecorators = configuration.allowDecorators || [];

    /**
Severity: Major
Found in lib/rules/require-optimization.js - About 5 hrs to fix

    Function create has 133 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      create(context) {
        const configuration = context.options[0] || 'syntax';
        const reactPragma = pragmaUtil.getFromContext(context);
        const fragmentPragma = pragmaUtil.getFragmentFromContext(context);
        const openFragShort = '<>';
    Severity: Major
    Found in lib/rules/jsx-fragments.js - About 5 hrs to fix

      Function create has 131 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        create(context) {
          function isSetStateCall(node) {
            return node.type === 'CallExpression'
              && node.callee.property
              && node.callee.property.name === 'setState'
      Severity: Major
      Found in lib/rules/no-access-state-in-setstate.js - About 5 hrs to fix

        Function markPropTypesAsDeclared has 130 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function markPropTypesAsDeclared(node, propTypes) {
            let componentNode = node;
            while (componentNode && !components.get(componentNode)) {
              componentNode = componentNode.parent;
            }
        Severity: Major
        Found in lib/util/propTypes.js - About 5 hrs to fix

          File usedPropTypes.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * @fileoverview Common used propTypes detection functionality.
           */
          
          'use strict';
          Severity: Minor
          Found in lib/util/usedPropTypes.js - About 5 hrs to fix

            Function create has 128 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              create: Components.detect((context, components, util) => {
                const configuration = context.options[0] || {};
                const allowDestructuredState = configuration.allowDestructuredState || false;
            
                return {
            Severity: Major
            Found in lib/rules/hook-use-state.js - About 5 hrs to fix

              Function create has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

                create(context) {
                  const DEFAULT_DEPTH = 2;
              
                  const option = context.options[0] || {};
                  const maxDepth = has(option, 'max') ? option.max : DEFAULT_DEPTH;
              Severity: Minor
              Found in lib/rules/jsx-max-depth.js - About 5 hrs to fix

              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 ruleFixer has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

              function ruleFixer(context, fixStrategy, fixer, reportedNode, leftNode, rightNode) {
                const sourceCode = context.getSourceCode();
                const rightSideText = sourceCode.getText(rightNode);
              
                if (fixStrategy === COERCE_STRATEGY) {
              Severity: Minor
              Found in lib/rules/jsx-no-leaked-render.js - About 5 hrs to fix

              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 CallExpression has 122 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    CallExpression(node) {
                      const isImmediateReturn = node.parent
                        && node.parent.type === 'ReturnStatement';
              
                      if (isImmediateReturn || !util.isReactHookCall(node, ['useState'])) {
              Severity: Major
              Found in lib/rules/hook-use-state.js - About 4 hrs to fix

                Function create has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                Open

                  create(context) {
                    function getIgnoreConfig() {
                      return (context.options[0] && context.options[0].ignore) || DEFAULTS.ignore;
                    }
                
                
                Severity: Minor
                Found in lib/rules/no-unknown-property.js - About 4 hrs to fix

                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 32 (exceeds 5 allowed). Consider refactoring.
                Open

                  create(context) {
                    const configuration = context.options[0] || {};
                    const ignoreCase = configuration.ignoreCase || false;
                
                    /**
                Severity: Minor
                Found in lib/rules/jsx-sort-default-props.js - About 4 hrs to fix

                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 32 (exceeds 5 allowed). Consider refactoring.
                Open

                  create: Components.detect((context, components, utils) => {
                    const typeAliases = {};
                    const exactWrappers = propWrapperUtil.getExactPropWrapperFunctions(context);
                    const sourceCode = context.getSourceCode();
                
                
                Severity: Minor
                Found in lib/rules/prefer-exact-props.js - About 4 hrs to fix

                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 isDestructuredFromPragmaImport has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function isDestructuredFromPragmaImport(variable, context) {
                  const pragma = pragmaUtil.getFromContext(context);
                  const variables = variableUtil.variablesInScope(context);
                  const variableInScope = variableUtil.getVariable(variables, variable);
                  if (variableInScope) {
                Severity: Minor
                Found in lib/util/isDestructuredFromPragmaImport.js - About 4 hrs to fix

                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 31 (exceeds 5 allowed). Consider refactoring.
                Open

                  create(context) {
                    const configuration = context.options[0] || {};
                
                    // Keep track of all the variable names pointing to a bind call,
                    // bind expression or an arrow function in different block statements
                Severity: Minor
                Found in lib/rules/jsx-no-bind.js - About 4 hrs to fix

                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 31 (exceeds 5 allowed). Consider refactoring.
                Open

                  create(context) {
                    function reportInvalidEntity(node) {
                      const configuration = context.options[0] || {};
                      const entities = configuration.forbid || DEFAULTS;
                
                
                Severity: Minor
                Found in lib/rules/no-unescaped-entities.js - About 4 hrs to fix

                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 114 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  create(context) {
                    const configuration = context.options[0] || {};
                
                    // Keep track of all the variable names pointing to a bind call,
                    // bind expression or an arrow function in different block statements
                Severity: Major
                Found in lib/rules/jsx-no-bind.js - About 4 hrs to fix

                  Function create has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    create: ((context) => {
                      let classInfo = null;
                  
                      // Takes an ObjectExpression node and adds all named Property nodes to the
                      // current set of properties.
                  Severity: Major
                  Found in lib/rules/no-unused-class-component-methods.js - About 4 hrs to fix

                    Function checkLiteralValueNode has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function checkLiteralValueNode(context, attributeName, node, parentNode, parentNodeName) {
                      if (typeof node.value !== 'string') {
                        report(context, messages.onlyStrings, 'onlyStrings', {
                          node,
                          data: { attributeName },
                    Severity: Major
                    Found in lib/rules/no-invalid-html-attribute.js - About 4 hrs to fix

                      Function getStatelessComponent has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          getStatelessComponent(node) {
                            const parent = node.parent;
                            if (
                              node.type === 'FunctionDeclaration'
                              && (!node.id || isFirstLetterCapitalized(node.id.name))
                      Severity: Major
                      Found in lib/util/Components.js - About 4 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language