yannickcr/eslint-plugin-react

View on GitHub

Showing 710 of 710 total issues

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

  meta: {
    docs: {
      description: 'Enforce shorthand or standard form for React fragments',
      category: 'Stylistic Issues',
      recommended: false,
Severity: Major
Found in lib/rules/jsx-fragments.js and 1 other location - About 1 hr to fix
lib/rules/jsx-equals-spacing.js on lines 25..39

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

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

  meta: {
    docs: {
      description: 'Enforce or disallow spaces around equal signs in JSX attributes',
      category: 'Stylistic Issues',
      recommended: false,
Severity: Major
Found in lib/rules/jsx-equals-spacing.js and 1 other location - About 1 hr to fix
lib/rules/jsx-fragments.js on lines 32..46

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

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 (!previousIsRequired && currentIsRequired) {
            // Encountered a non-required prop after a required prop
            if (!requiredPropsFirstSeen.has(curr)) {
              requiredPropsFirstSeen.add(curr);
              report(context, messages.requiredPropsFirst, 'requiredPropsFirst', {
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 160..170

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

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.parent
        && node.parent.parent
        && node.parent.parent.type === 'ConditionalExpression'
        && node.parent.parent.alternate === node.parent
        && getSourceCode(context).getTokenBefore(node).value !== '('
Severity: Major
Found in lib/rules/jsx-indent.js and 1 other location - About 1 hr to fix
lib/rules/jsx-indent.js on lines 205..209

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

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 (previousIsCallback && !currentIsCallback) {
            // Encountered a non-callback prop after a callback prop
            if (!callbackPropsLastSeen.has(prev)) {
              callbackPropsLastSeen.add(prev);
              report(context, messages.callbackPropsLast, 'callbackPropsLast', {
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 142..152

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

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 (
          parent
          && parent.type === 'MethodDefinition' && (
            (parent.static && parent.key.name === 'getDerivedStateFromProps')
            || classMethods.indexOf(parent.key.name) !== -1
Severity: Critical
Found in lib/rules/no-unused-state.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

          if (
            astUtil.isCallExpression(node)
            && node.callee
            && node.callee.type === 'MemberExpression'
            && node.callee.object
    Severity: Critical
    Found in lib/rules/no-array-index-key.js - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if (
                !node.value
                || !node.value.expression
                || (!checkInlineFunction && isInlineHandler(node))
                || (
      Severity: Critical
      Found in lib/rules/jsx-handler-names.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                if (
                  (configuration === 'multiline' && isMultilineJSX(node))
                  || (configuration === 'multiline-multiprop' && isMultilineJSX(node) && node.attributes.length > 1)
                  || (configuration === 'multiprop' && node.attributes.length > 1)
                  || (configuration === 'always')
        Severity: Critical
        Found in lib/rules/jsx-first-prop-new-line.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                      if (element.type === 'JSXElement' || element.type === 'JSXExpressionContainer') {
                        const configuration = context.options[0] || {};
                        const prevent = configuration.prevent || false;
                        const allowMultilines = configuration.allowMultilines || false;
          
          
          Severity: Critical
          Found in lib/rules/jsx-newline.js - About 1 hr to fix

            Function isJSXValue has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const isJSXValue = (node) => {
                if (!node) {
                  return false;
                }
                switch (node.type) {
            Severity: Minor
            Found in lib/util/jsx.js - About 1 hr to fix

              Function isReturningOnlyNull has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function isReturningOnlyNull(ASTnode, context) {
                let found = false;
                let foundSomethingElse = false;
                astUtil.traverseReturns(ASTnode, context, (node) => {
                  // Traverse return statement
              Severity: Minor
              Found in lib/util/jsx.js - About 1 hr to fix

                Function VariableDeclarator has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    VariableDeclarator(node) {
                      const unwrappedInitNode = ast.unwrapTSAsExpression(node.init);
                
                      // let props = this.props
                      if (isThisDotProps(unwrappedInitNode) && isInClassComponent(context, node) && node.id.type === 'Identifier') {
                Severity: Minor
                Found in lib/util/usedPropTypes.js - About 1 hr to fix

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

                        CallExpression(node) {
                          if (!isClassComponent(node)) {
                            return;
                          }
                          // Appends all the methods that are calling another
                  Severity: Minor
                  Found in lib/rules/no-access-state-in-setstate.js - About 1 hr to fix

                    Function validateAfterOpening has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function validateAfterOpening(context, node, option) {
                      const sourceCode = getSourceCode(context);
                      const openingToken = sourceCode.getTokenBefore(node.name);
                    
                      if (option === 'allow-multiline') {
                    Severity: Minor
                    Found in lib/rules/jsx-tag-spacing.js - About 1 hr to fix

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

                            'Program:exit'() {
                              values(components.list())
                                .filter((component) => !isValid(component))
                                .forEach((component) => {
                                  reportMutations(component);
                      Severity: Major
                      Found in lib/rules/no-direct-mutation-state.js and 1 other location - About 1 hr to fix
                      lib/rules/no-set-state.js on lines 79..85

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

                      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

                            }, {
                              type: 'array',
                              items: [{
                                enum: [NEVER],
                              }, {
                      Severity: Major
                      Found in lib/rules/jsx-boolean-value.js and 1 other location - About 1 hr to fix
                      lib/rules/jsx-boolean-value.js on lines 75..90

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

                      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

                            }, {
                              type: 'array',
                              items: [{
                                enum: [ALWAYS],
                              }, {
                      Severity: Major
                      Found in lib/rules/jsx-boolean-value.js and 1 other location - About 1 hr to fix
                      lib/rules/jsx-boolean-value.js on lines 90..105

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

                      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

                            'Program:exit'() {
                              values(components.list())
                                .filter((component) => !isValid(component))
                                .forEach((component) => {
                                  reportSetStateUsages(component);
                      Severity: Major
                      Found in lib/rules/no-set-state.js and 1 other location - About 1 hr to fix
                      lib/rules/no-direct-mutation-state.js on lines 146..152

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

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

                          endAndStructDeclaredPropTypes() {
                            if (this.shouldSpecifyOptionalChildrenProps) {
                              this.declaredPropTypes.children = {
                                fullName: 'children',
                                name: 'children',
                      Severity: Minor
                      Found in lib/util/propTypes.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language