yannickcr/eslint-plugin-react

View on GitHub

Showing 502 of 700 total issues

Function create has 48 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: Minor
Found in lib/rules/no-unescaped-entities.js - About 1 hr to fix

    Function JSXOpeningElement has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          JSXOpeningElement(node) {
            node.attributes.forEach((attrNode) => {
              if (!hasEqual(attrNode)) {
                return;
              }
    Severity: Minor
    Found in lib/rules/jsx-equals-spacing.js - About 1 hr to fix

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

        create(context) {
          const configuration = context.options[0] || 'multiline-multiprop';
      
          function isMultilineJSX(jsxNode) {
            return jsxNode.loc.start.line < jsxNode.loc.end.line;
      Severity: Minor
      Found in lib/rules/jsx-first-prop-new-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 validateBeforeClosing has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      function validateBeforeClosing(context, node, option) {
        // Don't enforce this rule for self closing tags
        if (!node.selfClosing) {
          const sourceCode = getSourceCode(context);
          const leftToken = option === 'proportional-always'
      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 attributeValuePossiblyBlank has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      function attributeValuePossiblyBlank(attribute) {
        if (!attribute || !attribute.value) {
          return false;
        }
        const value = attribute.value;
      Severity: Minor
      Found in lib/rules/jsx-no-target-blank.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 checkCreateProps has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function checkCreateProps(context, node, attribute) {
        const propsArg = node.arguments[1];
      
        if (!propsArg || propsArg.type !== 'ObjectExpression') {
          return; // can't check variables, computed, or shorthands
      Severity: Minor
      Found in lib/rules/no-invalid-html-attribute.js - About 1 hr to fix

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

            create(context) {
              const mode = context.options[0] || 'allow-in-func';
        
              function nameMatches(name) {
                if (name === methodName) {
        Severity: Minor
        Found in lib/util/makeNoMethodSetStateRule.js - About 1 hr to fix

          Function ruleFixer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function ruleFixer(context, fixStrategy, fixer, reportedNode, leftNode, rightNode) {
            const rightSideText = getText(context, rightNode);
          
            if (fixStrategy === COERCE_STRATEGY) {
              const expressions = extractExpressionBetweenLogicalAnds(leftNode);
          Severity: Minor
          Found in lib/rules/jsx-no-leaked-render.js - About 1 hr to fix

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

              create(context) {
                const configuration = context.options[0] || {};
                const ignoreHtmlTags = (configuration.html || DEFAULTS.html) === OPTIONS.ignore;
                const ignoreCustomTags = (configuration.custom || DEFAULTS.custom) === OPTIONS.ignore;
                const ignoreExplicitSpread = (configuration.explicitSpread || DEFAULTS.explicitSpread) === OPTIONS.ignore;
            Severity: Minor
            Found in lib/rules/jsx-props-no-spreading.js - About 1 hr to fix

              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) {
                    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 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 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 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

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

                      create(context) {
                        function isComponent(node) {
                          return (
                            node.name
                            && (node.name.type === 'JSXIdentifier' || node.name.type === 'JSXMemberExpression')
                    Severity: Minor
                    Found in lib/rules/self-closing-comp.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
                                && node.parent.typeParameters
                                && node.parent.typeParameters.params
                          Severity: Critical
                          Found in lib/util/propTypes.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language