yannickcr/eslint-plugin-react

View on GitHub

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) {
Severity: Minor
Found in lib/util/propTypesSort.js - About 2 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 17 (exceeds 5 allowed). Consider refactoring.
Open

  create(context) {
    const options = Object.assign({}, defaultOptions, context.options[0]);

    function reportMissingProperty(node) {
      report(
Severity: Minor
Found in lib/rules/checked-requires-onchange-or-readonly.js - About 2 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 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') {
Severity: Major
Found in lib/rules/jsx-no-constructed-context-values.js - About 2 hrs to fix

    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]) || []);
    
    
    Severity: Major
    Found in lib/rules/jsx-boolean-value.js - About 2 hrs to fix

      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.
      Severity: Major
      Found in lib/rules/jsx-equals-spacing.js - About 2 hrs to fix

        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);
        Severity: Major
        Found in lib/rules/jsx-handler-names.js - About 2 hrs to fix

          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');
          Severity: Major
          Found in lib/rules/no-children-prop.js - About 2 hrs to fix

            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ö
             */
            
            
            Severity: Minor
            Found in lib/rules/no-unstable-nested-components.js - About 2 hrs to fix

              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;
              
              
              Severity: Minor
              Found in lib/rules/jsx-tag-spacing.js - About 2 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 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;
              Severity: Major
              Found in lib/rules/jsx-no-constructed-context-values.js - About 2 hrs to fix

                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);
                Severity: Major
                Found in lib/util/isDestructuredFromPragmaImport.js - About 2 hrs to fix

                  Function check has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function check(node, type) {
                        if (!node || !jsxUtil.isJSX(node)) {
                          return;
                        }
                  
                  
                  Severity: Major
                  Found in lib/rules/jsx-wrap-multilines.js - About 2 hrs to fix

                    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,
                    Severity: Major
                    Found in lib/rules/no-array-index-key.js - About 2 hrs to fix

                      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;
                      Severity: Major
                      Found in lib/rules/forbid-component-props.js - About 2 hrs to fix

                        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.
                             */
                        Severity: Major
                        Found in lib/rules/require-render-return.js - About 2 hrs to fix

                          File forbid-prop-types.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /**
                           * @fileoverview Forbid certain propTypes
                           */
                          
                          'use strict';
                          Severity: Minor
                          Found in lib/rules/forbid-prop-types.js - About 2 hrs to fix

                            Consider simplifying this complex logical expression.
                            Open

                                    if (
                                      (lastChild || nextChild)
                                      && (!lastChild || isInlineElement(lastChild))
                                      && (child && (child.type === 'Literal' || child.type === 'JSXText'))
                                      && (!nextChild || isInlineElement(nextChild))
                            Severity: Critical
                            Found in lib/rules/jsx-child-element-spacing.js - About 2 hrs to fix

                              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);
                              
                              
                              Severity: Minor
                              Found in lib/rules/jsx-no-leaked-render.js - About 2 hrs to fix

                                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;
                                Severity: Minor
                                Found in lib/rules/jsx-closing-bracket-location.js - About 1 hr to fix

                                  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 (
                                  Severity: Minor
                                  Found in lib/rules/jsx-boolean-value.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language