yannickcr/eslint-plugin-react

View on GitHub

Showing 512 of 708 total issues

Function getRefPropIndexes has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function getRefPropIndexes(method) {
      const methodGroupIndexes = [];

      methodsOrder.forEach((currentGroup, groupIndex) => {
        if (currentGroup === 'getters') {
Severity: Major
Found in lib/rules/sort-comp.js - About 3 hrs to fix

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

      create(context) {
        const config = context.options[0];
        let option = defaultOption;
    
        if (typeof config === 'string') {
    Severity: Minor
    Found in lib/rules/jsx-closing-tag-location.js - About 3 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 23 (exceeds 5 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: Minor
    Found in lib/rules/forbid-component-props.js - About 3 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 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      create(context) {
        const config = context.options[0] || {};
        const allowInPropTypes = config.allowInPropTypes || false;
    
        // --------------------------------------------------------------------------
    Severity: Major
    Found in lib/rules/forbid-foreign-prop-types.js - About 3 hrs to fix

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

        create(context) {
          function isPrefixDisabled(prefix) {
            return prefix === false;
          }
      
      
      Severity: Major
      Found in lib/rules/jsx-handler-names.js - About 3 hrs to fix

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

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

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

            create: Components.detect((context, components) => {
              /**
               * @param {Array} properties list of component properties
               */
              function reportNoArrowFunctionLifecycle(properties) {
          Severity: Major
          Found in lib/rules/no-arrow-function-lifecycle.js - About 3 hrs to fix

            Function JSXOpeningElement has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  JSXOpeningElement(node) {
                    const targetIndex = findLastIndex(node.attributes, (attr) => attr.name && attr.name.name === 'target');
                    const spreadAttributeIndex = findLastIndex(node.attributes, (attr) => (attr.type === 'JSXSpreadAttribute'));
            
                    if (linkComponents.has(node.name.name)) {
            Severity: Major
            Found in lib/rules/jsx-no-target-blank.js - About 3 hrs to fix

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

                create(context) {
                  const sourceCode = getSourceCode(context);
              
                  function getPropName(propNode) {
                    switch (propNode.type) {
              Severity: Minor
              Found in lib/rules/jsx-props-no-multi-spaces.js - About 3 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 22 (exceeds 5 allowed). Consider refactoring.
              Open

                create(context) {
                  const options = Object.assign({}, optionDefaults, context.options[0]);
              
                  function nodeKey(node) {
                    return `${node.loc.start.line},${node.loc.start.column}`;
              Severity: Minor
              Found in lib/rules/jsx-one-expression-per-line.js - About 3 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 convertReturnTypeToPropTypes has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  convertReturnTypeToPropTypes(node, rootNode) {
                    // ReturnType<T> should always have one parameter
                    const nodeTypeArguments = propsUtil.getTypeArguments(node);
                    if (nodeTypeArguments) {
                      if (nodeTypeArguments.params.length === 1) {
              Severity: Major
              Found in lib/util/propTypes.js - About 3 hrs to fix

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

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

                  Function getRelatedComponent has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      getRelatedComponent(node) {
                        let i;
                        let j;
                        let k;
                        let l;
                  Severity: Major
                  Found in lib/util/Components.js - About 3 hrs to fix

                    Function checkSorted has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function checkSorted(declarations) {
                          // Declarations will be `undefined` if the `shape` is not a literal. For
                          // example, if it is a propType imported from another file.
                          if (!declarations) {
                            return;
                    Severity: Major
                    Found in lib/rules/sort-prop-types.js - About 3 hrs to fix

                      File ast.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /**
                       * @fileoverview Utility functions for AST
                       */
                      
                      'use strict';
                      Severity: Minor
                      Found in lib/util/ast.js - About 3 hrs to fix

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

                          create(context) {
                            const pragma = pragmaUtil.getFromContext(context);
                            const deprecated = getDeprecated(pragma);
                        
                            function isDeprecated(method) {
                        Severity: Minor
                        Found in lib/rules/no-deprecated.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 21 (exceeds 5 allowed). Consider refactoring.
                        Open

                          create(context) {
                            const configuration = context.options[0] || {};
                            const allowAllCaps = configuration.allowAllCaps || false;
                            const allowLeadingUnderscore = configuration.allowLeadingUnderscore || false;
                            const allowNamespace = configuration.allowNamespace || false;
                        Severity: Minor
                        Found in lib/rules/jsx-pascal-case.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

                        File jsx-indent.js has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /**
                         * @fileoverview Validate JSX indentation
                         * @author Yannick Croissant
                        
                         * This rule has been ported and modified from eslint and nodeca.
                        Severity: Minor
                        Found in lib/rules/jsx-indent.js - About 2 hrs to fix

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

                            create(context) {
                              const jsxElementParents = new Set();
                          
                              function isBlockCommentInCurlyBraces(element) {
                                const elementRawValue = getText(context, element);
                          Severity: Major
                          Found in lib/rules/jsx-newline.js - About 2 hrs to fix

                            Function searchDeclarationByName has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                searchDeclarationByName(node) {
                                  let typeName;
                                  if (astUtil.isTSTypeReference(node)) {
                                    typeName = node.typeName.name;
                                    const leftMostName = getLeftMostTypeName(node.typeName);
                            Severity: Major
                            Found in lib/util/propTypes.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language