yannickcr/eslint-plugin-react

View on GitHub

Showing 710 of 710 total issues

Function validateCurlys has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function validateCurlys(curlys, expression) {
      const leftCurly = curlys.leftCurly;
      const rightCurly = curlys.rightCurly;
      const tokenAfterLeftCurly = sourceCode.getTokenAfter(leftCurly);
      const tokenBeforeRightCurly = sourceCode.getTokenBefore(rightCurly);
Severity: Minor
Found in lib/rules/jsx-curly-newline.js - About 1 hr to fix

    Function makeNoMethodSetStateRule has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function create has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      create(context) {
        function validate(node, children) {
          let currentIsInline = false;
          let previousIsInline = false;
          if (!children) {
    Severity: Minor
    Found in lib/rules/no-adjacent-inline-elements.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function create has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      create(context) {
        const options = Object.assign({}, optionDefaults, context.options[0]);
    
        return {
          JSXOpeningElement(node) {
    Severity: Minor
    Found in lib/rules/jsx-tag-spacing.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function create has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      create(context) {
        const configuration = context.options[0] || {};
        const forbid = new Map((configuration.forbid || DEFAULTS).map((value) => {
          const propName = typeof value === 'string' ? value : value.propName;
          return [propName, {
    Severity: Minor
    Found in lib/rules/forbid-dom-props.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function create has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      create(context) {
        const configuration = context.options[0] || {};
        const maximum = configuration.maximum || 1;
    
        const maxConfig = typeof maximum === 'number'
    Severity: Minor
    Found in lib/rules/jsx-max-props-per-line.js - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function isReturningJSX has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function isReturningJSX(context, ASTnode, strict, ignoreNull) {
      const isJSXValue = (node) => {
        if (!node) {
          return false;
        }
    Severity: Minor
    Found in lib/util/jsx.js - About 1 hr to fix

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

        create(context) {
          const filename = context.getFilename();
      
          let jsxNode;
      
      
      Severity: Minor
      Found in lib/rules/jsx-filename-extension.js - About 1 hr to fix

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

          if (node.value.expression.type === 'ObjectExpression') {
            const data = { attributeName: attribute };
        
            report(context, messages.onlyStrings, 'onlyStrings', {
              node: node.value,
        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 459..471

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

        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

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

          } else if (node.value.expression.type === 'Identifier' && node.value.expression.name === 'undefined') {
            const data = { attributeName: attribute };
        
            report(context, messages.onlyStrings, 'onlyStrings', {
              node: node.value,
        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 447..471

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

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

              MemberExpression(node) {
                if (
                  'name' in node.property
                  && node.property.name === 'state'
                  && node.object.type === 'ThisExpression'
        Severity: Minor
        Found in lib/rules/no-access-state-in-setstate.js - About 1 hr to fix

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

            create: Components.detect((context, components) => {
              function reportReadOnlyProp(prop, propName, fixer) {
                report(context, messages.readOnlyProp, 'readOnlyProp', {
                  node: prop.node,
                  data: {
          Severity: Minor
          Found in lib/rules/prefer-read-only-props.js - About 1 hr to fix

            Function ArrayExpression, JSXElement > JSXElement has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  'ArrayExpression, JSXElement > JSXElement'(node) {
                    if (isWithinChildrenToArray) {
                      return;
                    }
            
            
            Severity: Minor
            Found in lib/rules/jsx-key.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if (
                    node.parent
                    && node.parent.callee
                    && propTypesArguments
                    && propTypesArguments.params
              Severity: Critical
              Found in lib/util/propTypes.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                          if (
                            node.decorators[i].expression
                            && node.decorators[i].expression.callee
                            && node.decorators[i].expression.callee.object
                            && node.decorators[i].expression.callee.object.name === 'reactMixin'
                Severity: Critical
                Found in lib/rules/require-optimization.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                        if (
                          // Support allowAsProps option
                          (isDeclaredInsideProps && (allowAsProps || isComponentInRenderProp(node, context, propNamePattern)))
                  
                          // Prevent reporting components created inside Array.map calls
                  Severity: Critical
                  Found in lib/rules/no-unstable-nested-components.js - About 1 hr to fix

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

                        schema: [{
                          type: 'object',
                          properties: {
                            customValidators: {
                              type: 'array',
                    Severity: Major
                    Found in lib/rules/no-unstable-nested-components.js and 1 other location - About 1 hr to fix
                    lib/rules/forbid-prop-types.js on lines 41..58

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

                    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

                        schema: [{
                          type: 'object',
                          properties: {
                            forbid: {
                              type: 'array',
                    Severity: Major
                    Found in lib/rules/forbid-prop-types.js and 1 other location - About 1 hr to fix
                    lib/rules/no-unstable-nested-components.js on lines 272..289

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

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

                        function hasTranspilerName(node) {
                          const namedObjectAssignment = (
                            node.type === 'ObjectExpression'
                            && node.parent
                            && node.parent.parent
                    Severity: Minor
                    Found in lib/rules/display-name.js - About 1 hr to fix

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

                          CallExpression(node) {
                            if (node.callee.type !== 'MemberExpression' && node.callee.type !== 'Identifier') {
                              return;
                            }
                      
                      
                      Severity: Minor
                      Found in lib/rules/void-dom-elements-no-children.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language