yannickcr/eslint-plugin-react

View on GitHub

Showing 502 of 700 total issues

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

  create: Components.detect((context, components, utils) => {
    // variables should be defined here
    const options = context.options;
    const defaultCheckType = options[0] || STATIC_PUBLIC_FIELD;
    const hasAdditionalConfig = options.length > 1;
Severity: Major
Found in lib/rules/static-property-placement.js - About 2 hrs to fix

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

      create(context) {
        const sourceCode = getSourceCode(context);
        const option = getNormalizedOption(context);
    
        // ----------------------------------------------------------------------
    Severity: Major
    Found in lib/rules/jsx-curly-newline.js - About 2 hrs to fix

      Function reportNoArrowFunctionLifecycle has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function reportNoArrowFunctionLifecycle(properties) {
            properties.forEach((node) => {
              if (!node || !node.value) {
                return;
              }
      Severity: Major
      Found in lib/rules/no-arrow-function-lifecycle.js - About 2 hrs to fix

        Function getStringFromValue has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        function getStringFromValue(value, targetValue) {
          if (value) {
            if (value.type === 'Literal') {
              return value.value;
            }
        Severity: Minor
        Found in lib/rules/jsx-no-target-blank.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 20 (exceeds 5 allowed). Consider refactoring.
        Open

          create: Components.detect((context, components, utils) => {
            return {
              JSXOpeningElement(node) {
                const openingElementName = node.name;
                if (openingElementName.type !== 'JSXMemberExpression') {
        Severity: Minor
        Found in lib/rules/jsx-no-constructed-context-values.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 20 (exceeds 5 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

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

          create(context) {
            const sourceCode = getSourceCode(context);
            const option = getNormalizedOption(context);
        
            // ----------------------------------------------------------------------
        Severity: Minor
        Found in lib/rules/jsx-curly-newline.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 20 (exceeds 5 allowed). Consider refactoring.
        Open

          create(context) {
            const filename = context.getFilename();
        
            let jsxNode;
        
        
        Severity: Minor
        Found in lib/rules/jsx-filename-extension.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 sort-prop-types.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * @fileoverview Enforce propTypes declarations alphabetical sorting
         */
        
        'use strict';
        Severity: Minor
        Found in lib/rules/sort-prop-types.js - About 2 hrs to fix

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

            create: Components.detect((context, components) => {
              const defaults = { skipShapeProps: true, customValidators: [], ignore: [] };
              const configuration = Object.assign({}, defaults, context.options[0] || {});
          
              /**
          Severity: Major
          Found in lib/rules/no-unused-prop-types.js - About 2 hrs to fix

            Function contextCompare has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function contextCompare(a, b, options) {
              let aProp = propName(a);
              let bProp = propName(b);
            
              const aSortToEnd = shouldSortToEnd(a);
            Severity: Major
            Found in lib/rules/jsx-sort-props.js - About 2 hrs to fix

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

                create(context) {
                  const configuration = context.options[0] || {};
                  const maximum = configuration.maximum || 1;
              
                  const maxConfig = typeof maximum === 'number'
              Severity: Major
              Found in lib/rules/jsx-max-props-per-line.js - About 2 hrs to fix

                Function fixPropTypesSort has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                function fixPropTypesSort(
                  context,
                  fixer,
                  declarations,
                  ignoreCase,
                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 getPropertyName has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                function getPropertyName(context, node, utils, checkAsyncSafeLifeCycles) {
                  const property = node.property;
                  if (property) {
                    switch (property.type) {
                      case 'Identifier':
                Severity: Minor
                Found in lib/util/usedPropTypes.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 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  create(context) {
                    const configuration = context.options[0] || {};
                    const ignoreHtmlTags = (configuration.html || DEFAULTS.html) === OPTIONS.ignore;
                    const ignoreCustomTags = (configuration.custom || DEFAULTS.custom) === OPTIONS.ignore;
                    const ignoreExplicitSpread = (configuration.explicitSpread || DEFAULTS.explicitSpread) === OPTIONS.ignore;
                Severity: Minor
                Found in lib/rules/jsx-props-no-spreading.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 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  create(context) {
                    const configuration = context.options[0] || {};
                    const forbidConfiguration = configuration.forbid || [];
                
                    const indexedForbidConfigs = {};
                Severity: Minor
                Found in lib/rules/forbid-elements.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 getDeprecated has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getDeprecated(pragma) {
                  const deprecated = {};
                  // 0.12.0
                  deprecated[`${pragma}.renderComponent`] = ['0.12.0', `${pragma}.render`];
                  deprecated[`${pragma}.renderComponentToString`] = ['0.12.0', `${pragma}.renderToString`];
                Severity: Major
                Found in lib/rules/no-deprecated.js - About 2 hrs to fix

                  Function JSXAttribute has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        JSXAttribute(node) {
                          const ignoreNames = getIgnoreConfig();
                          const actualName = getText(context, node.name);
                          if (ignoreNames.indexOf(actualName) >= 0) {
                            return;
                  Severity: Major
                  Found in lib/rules/no-unknown-property.js - About 2 hrs to fix

                    Function searchDeclarationByName has 63 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

                      Function fixPropTypesSort has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function fixPropTypesSort(
                        context,
                        fixer,
                        declarations,
                        ignoreCase,
                      Severity: Major
                      Found in lib/util/propTypesSort.js - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language