yannickcr/eslint-plugin-react

View on GitHub

Showing 699 of 699 total issues

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

  create(context) {
    const extraColumnStart = 0;
    let indentType = 'space';
    /** @type {number|'first'} */
    let indentSize = 4;
Severity: Minor
Found in lib/rules/jsx-indent-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 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  create(context) {
    const defaults = {
      noStrings: false,
      allowedStrings: [],
      ignoreProps: false,
Severity: Major
Found in lib/rules/jsx-no-literals.js - About 4 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        function reportNoEndingNewline(node, token, spacing) {
          report(context, messages.noNewlineBefore, 'noNewlineBefore', {
            node,
            loc: token.loc.start,
            data: {
    Severity: Major
    Found in lib/rules/jsx-curly-spacing.js and 1 other location - About 4 hrs to fix
    lib/rules/jsx-curly-spacing.js on lines 202..214

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 118.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        function reportNoBeginningNewline(node, token, spacing) {
          report(context, messages.noNewlineAfter, 'noNewlineAfter', {
            node,
            loc: token.loc.start,
            data: {
    Severity: Major
    Found in lib/rules/jsx-curly-spacing.js and 1 other location - About 4 hrs to fix
    lib/rules/jsx-curly-spacing.js on lines 223..235

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 118.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    function getFormComponents(context) {
      const settings = context.settings || {};
      const formComponents = /** @type {typeof DEFAULT_FORM_COMPONENTS} */ (
        DEFAULT_FORM_COMPONENTS.concat(settings.formComponents || [])
      );
    Severity: Major
    Found in lib/util/linkComponents.js and 1 other location - About 4 hrs to fix
    lib/util/linkComponents.js on lines 33..44

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 117.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    function getLinkComponents(context) {
      const settings = context.settings || {};
      const linkComponents = /** @type {typeof DEFAULT_LINK_COMPONENTS} */ (
        DEFAULT_LINK_COMPONENTS.concat(settings.linkComponents || [])
      );
    Severity: Major
    Found in lib/util/linkComponents.js and 1 other location - About 4 hrs to fix
    lib/util/linkComponents.js on lines 20..31

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 117.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function isConstruction has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function isConstruction(node, callScope) {
      switch (node.type) {
        case 'Literal':
          if (node.regex != null) {
            return { type: 'regular expression', node };
    Severity: Minor
    Found in lib/rules/jsx-no-constructed-context-values.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 28 (exceeds 5 allowed). Consider refactoring.
    Open

      create: Components.detect((context, components, utils) => {
        const allowAsProps = context.options.some((option) => option && option.allowAsProps);
    
        /**
         * Check whether given node is declared inside class component's render block
    Severity: Minor
    Found in lib/rules/no-unstable-nested-components.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 28 (exceeds 5 allowed). Consider refactoring.
    Open

      create: Components.detect((context, components) => {
        const configuration = context.options[0] || {};
        let fileVarType = 'var';
    
        const namedConfig = [].concat(
    Severity: Minor
    Found in lib/rules/function-component-definition.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 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      create(context) {
        const extraColumnStart = 0;
        let indentType = 'space';
        /** @type {number|'first'} */
        let indentSize = 4;
    Severity: Major
    Found in lib/rules/jsx-indent-props.js - About 4 hrs to fix

      File sort-comp.js has 336 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * @fileoverview Enforce component methods order
       * @author Yannick Croissant
       */
      
      
      Severity: Minor
      Found in lib/rules/sort-comp.js - About 4 hrs to fix

        Function markPropTypesAsUsed has 101 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function markPropTypesAsUsed(node, parentNames) {
            parentNames = parentNames || [];
            let type;
            let name;
            let allNames;
        Severity: Major
        Found in lib/util/usedPropTypes.js - About 4 hrs to fix

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

            create(context) {
              const pragma = pragmaUtil.getFromContext(context);
              const deprecated = getDeprecated(pragma);
          
              function isDeprecated(method) {
          Severity: Major
          Found in lib/rules/no-deprecated.js - About 4 hrs to fix

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

              create: Components.detect((context, components, utils) => {
                const allowAsProps = context.options.some((option) => option && option.allowAsProps);
            
                /**
                 * Check whether given node is declared inside class component's render block
            Severity: Major
            Found in lib/rules/no-unstable-nested-components.js - About 3 hrs to fix

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

                create(context) {
                  const config = context.options[0] || {};
                  const allowInPropTypes = config.allowInPropTypes || false;
              
                  // --------------------------------------------------------------------------
              Severity: Minor
              Found in lib/rules/forbid-foreign-prop-types.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 27 (exceeds 5 allowed). Consider refactoring.
              Open

                create(context) {
                  const config = context.options[0] || {};
                  const allowGlobals = config.allowGlobals || false;
              
                  /**
              Severity: Minor
              Found in lib/rules/jsx-no-undef.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 97 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                create: Components.detect((context, components) => {
                  const configuration = context.options[0] || {};
                  const forbidDefaultForRequired = configuration.forbidDefaultForRequired || false;
                  const classes = configuration.classes || 'defaultProps';
                  /**
              Severity: Major
              Found in lib/rules/require-default-props.js - About 3 hrs to fix

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

                  create(context) {
                    const configuration = Object.assign(
                      {
                        allowReferrer: false,
                        warnOnSpreadAttributes: false,
                Severity: Major
                Found in lib/rules/jsx-no-target-blank.js - About 3 hrs to fix

                  File jsx-curly-brace-presence.js has 326 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /**
                   * @fileoverview Enforce curly braces or disallow unnecessary curly brace in JSX
                   * @author Jacky Ho
                   * @author Simon Lydell
                   */
                  Severity: Minor
                  Found in lib/rules/jsx-curly-brace-presence.js - About 3 hrs to fix

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

                      create(context) {
                        const config = context.options[0] || {};
                        const allowExpressions = config.allowExpressions || false;
                    
                        const reactPragma = pragmaUtil.getFromContext(context);
                    Severity: Major
                    Found in lib/rules/jsx-no-useless-fragment.js - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language