yannickcr/eslint-plugin-react

View on GitHub

Showing 501 of 696 total issues

Function propTypesInstructions has a Cognitive Complexity of 304 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function propTypesInstructions(context, components, utils) {
  // Used to track the type annotations in scope.
  // Necessary because babel's scopes do not track type annotations.
  let stack = null;

Severity: Minor
Found in lib/util/propTypes.js - About 6 days 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 componentRule has a Cognitive Complexity of 221 (exceeds 5 allowed). Consider refactoring.
Open

function componentRule(rule, context) {
  const pragma = pragmaUtil.getFromContext(context);
  const sourceCode = context.getSourceCode();
  const components = new Components();
  const wrapperFunctions = getWrapperFunctions(context, pragma);
Severity: Minor
Found in lib/util/Components.js - About 4 days 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 propTypesInstructions has 866 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function propTypesInstructions(context, components, utils) {
  // Used to track the type annotations in scope.
  // Necessary because babel's scopes do not track type annotations.
  let stack = null;

Severity: Major
Found in lib/util/propTypes.js - About 4 days to fix

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

      create(context) {
        // Non-null when we are inside a React component ClassDeclaration and we have
        // not yet encountered any use of this.state which we have chosen not to
        // analyze. If we encounter any such usage (like this.state being spread as
        // JSX attributes), then this is again set to null.
    Severity: Minor
    Found in lib/rules/no-unused-state.js - About 2 days 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 componentRule has 494 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function componentRule(rule, context) {
      const pragma = pragmaUtil.getFromContext(context);
      const sourceCode = context.getSourceCode();
      const components = new Components();
      const wrapperFunctions = getWrapperFunctions(context, pragma);
    Severity: Major
    Found in lib/util/Components.js - About 2 days to fix

      File propTypes.js has 921 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * @fileoverview Common propTypes detection functionality.
       */
      
      'use strict';
      Severity: Major
      Found in lib/util/propTypes.js - About 2 days to fix

        Function usedPropTypesInstructions has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function usedPropTypesInstructions(context, components, utils) {
          const checkAsyncSafeLifeCycles = testReactVersion(context, '>= 16.3.0');
        
          const propVariables = createPropVariables();
          const pushScope = propVariables.pushScope;
        Severity: Minor
        Found in lib/util/usedPropTypes.js - About 1 day 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 96 (exceeds 5 allowed). Consider refactoring.
        Open

          create(context) {
            const configuration = Object.assign(
              {
                allowReferrer: false,
                warnOnSpreadAttributes: false,
        Severity: Minor
        Found in lib/rules/jsx-no-target-blank.js - About 1 day 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 96 (exceeds 5 allowed). Consider refactoring.
        Open

          create(context) {
            const HTML_ENTITY_REGEX = () => /&[A-Za-z\d#]+;/g;
            const ruleOptions = context.options[0];
            const userConfig = typeof ruleOptions === 'string'
              ? { props: ruleOptions, children: ruleOptions, propElementValues: OPTION_IGNORE }
        Severity: Minor
        Found in lib/rules/jsx-curly-brace-presence.js - About 1 day 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 88 (exceeds 5 allowed). Consider refactoring.
        Open

          create(context) {
            function normalizeConfig(configOrTrue, defaults, lastPass) {
              const config = configOrTrue === true ? {} : configOrTrue;
              const when = config.when || defaults.when;
              const allowMultiline = has(config, 'allowMultiline') ? config.allowMultiline : defaults.allowMultiline;
        Severity: Minor
        Found in lib/rules/jsx-curly-spacing.js - About 1 day 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 343 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          create(context) {
            // Non-null when we are inside a React component ClassDeclaration and we have
            // not yet encountered any use of this.state which we have chosen not to
            // analyze. If we encounter any such usage (like this.state being spread as
            // JSX attributes), then this is again set to null.
        Severity: Major
        Found in lib/rules/no-unused-state.js - About 1 day to fix

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

            create(context) {
              const extraColumnStart = 0;
              let indentType = 'space';
              let indentSize = 4;
          
          
          Severity: Minor
          Found in lib/rules/jsx-indent.js - About 1 day 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 Components.js has 680 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * @fileoverview Utility class and functions for React components detection
           * @author Yannick Croissant
           */
          
          
          Severity: Major
          Found in lib/util/Components.js - About 1 day to fix

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

              create: Components.detect((context, components) => {
                /**
                 * @param {Array} properties list of component properties
                 */
                function reportNoArrowFunctionLifecycle(properties) {
            Severity: Minor
            Found in lib/rules/no-arrow-function-lifecycle.js - About 1 day 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 275 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              create(context) {
                const HTML_ENTITY_REGEX = () => /&[A-Za-z\d#]+;/g;
                const ruleOptions = context.options[0];
                const userConfig = typeof ruleOptions === 'string'
                  ? { props: ruleOptions, children: ruleOptions, propElementValues: OPTION_IGNORE }
            Severity: Major
            Found in lib/rules/jsx-curly-brace-presence.js - About 1 day to fix

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

                create: Components.detect((context, components, utils) => {
                  let propTypesPackageName = null;
                  let reactPackageName = null;
              
                  function checkValidPropTypeQualifier(node) {
              Severity: Minor
              Found in lib/rules/no-typos.js - About 1 day 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 254 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                create: Components.detect((context, components, utils) => {
                  const config = context.options[0] || {};
                  const rule = config.rule ? new RegExp(config.rule) : null;
                  const propTypeNames = config.propTypeNames || ['bool'];
              
              
              Severity: Major
              Found in lib/rules/boolean-prop-naming.js - About 1 day to fix

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

                  create(context) {
                    const MESSAGE_LOCATION = {
                      'after-props': 'placed after the last prop',
                      'after-tag': 'placed after the opening tag',
                      'props-aligned': 'aligned with the last prop',
                Severity: Minor
                Found in lib/rules/jsx-closing-bracket-location.js - About 1 day 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 63 (exceeds 5 allowed). Consider refactoring.
                Open

                  create: Components.detect((context, components, utils) => {
                    const config = context.options[0] || {};
                    const rule = config.rule ? new RegExp(config.rule) : null;
                    const propTypeNames = config.propTypeNames || ['bool'];
                
                
                Severity: Minor
                Found in lib/rules/boolean-prop-naming.js - About 1 day 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 242 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  create(context) {
                    const extraColumnStart = 0;
                    let indentType = 'space';
                    let indentSize = 4;
                
                
                Severity: Major
                Found in lib/rules/jsx-indent.js - About 1 day to fix
                  Severity
                  Category
                  Status
                  Source
                  Language