yannickcr/eslint-plugin-react

View on GitHub

Showing 502 of 700 total issues

Function markAnnotatedFunctionArgumentsAsDeclared has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function markAnnotatedFunctionArgumentsAsDeclared(node, rootNode) {
    if (!node.params || !node.params.length) {
      return;
    }

Severity: Major
Found in lib/util/propTypes.js - About 2 hrs to fix

    Function makeNoMethodSetStateRule has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

        create(context) {
          const allowed = new Set(((context.options.length > 0) && context.options[0].allow) || []);
      
          /**
           * @param {ASTNode} expression An Identifier node
      Severity: Major
      Found in lib/rules/style-prop-object.js - About 2 hrs to fix

        Function getGroupsOfSortableAttributes has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getGroupsOfSortableAttributes(attributes, context) {
          const sourceCode = getSourceCode(context);
        
          const sortableAttributeGroups = [];
          let groupCount = 0;
        Severity: Major
        Found in lib/rules/jsx-sort-props.js - About 2 hrs to fix

          Function checkCreateProps has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 validateBraceSpacing has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function validateBraceSpacing(node) {
                let config;
                switch (node.parent.type) {
                  case 'JSXAttribute':
                  case 'JSXOpeningElement':
          Severity: Major
          Found in lib/rules/jsx-curly-spacing.js - About 2 hrs to fix

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

              create(context) {
                const options = Object.assign({}, defaultOptions, context.options[0]);
            
                function reportMissingProperty(node) {
                  report(
            Severity: Major
            Found in lib/rules/checked-requires-onchange-or-readonly.js - About 2 hrs to fix

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

                    VariableDeclarator(node) {
                      const classComponent = utils.getParentComponent(node);
                      const SFCComponent = components.get(getScope(context, node).block);
              
                      const destructuring = (node.init && node.id && node.id.type === 'ObjectPattern');
              Severity: Major
              Found in lib/rules/destructuring-assignment.js - About 2 hrs to fix

                Function validateClosingSlash has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function validateClosingSlash(context, node, option) {
                  const sourceCode = getSourceCode(context);
                
                  let adjacent;
                
                
                Severity: Major
                Found in lib/rules/jsx-tag-spacing.js - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if (
                            (node.property
                            && (
                              !node.computed
                              && node.property.type === 'Identifier'
                  Severity: Critical
                  Found in lib/rules/forbid-foreign-prop-types.js - About 2 hrs to fix

                    Function Program:exit has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          'Program:exit'() {
                            jsxElementParents.forEach((parent) => {
                              parent.children.forEach((element, index, elements) => {
                                if (element.type === 'JSXElement' || element.type === 'JSXExpressionContainer') {
                                  const configuration = context.options[0] || {};
                    Severity: Major
                    Found in lib/rules/jsx-newline.js - About 2 hrs to fix

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

                        create(context) {
                          const config = context.options[0] || {};
                          const allowGlobals = config.allowGlobals || false;
                      
                          /**
                      Severity: Major
                      Found in lib/rules/jsx-no-undef.js - About 2 hrs to fix

                        Function sortInSource has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function sortInSource(allNodes, source) {
                            const originalSource = source;
                            const sourceCode = getSourceCode(context);
                            for (let i = 0; i < allNodes.length; i++) {
                              const node = allNodes[i];
                        Severity: Major
                        Found in lib/util/propTypesSort.js - About 2 hrs to fix

                          Function validateBeforeClosing has 57 lines of code (exceeds 25 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: Major
                          Found in lib/rules/jsx-tag-spacing.js - About 2 hrs to fix

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

                              create(context) {
                                const pragma = pragmaUtil.getFromContext(context);
                                const deprecated = getDeprecated(pragma);
                            
                                function isDeprecated(method) {
                            Severity: Minor
                            Found in lib/rules/no-deprecated.js - About 2 hrs 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 sorter has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast, noSortAlphabetically) {
                              const aKey = String(astUtil.getKeyValue(context, a));
                              const bKey = String(astUtil.getKeyValue(context, b));
                            
                              if (requiredFirst) {
                            Severity: Minor
                            Found in lib/util/propTypesSort.js - About 2 hrs 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 a Cognitive Complexity of 17 (exceeds 5 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 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
                            Open

                              create(context) {
                                const options = Object.assign({}, defaultOptions, context.options[0]);
                            
                                function reportMissingProperty(node) {
                                  report(
                            Severity: Minor
                            Found in lib/rules/checked-requires-onchange-or-readonly.js - About 2 hrs 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 56 lines of code (exceeds 25 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: Major
                            Found in lib/rules/jsx-boolean-value.js - About 2 hrs to fix

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

                                create: Components.detect((context, components, utils) => {
                                  return {
                                    JSXOpeningElement(node) {
                                      const openingElementName = node.name;
                                      if (openingElementName.type !== 'JSXMemberExpression') {
                              Severity: Major
                              Found in lib/rules/jsx-no-constructed-context-values.js - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language