yannickcr/eslint-plugin-react

View on GitHub

Showing 710 of 710 total issues

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

  create(context) {
    const config = context.options[0];
    let option = defaultOption;

    if (typeof config === 'string') {
Severity: Major
Found in lib/rules/jsx-closing-tag-location.js - About 2 hrs to fix

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

      create(context) {
        function reportInvalidEntity(node) {
          const configuration = context.options[0] || {};
          const entities = configuration.forbid || DEFAULTS;
    
    
    Severity: Major
    Found in lib/rules/no-unescaped-entities.js - About 2 hrs to fix

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

          function needsOpeningNewLine(node) {
            const previousToken = getSourceCode(context).getTokenBefore(node);
      
            if (!isParenthesized(context, node)) {
              return false;
      Severity: Major
      Found in lib/rules/jsx-wrap-multilines.js and 1 other location - About 2 hrs to fix
      lib/rules/jsx-wrap-multilines.js on lines 113..125

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

      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 needsClosingNewLine(node) {
            const nextToken = getSourceCode(context).getTokenAfter(node);
      
            if (!isParenthesized(context, node)) {
              return false;
      Severity: Major
      Found in lib/rules/jsx-wrap-multilines.js and 1 other location - About 2 hrs to fix
      lib/rules/jsx-wrap-multilines.js on lines 99..111

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

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

        function sortInSource(allNodes, source) {
          const originalSource = source;
          const sourceCode = getSourceCode(context);
          for (let i = 0; i < allNodes.length; i++) {
            const node = allNodes[i];
      Severity: Major
      Found in lib/util/propTypesSort.js - About 2 hrs to fix

        Function makeNoMethodSetStateRule has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function makeNoMethodSetStateRule(methodName, shouldCheckUnsafeCb) {
          return {
            meta: {
              docs: {
                description: `Disallow usage of setState in ${methodName}`,
        Severity: Major
        Found in lib/util/makeNoMethodSetStateRule.js - About 2 hrs to fix

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

              contextName() {
                const found = queue.find((params) => {
                  const context = params[1];
                  return context && !context.destructuring && context.name;
                });
          Severity: Major
          Found in lib/rules/destructuring-assignment.js and 1 other location - About 2 hrs to fix
          lib/rules/destructuring-assignment.js on lines 28..34

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

          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

              propsName() {
                const found = queue.find((params) => {
                  const props = params[0];
                  return props && !props.destructuring && props.name;
                });
          Severity: Major
          Found in lib/rules/destructuring-assignment.js and 1 other location - About 2 hrs to fix
          lib/rules/destructuring-assignment.js on lines 35..41

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

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

              isReactHookCall(node, expectedHookNames) {
                if (!astUtil.isCallExpression(node)) {
                  return false;
                }
          
          
          Severity: Major
          Found in lib/util/Components.js - About 2 hrs to fix

            Function getGroupsOfSortableAttributes has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getGroupsOfSortableAttributes(attributes, context) {
              const sourceCode = getSourceCode(context);
            
              const sortableAttributeGroups = [];
              let groupCount = 0;
            Severity: Major
            Found in lib/rules/jsx-sort-props.js - About 2 hrs to fix

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

                create: Components.detect((context, components) => {
                  const defaults = { skipShapeProps: true, customValidators: [], ignore: [] };
                  const configuration = Object.assign({}, defaults, context.options[0] || {});
              
                  /**
              Severity: Major
              Found in lib/rules/no-unused-prop-types.js - About 2 hrs to fix

                Function validateBraceSpacing has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function validateBraceSpacing(node) {
                      let config;
                      switch (node.parent.type) {
                        case 'JSXAttribute':
                        case 'JSXOpeningElement':
                Severity: Major
                Found in lib/rules/jsx-curly-spacing.js - About 2 hrs to fix

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

                      function reportRequiredEndingSpace(node, token) {
                        report(context, messages.spaceNeededBefore, 'spaceNeededBefore', {
                          node,
                          loc: token.loc.start,
                          data: {
                  Severity: Major
                  Found in lib/rules/jsx-curly-spacing.js and 1 other location - About 2 hrs to fix
                  lib/rules/jsx-curly-spacing.js on lines 318..329

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

                  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 reportRequiredBeginningSpace(node, token) {
                        report(context, messages.spaceNeededAfter, 'spaceNeededAfter', {
                          node,
                          loc: token.loc.start,
                          data: {
                  Severity: Major
                  Found in lib/rules/jsx-curly-spacing.js and 1 other location - About 2 hrs to fix
                  lib/rules/jsx-curly-spacing.js on lines 337..348

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

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

                        VariableDeclarator(node) {
                          const classComponent = utils.getParentComponent(node);
                          const SFCComponent = components.get(getScope(context, node).block);
                  
                          const destructuring = (node.init && node.id && node.id.type === 'ObjectPattern');
                  Severity: Major
                  Found in lib/rules/destructuring-assignment.js - About 2 hrs to fix

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

                      create(context) {
                        const options = Object.assign({}, defaultOptions, context.options[0]);
                    
                        function reportMissingProperty(node) {
                          report(
                    Severity: Major
                    Found in lib/rules/checked-requires-onchange-or-readonly.js - About 2 hrs to fix

                      Function validateClosingSlash has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function validateClosingSlash(context, node, option) {
                        const sourceCode = getSourceCode(context);
                      
                        let adjacent;
                      
                      
                      Severity: Major
                      Found in lib/rules/jsx-tag-spacing.js - About 2 hrs to fix

                        File sort-prop-types.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /**
                         * @fileoverview Enforce propTypes declarations alphabetical sorting
                         */
                        
                        'use strict';
                        Severity: Minor
                        Found in lib/rules/sort-prop-types.js - About 2 hrs to fix

                          Consider simplifying this complex logical expression.
                          Open

                                } else if (props.type === 'ObjectPattern') {
                                  // Filter required props with default value and report error
                                  props.properties.filter((prop) => {
                                    const propName = prop && prop.key && prop.key.name;
                                    const isPropRequired = propTypes[propName] && propTypes[propName].isRequired;
                          Severity: Critical
                          Found in lib/rules/require-default-props.js - About 2 hrs to fix

                            Consider simplifying this complex logical expression.
                            Open

                                  if (
                                    (expressionType === 'Literal' || expressionType === 'JSXText')
                                      && typeof expression.value === 'string'
                                      && (
                                        (JSXExpressionNode.parent.type === 'JSXAttribute' && !isWhiteSpaceLiteral(expression))
                            Severity: Critical
                            Found in lib/rules/jsx-curly-brace-presence.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language