yannickcr/eslint-plugin-react

View on GitHub

Showing 696 of 696 total issues

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

    if (node.loc.start.line !== node.loc.end.line && option === 'proportional-always') {
      if (leftToken.loc.end.line === closingToken.loc.start.line) {
        report(context, messages.beforeCloseNeedNewline, 'beforeCloseNeedNewline', {
          node,
          loc: leftToken.loc.end,
Severity: Major
Found in lib/rules/jsx-tag-spacing.js and 1 other location - About 4 hrs to fix
lib/rules/jsx-tag-spacing.js on lines 104..115

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

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

      CallExpression(node) {
        const isImmediateReturn = node.parent
          && node.parent.type === 'ReturnStatement';

        if (isImmediateReturn || !util.isReactHookCall(node, ['useState'])) {
Severity: Major
Found in lib/rules/hook-use-state.js - About 4 hrs to fix

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

      create(context) {
        function getIgnoreConfig() {
          return (context.options[0] && context.options[0].ignore) || DEFAULTS.ignore;
        }
    
    
    Severity: Minor
    Found in lib/rules/no-unknown-property.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 32 (exceeds 5 allowed). Consider refactoring.
    Open

      create(context) {
        const configuration = context.options[0] || {};
        const ignoreCase = configuration.ignoreCase || false;
    
        /**
    Severity: Minor
    Found in lib/rules/jsx-sort-default-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 a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

      create: Components.detect((context, components, utils) => {
        const typeAliases = {};
        const exactWrappers = propWrapperUtil.getExactPropWrapperFunctions(context);
        const sourceCode = context.getSourceCode();
    
    
    Severity: Minor
    Found in lib/rules/prefer-exact-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 isDestructuredFromPragmaImport has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function isDestructuredFromPragmaImport(variable, context) {
      const pragma = pragmaUtil.getFromContext(context);
      const variables = variableUtil.variablesInScope(context);
      const variableInScope = variableUtil.getVariable(variables, variable);
      if (variableInScope) {
    Severity: Minor
    Found in lib/util/isDestructuredFromPragmaImport.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 31 (exceeds 5 allowed). Consider refactoring.
    Open

      create(context) {
        const configuration = context.options[0] || {};
    
        // Keep track of all the variable names pointing to a bind call,
        // bind expression or an arrow function in different block statements
    Severity: Minor
    Found in lib/rules/jsx-no-bind.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 31 (exceeds 5 allowed). Consider refactoring.
    Open

      create(context) {
        function reportInvalidEntity(node) {
          const configuration = context.options[0] || {};
          const entities = configuration.forbid || DEFAULTS;
    
    
    Severity: Minor
    Found in lib/rules/no-unescaped-entities.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 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      create(context) {
        const configuration = context.options[0] || {};
    
        // Keep track of all the variable names pointing to a bind call,
        // bind expression or an arrow function in different block statements
    Severity: Major
    Found in lib/rules/jsx-no-bind.js - About 4 hrs to fix

      Function create has 114 lines of code (exceeds 25 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: Major
      Found in lib/rules/no-unused-class-component-methods.js - About 4 hrs to fix

        Function checkLiteralValueNode has 113 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function checkLiteralValueNode(context, attributeName, node, parentNode, parentNodeName) {
          if (typeof node.value !== 'string') {
            report(context, messages.onlyStrings, 'onlyStrings', {
              node,
              data: { attributeName },
        Severity: Major
        Found in lib/rules/no-invalid-html-attribute.js - About 4 hrs to fix

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

          function getName(node) {
            node = uncast(node);
            const type = node.type;
          
            if (type === 'Identifier') {
          Severity: Major
          Found in lib/rules/no-unused-state.js and 1 other location - About 4 hrs to fix
          lib/rules/no-unused-class-component-methods.js on lines 62..76

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

          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 getName(node) {
            node = uncast(node);
            const type = node.type;
          
            if (type === 'Identifier') {
          Severity: Major
          Found in lib/rules/no-unused-class-component-methods.js and 1 other location - About 4 hrs to fix
          lib/rules/no-unused-state.js on lines 29..43

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

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

              getStatelessComponent(node) {
                const parent = node.parent;
                if (
                  node.type === 'FunctionDeclaration'
                  && (!node.id || isFirstLetterCapitalized(node.id.name))
          Severity: Major
          Found in lib/util/Components.js - About 4 hrs to fix

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

              create(context) {
                const configuration = context.options[0] || {};
                const ignoreCase = configuration.ignoreCase || false;
            
                /**
            Severity: Minor
            Found in lib/rules/sort-default-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 110 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              create: Components.detect((context, components) => {
                const configuration = context.options[0] || {};
                const ignored = configuration.ignore || [];
                const skipUndeclared = configuration.skipUndeclared || false;
            
            
            Severity: Major
            Found in lib/rules/prop-types.js - About 4 hrs to fix

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

                create: Components.detect((context, components, utils) => {
                  const typeAliases = {};
                  const exactWrappers = propWrapperUtil.getExactPropWrapperFunctions(context);
                  const sourceCode = context.getSourceCode();
              
              
              Severity: Major
              Found in lib/rules/prefer-exact-props.js - About 4 hrs to fix

                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 222..234

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

                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 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 201..213

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

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

                  create(context) {
                    const configuration = context.options[0] || {};
                    const ignoreCase = configuration.ignoreCase || false;
                    const callbacksLast = configuration.callbacksLast || false;
                    const shorthandFirst = configuration.shorthandFirst || false;
                Severity: Major
                Found in lib/rules/jsx-sort-props.js - About 4 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language