yannickcr/eslint-plugin-react

View on GitHub

Showing 696 of 696 total issues

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

  create: Components.detect((context, components, util) => {
    const configuration = context.options[0] || {};
    const allowDestructuredState = configuration.allowDestructuredState || false;

    return {
Severity: Minor
Found in lib/rules/hook-use-state.js - About 7 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 51 (exceeds 5 allowed). Consider refactoring.
Open

  create: ((context) => {
    let classInfo = null;

    // Takes an ObjectExpression node and adds all named Property nodes to the
    // current set of properties.
Severity: Minor
Found in lib/rules/no-unused-class-component-methods.js - About 7 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 no-unknown-property.js has 479 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @fileoverview Prevent usage of unknown DOM property
 * @author Yannick Croissant
 */

Severity: Minor
Found in lib/rules/no-unknown-property.js - About 7 hrs to fix

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

      create(context) {
        const options = Object.assign({}, defaultOptions, context.options[0]);
        const checkFragmentShorthand = options.checkFragmentShorthand;
        const checkKeyMustBeforeSpread = options.checkKeyMustBeforeSpread;
        const warnOnDuplicates = options.warnOnDuplicates;
    Severity: Major
    Found in lib/rules/jsx-key.js - About 7 hrs to fix

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

        create: Components.detect((context, components, utils) => {
          let propTypesPackageName = null;
          let reactPackageName = null;
      
          function checkValidPropTypeQualifier(node) {
      Severity: Major
      Found in lib/rules/no-typos.js - About 7 hrs to fix

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

          create: Components.detect((context, components) => {
            const configuration = context.options[0] || {};
            const ignored = configuration.ignore || [];
            const skipUndeclared = configuration.skipUndeclared || false;
        
        
        Severity: Minor
        Found in lib/rules/prop-types.js - About 7 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 178 lines of code (exceeds 25 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: Major
        Found in lib/rules/jsx-closing-bracket-location.js - About 7 hrs to fix

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

            create(context) {
              function isSetStateCall(node) {
                return node.type === 'CallExpression'
                  && node.callee.property
                  && node.callee.property.name === 'setState'
          Severity: Minor
          Found in lib/rules/no-access-state-in-setstate.js - About 7 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 175 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            create(context) {
              // --------------------------------------------------------------------------
              // Public
              // --------------------------------------------------------------------------
              const indexParamNames = [];
          Severity: Major
          Found in lib/rules/no-array-index-key.js - About 7 hrs to fix

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

                function getPropertyName(node) {
                  if (node.key || ['MethodDefinition', 'Property'].indexOf(node.type) !== -1) {
                    return node.key.name;
                  }
                  if (node.type === 'MemberExpression') {
            Severity: Major
            Found in lib/rules/sort-default-props.js and 1 other location - About 7 hrs to fix
            lib/rules/jsx-sort-default-props.js on lines 58..72

            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 175.

            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

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

                function getPropertyName(node) {
                  if (node.key || ['MethodDefinition', 'Property'].indexOf(node.type) !== -1) {
                    return node.key.name;
                  }
                  if (node.type === 'MemberExpression') {
            Severity: Major
            Found in lib/rules/jsx-sort-default-props.js and 1 other location - About 7 hrs to fix
            lib/rules/sort-default-props.js on lines 53..67

            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 175.

            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

                  if (hasLeftNewline && !needsNewlines) {
                    report(context, messages.unexpectedAfter, 'unexpectedAfter', {
                      node: leftCurly,
                      fix(fixer) {
                        return sourceCode
            Severity: Major
            Found in lib/rules/jsx-curly-newline.js and 1 other location - About 6 hrs to fix
            lib/rules/jsx-curly-newline.js on lines 148..168

            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 173.

            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

                  if (hasRightNewline && !needsNewlines) {
                    report(context, messages.unexpectedBefore, 'unexpectedBefore', {
                      node: rightCurly,
                      fix(fixer) {
                        return sourceCode
            Severity: Major
            Found in lib/rules/jsx-curly-newline.js and 1 other location - About 6 hrs to fix
            lib/rules/jsx-curly-newline.js on lines 129..146

            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 173.

            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 create has 172 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              create: Components.detect((context, components, utils) => {
                const config = context.options[0] || {};
                const ignoreTranspilerName = config.ignoreTranspilerName || false;
                const checkContextObjects = (config.checkContextObjects || false) && testReactVersion(context, '>= 16.3.0');
            
            
            Severity: Major
            Found in lib/rules/display-name.js - About 6 hrs to fix

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

                create(context) {
                  const allowed = new Set(((context.options.length > 0) && context.options[0].allow) || []);
              
                  /**
                   * @param {ASTNode} expression An Identifier node
              Severity: Minor
              Found in lib/rules/style-prop-object.js - About 6 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 43 (exceeds 5 allowed). Consider refactoring.
              Open

                create(context) {
                  const config = context.options[0] || {};
                  const allowExpressions = config.allowExpressions || false;
              
                  const reactPragma = pragmaUtil.getFromContext(context);
              Severity: Minor
              Found in lib/rules/jsx-no-useless-fragment.js - About 6 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

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

                  function checkSorted(declarations) {
                    // function fix(fixer) {
                    //   return propTypesSortUtil.fixPropTypesSort(fixer, context, declarations, ignoreCase);
                    // }
              
              
              Severity: Major
              Found in lib/rules/sort-default-props.js and 1 other location - About 6 hrs to fix
              lib/rules/jsx-sort-default-props.js on lines 112..141

              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 166.

              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

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

                  function checkSorted(declarations) {
                    // function fix(fixer) {
                    //   return propTypesSortUtil.fixPropTypesSort(fixer, context, declarations, ignoreCase);
                    // }
              
              
              Severity: Major
              Found in lib/rules/jsx-sort-default-props.js and 1 other location - About 6 hrs to fix
              lib/rules/sort-default-props.js on lines 107..136

              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 166.

              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 create has 156 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                create: Components.detect((context, components, utils) => {
                  const configuration = context.options[0] || DEFAULT_OPTION;
                  const ignoreClassFields = (context.options[1] && (context.options[1].ignoreClassFields === true)) || false;
                  const destructureInSignature = (context.options[1] && context.options[1].destructureInSignature) || 'ignore';
                  const sfcParams = createSFCParams();
              Severity: Major
              Found in lib/rules/destructuring-assignment.js - About 6 hrs to fix

                Function create has 156 lines of code (exceeds 25 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: Major
                Found in lib/rules/jsx-one-expression-per-line.js - About 6 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language