yannickcr/eslint-plugin-react

View on GitHub

Showing 710 of 710 total issues

Function getFixer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function getFixer(node, options) {
      const source = getText(context);

      const typeAnnotation = getTypeAnnotation(node, source);

Severity: Minor
Found in lib/rules/function-component-definition.js - About 1 hr to fix

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

            const typeProp = props.find((prop) => (
              'key' in prop
              && prop.key
              && 'name' in prop.key
              && prop.key.name === 'type'
    Severity: Major
    Found in lib/rules/button-has-type.js and 1 other location - About 1 hr to fix
    lib/rules/no-children-prop.js on lines 91..96

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

    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

            const childrenProp = props.find((prop) => (
              'key' in prop
              && prop.key
              && 'name' in prop.key
              && prop.key.name === 'children'
    Severity: Major
    Found in lib/rules/no-children-prop.js and 1 other location - About 1 hr to fix
    lib/rules/button-has-type.js on lines 153..158

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

    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 (isMultiline(first, second)) {
              if (!config.allowMultiline) {
                reportNoBeginningNewline(node, first, spacing);
              }
            } else if (sourceCode.isSpaceBetweenTokens(first, second)) {
    Severity: Major
    Found in lib/rules/jsx-curly-spacing.js and 1 other location - About 1 hr to fix
    lib/rules/jsx-curly-spacing.js on lines 413..419

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

    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 (isMultiline(penultimate, last)) {
              if (!config.allowMultiline) {
                reportNoEndingNewline(node, last, spacing);
              }
            } else if (sourceCode.isSpaceBetweenTokens(penultimate, last)) {
    Severity: Major
    Found in lib/rules/jsx-curly-spacing.js and 1 other location - About 1 hr to fix
    lib/rules/jsx-curly-spacing.js on lines 406..412

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

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

          CallExpression(node) {
            if (!classInfo) {
              return;
            }
    
    
    Severity: Minor
    Found in lib/rules/no-unused-state.js - About 1 hr to fix

      Function CallExpression has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            CallExpression(node) {
              if (
                node.callee
                && node.callee.type === 'MemberExpression'
                && 'name' in node.callee.property
      Severity: Minor
      Found in lib/rules/no-danger-with-children.js - About 1 hr to fix

        Function CallExpression has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              CallExpression(node) {
                if (
                  isCreateElement(context, node)
                  && node.arguments.length > 1
                ) {
        Severity: Minor
        Found in lib/rules/style-prop-object.js - About 1 hr to fix

          Function fix has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                        fix(fixer) {
                          // eslint 5 uses `node.attributes`; eslint 6+ uses `node.parent.attributes`
                          const nodeWithAttrs = node.parent.attributes ? node.parent : node;
                          // eslint 5 does not provide a `name` property on JSXSpreadElements
                          const relAttribute = nodeWithAttrs.attributes.find((attr) => attr.name && attr.name.name === 'rel');
          Severity: Minor
          Found in lib/rules/jsx-no-target-blank.js - About 1 hr to fix

            Function Program:exit has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  'Program:exit'() {
                    flatMap(
                      values(components.list()),
                      (component) => component.declaredPropTypes || []
                    ).forEach((declaredPropTypes) => {
            Severity: Minor
            Found in lib/rules/prefer-read-only-props.js - About 1 hr to fix

              Function JSXOpeningElement has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    JSXOpeningElement(node) {
                      const isCompatTag = jsxUtil.isDOMComponent(node);
                      if (isCompatTag) return undefined;
              
                      const name = elementType(node);
              Severity: Minor
              Found in lib/rules/jsx-pascal-case.js - About 1 hr to fix

                Function reportUnnecessaryCurly has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function reportUnnecessaryCurly(JSXExpressionNode) {
                      report(context, messages.unnecessaryCurly, 'unnecessaryCurly', {
                        node: JSXExpressionNode,
                        fix(fixer) {
                          const expression = JSXExpressionNode.expression;
                Severity: Minor
                Found in lib/rules/jsx-curly-brace-presence.js - About 1 hr to fix

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

                    if (
                      jsxExpressionContainer
                      && jsxExpressionContainer.parent
                      && jsxExpressionContainer.parent.type === 'JSXAttribute'
                      && jsxExpressionContainer.parent.name
                  Severity: Major
                  Found in lib/rules/no-unstable-nested-components.js and 1 other location - About 1 hr to fix
                  lib/rules/no-unstable-nested-components.js on lines 185..193

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

                  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

                          node.object.type === 'MemberExpression' && node.object.object.type === 'ThisExpression'
                          && (node.object.property.name === 'props' || node.object.property.name === 'context' || node.object.property.name === 'state')
                  Severity: Major
                  Found in lib/rules/destructuring-assignment.js and 1 other location - About 1 hr to fix
                  lib/rules/destructuring-assignment.js on lines 256..258

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

                  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 (!sourceCode.isSpaceBetweenTokens(first, second)) {
                            reportRequiredBeginningSpace(node, first);
                          } else if (!config.allowMultiline && isMultiline(first, second)) {
                            reportNoBeginningNewline(node, first, spacing);
                          }
                  Severity: Major
                  Found in lib/rules/jsx-curly-spacing.js and 1 other location - About 1 hr to fix
                  lib/rules/jsx-curly-spacing.js on lines 400..404

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

                  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 (
                      node
                      && node.parent
                      && node.parent.type === 'JSXExpressionContainer'
                      && node.parent.parent
                  Severity: Major
                  Found in lib/rules/no-unstable-nested-components.js and 1 other location - About 1 hr to fix
                  lib/rules/no-unstable-nested-components.js on lines 198..216

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

                  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 (!sourceCode.isSpaceBetweenTokens(penultimate, last)) {
                            reportRequiredEndingSpace(node, last);
                          } else if (!config.allowMultiline && isMultiline(penultimate, last)) {
                            reportNoEndingNewline(node, last, spacing);
                          }
                  Severity: Major
                  Found in lib/rules/jsx-curly-spacing.js and 1 other location - About 1 hr to fix
                  lib/rules/jsx-curly-spacing.js on lines 395..399

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

                  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

                          const destructuringClass = destructuring && node.init.object && node.init.object.type === 'ThisExpression' && (
                            node.init.property.name === 'props' || node.init.property.name === 'context' || node.init.property.name === 'state'
                          );
                  Severity: Major
                  Found in lib/rules/destructuring-assignment.js and 1 other location - About 1 hr to fix
                  lib/rules/destructuring-assignment.js on lines 166..167

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

                  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 fixPropTypesSort has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    context,
                    fixer,
                    declarations,
                    ignoreCase,
                    requiredFirst,
                  Severity: Major
                  Found in lib/util/propTypesSort.js - About 1 hr to fix

                    Function list has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      list() {
                        const thisList = Lists.get(this);
                        const list = {};
                        const usedPropTypes = {};
                    
                    
                    Severity: Minor
                    Found in lib/util/Components.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language