yannickcr/eslint-plugin-react

View on GitHub

Showing 710 of 710 total issues

Function getFixerFunction has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function getFixerFunction(node, needed) {
      const indent = repeat(indentChar, needed);

      if (node.type === 'JSXText' || node.type === 'Literal') {
        return function fix(fixer) {
Severity: Minor
Found in lib/rules/jsx-indent.js - About 1 hr to fix

    Function create has 28 lines of code (exceeds 25 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

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

        create(context) {
          return {
            JSXAttribute(node) {
              const attributes = new Set(context.options[0] || DEFAULT_ATTRIBUTES);
      
      
      Severity: Minor
      Found in lib/rules/no-invalid-html-attribute.js - About 1 hr to fix

        Function validateSandboxAttribute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function validateSandboxAttribute(context, node, attribute) {
          if (typeof attribute !== 'string') {
            // Only string literals are supported for now
            return;
          }
        Severity: Minor
        Found in lib/rules/iframe-missing-sandbox.js - About 1 hr to fix

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

                case 'LogicalExpression':
                  if (strict) {
                    return isJSXValue(node.left) && isJSXValue(node.right);
                  }
                  return isJSXValue(node.left) || isJSXValue(node.right);
          Severity: Major
          Found in lib/util/jsx.js and 1 other location - About 1 hr to fix
          lib/util/jsx.js on lines 101..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 57.

          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 'ConditionalExpression':
                  if (strict) {
                    return isJSXValue(node.consequent) && isJSXValue(node.alternate);
                  }
                  return isJSXValue(node.consequent) || isJSXValue(node.alternate);
          Severity: Major
          Found in lib/util/jsx.js and 1 other location - About 1 hr to fix
          lib/util/jsx.js on lines 106..110

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

          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 (expr.alternate.type === 'Literal' && expr.alternate.value && expr.alternate.value.toLowerCase() === '_blank') {
                  return true;
                }
          Severity: Major
          Found in lib/rules/jsx-no-target-blank.js and 1 other location - About 1 hr to fix
          lib/rules/jsx-no-target-blank.js on lines 44..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 57.

          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 ES5 or ES6 class for React Components',
                category: 'Stylistic Issues',
                recommended: false,
          Severity: Major
          Found in lib/rules/prefer-es6-class.js and 1 other location - About 1 hr to fix
          lib/rules/state-in-constructor.js on lines 24..37

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

          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 (expr.consequent.type === 'Literal' && expr.consequent.value && expr.consequent.value.toLowerCase() === '_blank') {
                  return true;
                }
          Severity: Major
          Found in lib/rules/jsx-no-target-blank.js and 1 other location - About 1 hr to fix
          lib/rules/jsx-no-target-blank.js on lines 41..43

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

          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 class component state initialization style',
                category: 'Stylistic Issues',
                recommended: false,
          Severity: Major
          Found in lib/rules/state-in-constructor.js and 1 other location - About 1 hr to fix
          lib/rules/prefer-es6-class.js on lines 23..36

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

          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 getVariableFromContext has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function getVariableFromContext(context, node, name) {
            let scope = getScope(context, node);
          
            while (scope) {
              let variable = getVariable(scope.variables, name);
          Severity: Minor
          Found in lib/util/variable.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 10 (exceeds 5 allowed). Consider refactoring.
          Open

            create(context) {
              /**
               * Checks for shouldComponentUpdate property
               * @param {ASTNode} node The AST node being checked.
               * @returns {boolean} Whether or not the property exists.
          Severity: Minor
          Found in lib/rules/no-redundant-should-component-update.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 10 (exceeds 5 allowed). Consider refactoring.
          Open

            create(context) {
              const configuration = context.options[0] || NEVER;
              const configObject = context.options[1] || {};
              const exceptions = new Set((configuration === ALWAYS ? configObject[NEVER] : configObject[ALWAYS]) || []);
          
          
          Severity: Minor
          Found in lib/rules/jsx-boolean-value.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 reportUnusedPropType has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function reportUnusedPropType(component, props) {
                // Skip props that check instances
                if (props === true) {
                  return;
                }
          Severity: Minor
          Found in lib/rules/no-unused-prop-types.js - About 1 hr to fix

            Function create has 27 lines of code (exceeds 25 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

              Function normalizeConfig has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function normalizeConfig(config) {
                /** @type {Config} */
                const normalizedConfig = Object.assign(normalizeElementConfig(config), {
                  elementOverrides: {},
                });
              Severity: Minor
              Found in lib/rules/jsx-no-literals.js - About 1 hr to fix

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

                  create(context) {
                    const option = context.options[0] || 'always';
                    return {
                      'ClassProperty, PropertyDefinition'(node) {
                        if (
                Severity: Minor
                Found in lib/rules/state-in-constructor.js - About 1 hr to fix

                  Function getNodeViolationType has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function getNodeViolationType(node) {
                        if (
                          !configuration.allowBind
                          && astUtil.isCallExpression(node)
                          && node.callee.type === 'MemberExpression'
                  Severity: Minor
                  Found in lib/rules/jsx-no-bind.js - About 1 hr to fix

                    Function JSXElement has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        JSXElement(node) {
                          const elementName = node.openingElement.name.name;
                    
                          if (!isVoidDOMElement(elementName)) {
                            // e.g. <div />
                    Severity: Minor
                    Found in lib/rules/void-dom-elements-no-children.js - About 1 hr to fix

                      Function JSXExpressionContainer > LogicalExpression[operator="&&"] has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            'JSXExpressionContainer > LogicalExpression[operator="&&"]'(node) {
                              const leftSide = node.left;
                      
                              const isCoerceValidLeftSide = COERCE_VALID_LEFT_SIDE_EXPRESSIONS
                                .some((validExpression) => validExpression === leftSide.type);
                      Severity: Minor
                      Found in lib/rules/jsx-no-leaked-render.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language