yannickcr/eslint-plugin-react

View on GitHub

Showing 710 of 710 total issues

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

            if (configuration === 'syntax' && !(attrs && attrs.length > 0)) {
              report(context, messages.preferFragment, 'preferFragment', {
                node,
                data: {
                  react: reactPragma,
Severity: Minor
Found in lib/rules/jsx-fragments.js and 1 other location - About 40 mins to fix
lib/rules/jsx-fragments.js on lines 158..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 49.

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

  return node.type === 'JSXAttribute'
    && node.name
    && node.name.type === 'JSXIdentifier'
    && node.name.name === 'key';
Severity: Minor
Found in lib/util/jsx.js and 1 other location - About 40 mins to fix
lib/rules/iframe-missing-sandbox.js on lines 71..74

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

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.type === 'ObjectExpression'
        && node.parent
        && node.parent.parent
        && node.parent.parent.type === 'AssignmentExpression'
Severity: Minor
Found in lib/rules/display-name.js and 1 other location - About 40 mins to fix
lib/rules/display-name.js on lines 130..133

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

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

  recommended: {
    plugins: { react: plugin },
    rules: configs.recommended.rules,
    languageOptions: { parserOptions: configs.recommended.parserOptions },
  },
Severity: Minor
Found in index.js and 1 other location - About 40 mins to fix
index.js on lines 107..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 49.

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

Consider simplifying this complex logical expression.
Open

    if (
      astUtil.isCallExpression(value)
      && value.callee
      && value.callee.property
      && value.callee.property.name
Severity: Major
Found in lib/util/propTypes.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

                if (((n.type === 'AssignmentExpression') && propsUtil.isPropTypesDeclaration(n.left))
                  || ((n.type === 'ClassProperty' || n.type === 'PropertyDefinition' || n.type === 'Property') && propsUtil.isPropTypesDeclaration(n))) {
                  // Found a propType used inside of another propType. This is not considered usage, we'll still validate
                  // this component.
                  isUsedInPropTypes = true;
    Severity: Major
    Found in lib/util/propTypes.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

          if (
            unwrappedParentCalleeNode
            && unwrappedParentCalleeNode.property
            && unwrappedParentCalleeNode.property.name === 'setState'
            // Make sure we are in the updater not the callback
      Severity: Major
      Found in lib/util/usedPropTypes.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                  if (
                    property
                    && 'key' in property
                    && property.key
                    && 'name' in property.key
        Severity: Major
        Found in lib/rules/no-access-state-in-setstate.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                if (
                  !component.node.parent
                  || component.node.parent.type !== 'VariableDeclarator'
                  || !component.node.parent.id
                  || component.node.parent.id.type !== 'Identifier'
          Severity: Major
          Found in lib/rules/boolean-prop-naming.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if (
                      !isRender
                      || (allowNull && (isReturningJSX || isReturningNull))
                      || (!allowNull && isReturningJSX)
                    ) {
            Severity: Major
            Found in lib/rules/prefer-stateless-function.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if (
                        classComponent && destructuringClass && configuration === 'never'
                        && !(ignoreClassFields && (node.parent.type === 'ClassProperty' || node.parent.type === 'PropertyDefinition'))
                      ) {
                        report(context, messages.noDestructAssignment, 'noDestructAssignment', {
              Severity: Major
              Found in lib/rules/destructuring-assignment.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if (
                          SFCComponent
                          && destructuringSFC
                          && configuration === 'always'
                          && destructureInSignature === 'always'
                Severity: Major
                Found in lib/rules/destructuring-assignment.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                            if (isSingleGetter && isUseStateCalledWithSingleArgument) {
                              const useMemoReactImportSpecifier = namedReactImports
                                && namedReactImports.find((specifier) => specifier.imported.name === 'useMemo');
                  
                              let useMemoCode;
                  Severity: Major
                  Found in lib/rules/hook-use-state.js - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                          } else if (
                            expressionType === 'TemplateLiteral'
                            && expression.expressions.length === 0
                            && expression.quasis[0].value.raw.indexOf('\n') === -1
                            && !isStringWithTrailingWhiteSpaces(expression.quasis[0].value.raw)
                    Severity: Major
                    Found in lib/rules/jsx-curly-brace-presence.js - About 40 mins to fix

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

                              case 'line-aligned':
                                indentation = /^\s*/.exec(getSourceCode(context).lines[tokens.opening.line - 1])[0];
                                break;
                      Severity: Minor
                      Found in lib/rules/jsx-closing-bracket-location.js and 1 other location - About 40 mins to fix
                      lib/rules/jsx-closing-bracket-location.js on lines 176..178

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

                      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 4 locations. Consider refactoring.
                      Open

                                if (
                                  !propsUtil.isPropTypesDeclaration(property)
                                  && !isPropTypesPackage(property)
                                  && !shouldCheckContextTypes(property)
                                  && !shouldCheckChildContextTypes(property)
                      Severity: Major
                      Found in lib/rules/forbid-prop-types.js and 3 other locations - About 40 mins to fix
                      lib/rules/forbid-prop-types.js on lines 213..220
                      lib/rules/forbid-prop-types.js on lines 225..232
                      lib/rules/forbid-prop-types.js on lines 259..266

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

                      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 4 locations. Consider refactoring.
                      Open

                              if (
                                !propsUtil.isPropTypesDeclaration(node)
                                && !isPropTypesPackage(node)
                                && !shouldCheckContextTypes(node)
                                && !shouldCheckChildContextTypes(node)
                      Severity: Major
                      Found in lib/rules/forbid-prop-types.js and 3 other locations - About 40 mins to fix
                      lib/rules/forbid-prop-types.js on lines 225..232
                      lib/rules/forbid-prop-types.js on lines 259..266
                      lib/rules/forbid-prop-types.js on lines 281..288

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

                      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

                              case 'props-aligned':
                                indentation = /^\s*/.exec(getSourceCode(context).lines[tokens.lastProp.firstLine - 1])[0];
                                break;
                      Severity: Minor
                      Found in lib/rules/jsx-closing-bracket-location.js and 1 other location - About 40 mins to fix
                      lib/rules/jsx-closing-bracket-location.js on lines 180..182

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

                      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 4 locations. Consider refactoring.
                      Open

                              if (
                                !propsUtil.isPropTypesDeclaration(node)
                                && !isPropTypesPackage(node)
                                && !shouldCheckContextTypes(node)
                                && !shouldCheckChildContextTypes(node)
                      Severity: Major
                      Found in lib/rules/forbid-prop-types.js and 3 other locations - About 40 mins to fix
                      lib/rules/forbid-prop-types.js on lines 213..220
                      lib/rules/forbid-prop-types.js on lines 225..232
                      lib/rules/forbid-prop-types.js on lines 281..288

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

                      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 4 locations. Consider refactoring.
                      Open

                              if (
                                !propsUtil.isPropTypesDeclaration(node)
                                && !isPropTypesPackage(node)
                                && !shouldCheckContextTypes(node)
                                && !shouldCheckChildContextTypes(node)
                      Severity: Major
                      Found in lib/rules/forbid-prop-types.js and 3 other locations - About 40 mins to fix
                      lib/rules/forbid-prop-types.js on lines 213..220
                      lib/rules/forbid-prop-types.js on lines 259..266
                      lib/rules/forbid-prop-types.js on lines 281..288

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

                      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