yannickcr/eslint-plugin-react

View on GitHub

Showing 710 of 710 total issues

Function internalIsDeclaredInComponent has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function internalIsDeclaredInComponent(declaredPropTypes, keyList) {
      for (let i = 0, j = keyList.length; i < j; i++) {
        const key = keyList[i];
        const propType = (
          declaredPropTypes && (
Severity: Minor
Found in lib/rules/prop-types.js - About 1 hr to fix

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

      create: Components.detect((context, components) => {
        const configuration = context.options[0] || {};
        const allowRequiredDefaults = configuration.allowRequiredDefaults || false;
    
        /**
    Severity: Minor
    Found in lib/rules/default-props-match-prop-types.js - About 1 hr to fix

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

        create(context) {
          const configuration = context.options[0] || 'multiline-multiprop';
      
          function isMultilineJSX(jsxNode) {
            return jsxNode.loc.start.line < jsxNode.loc.end.line;
      Severity: Minor
      Found in lib/rules/jsx-first-prop-new-line.js - About 1 hr to fix

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

            if (attribute.type === 'JSXAttribute'
                && attribute.name
                && attribute.name.type === 'JSXIdentifier'
                && attribute.name.name === 'sandbox'
            ) {
        Severity: Major
        Found in lib/rules/iframe-missing-sandbox.js and 1 other location - About 1 hr to fix
        lib/rules/iframe-missing-sandbox.js on lines 98..103

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

        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

            report(context, messages.noEmpty, 'noEmpty', {
              node,
              data,
              suggest: [{
                messageId: 'suggestRemoveEmpty',
        Severity: Major
        Found in lib/rules/no-invalid-html-attribute.js and 1 other location - About 1 hr to fix
        lib/rules/no-invalid-html-attribute.js on lines 367..375

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

        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 (sandboxProp) {
              sandboxAttributeFound = true;
              if (sandboxProp.value && sandboxProp.value.type === 'Literal' && sandboxProp.value.value) {
                validateSandboxAttribute(context, node, sandboxProp.value.value);
              }
        Severity: Major
        Found in lib/rules/iframe-missing-sandbox.js and 1 other location - About 1 hr to fix
        lib/rules/iframe-missing-sandbox.js on lines 71..84

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

        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

              report(context, messages.spaceDelimited, 'spaceDelimited', {
                node,
                data,
                suggest: [{
                  messageId: 'suggestRemoveWhitespaces',
        Severity: Major
        Found in lib/rules/no-invalid-html-attribute.js and 1 other location - About 1 hr to fix
        lib/rules/no-invalid-html-attribute.js on lines 279..287

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

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

        function traverseReturns(ASTNode, context, onReturn) {
          const nodeType = ASTNode.type;
        
          if (nodeType === 'ReturnStatement') {
            onReturn(ASTNode.argument, () => {});
        Severity: Minor
        Found in lib/util/ast.js - About 1 hr to fix

          Function validate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function validate(node) {
                if (!node || !node.parent) {
                  return;
                }
          
          
          Severity: Minor
          Found in lib/rules/no-unstable-nested-components.js - About 1 hr to fix

            Function reportFunctionComponent has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function reportFunctionComponent(componentNode, declaredPropTypes, defaultProps) {
                  if (defaultProps) {
                    report(context, messages.noDefaultPropsWithFunction, 'noDefaultPropsWithFunction', {
                      node: componentNode,
                    });
            Severity: Minor
            Found in lib/rules/require-default-props.js - About 1 hr to fix

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

                      if (node.right.type === 'ObjectTypeAnnotation') {
                        const currentNode = [].concat(
                          typeAnnotations.get(node.id.name) || [],
                          node.right
                        );
              Severity: Major
              Found in lib/rules/sort-prop-types.js and 1 other location - About 1 hr to fix
              lib/rules/sort-prop-types.js on lines 304..310

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

              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 (functionExpr.parent.type === 'AssignmentExpression' && !isPropertyAssignment && utils.isReturningJSXOrNull(node)) {
                          if (isFirstLetterCapitalized(functionExpr.parent.left.name)) {
                            return node;
                          }
                          return undefined;
              Severity: Major
              Found in lib/util/Components.js and 1 other location - About 1 hr to fix
              lib/util/Components.js on lines 561..566

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

              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 (functionExpr.parent.type === 'Property' && !isPropertyAssignment && utils.isReturningJSXOrNull(node)) {
                          if (isFirstLetterCapitalized(functionExpr.parent.key.name)) {
                            return node;
                          }
                          return undefined;
              Severity: Major
              Found in lib/util/Components.js and 1 other location - About 1 hr to fix
              lib/util/Components.js on lines 550..555

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

              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.typeAnnotation.type === 'TSTypeLiteral' || node.typeAnnotation.type === 'ObjectTypeAnnotation') {
                        const currentNode = [].concat(
                          typeAnnotations.get(node.id.name) || [],
                          node.typeAnnotation
                        );
              Severity: Major
              Found in lib/rules/sort-prop-types.js and 1 other location - About 1 hr to fix
              lib/rules/sort-prop-types.js on lines 294..300

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

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

              module.exports = function isCreateContext(node) {
                if (
                  node.init
                  && node.init.callee
                ) {
              Severity: Minor
              Found in lib/util/isCreateContext.js - About 1 hr to fix

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

                  create(context) {
                    const configuration = context.options[0] || 'always';
                
                    // --------------------------------------------------------------------------
                    // Public
                Severity: Minor
                Found in lib/rules/jsx-space-before-closing.js - About 1 hr to fix

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

                    create(context) {
                      // --------------------------------------------------------------------------
                      // Public
                      // --------------------------------------------------------------------------
                  
                  
                  Severity: Minor
                  Found in lib/rules/no-render-return-value.js - About 1 hr to fix

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

                      create(context) {
                        const configuration = context.options[0] || {};
                        const allowAllCaps = configuration.allowAllCaps || false;
                        const allowLeadingUnderscore = configuration.allowLeadingUnderscore || false;
                        const allowNamespace = configuration.allowNamespace || false;
                    Severity: Minor
                    Found in lib/rules/jsx-pascal-case.js - About 1 hr to fix

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

                        addNamedReactImport(specifier) {
                          const info = ReactImports.get(this);
                          ReactImports.set(this, Object.assign({}, info, {
                            namedReactImports: (info.namedReactImports || []).concat(specifier),
                          }));
                      Severity: Major
                      Found in lib/util/Components.js and 1 other location - About 1 hr to fix
                      lib/util/Components.js on lines 219..224

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

                      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

                        addDefaultReactImport(specifier) {
                          const info = ReactImports.get(this);
                          ReactImports.set(this, Object.assign({}, info, {
                            defaultReactImports: (info.defaultReactImports || []).concat(specifier),
                          }));
                      Severity: Major
                      Found in lib/util/Components.js and 1 other location - About 1 hr to fix
                      lib/util/Components.js on lines 232..237

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language