pustovalov/eslint-plugin-react-extended

View on GitHub

Showing 101 of 125 total issues

Function traverseReturns has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function traverseReturns(ASTNode, context, enterFunc) {
  const nodeType = ASTNode.type;

  if (nodeType === 'ReturnStatement') {
    return enterFunc(ASTNode);
Severity: Minor
Found in lib/util/ast.js - About 1 hr to fix

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

    function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast) {
      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 1 hr to fix

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

        list() {
          const thisList = Lists.get(this);
          const list = {};
          const usedPropTypes = {};
      
      
      Severity: Minor
      Found in lib/util/Components.js - About 1 hr to fix

        Function getPropertyName has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getPropertyName(node, context, utils, checkAsyncSafeLifeCycles) {
          const property = node.property;
          if (property) {
            switch (property.type) {
              case 'Identifier':
        Severity: Minor
        Found in lib/util/usedPropTypes.js - About 1 hr to fix

          Function MemberExpression has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              MemberExpression(node) {
                const isDefaultProp = propsUtil.isDefaultPropsDeclaration(node);
          
                if (!isDefaultProp) {
                  return;
          Severity: Minor
          Found in lib/util/defaultProps.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                        if (
                          (ancestor.type !== 'Property' && ancestor.type !== 'MethodDefinition' && ancestor.type !== 'ClassProperty' && ancestor.type !== 'PropertyDefinition')
                          || !nameMatches(ancestor.key.name)
                          || (mode !== 'disallow-in-func' && depth > 1)
                        ) {
            Severity: Major
            Found in lib/util/makeNoMethodSetStateRule.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if (
                    value
                    && value.type === 'CallExpression'
                    && value.callee
                    && value.callee.property
              Severity: Major
              Found in lib/util/propTypes.js - About 1 hr to fix

                Function isPropTypesUsageByMemberExpression has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                function isPropTypesUsageByMemberExpression(node, context, utils, checkAsyncSafeLifeCycles) {
                  const unwrappedObjectNode = ast.unwrapTSAsExpression(node.object);
                
                  if (isInClassComponent(utils)) {
                    // this.props.*
                Severity: Minor
                Found in lib/util/usedPropTypes.js - About 55 mins 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 inLifeCycleMethod has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                function inLifeCycleMethod(context, checkAsyncSafeLifeCycles) {
                  let scope = context.getScope();
                  while (scope) {
                    if (scope.block && scope.block.parent && scope.block.parent.key) {
                      const name = scope.block.parent.key.name;
                Severity: Minor
                Found in lib/util/usedPropTypes.js - About 55 mins 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 fixPropTypesSort has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function fixPropTypesSort(fixer, context, declarations, ignoreCase, requiredFirst, callbacksLast, sortShapeProp) {
                Severity: Major
                Found in lib/util/propTypesSort.js - About 50 mins to fix

                  Function getReactVersionFromContext has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function getReactVersionFromContext(context) {
                    let confVer = '999.999.999';
                    // .eslintrc shared settings (https://eslint.org/docs/user-guide/configuring#adding-shared-settings)
                    if (context.settings && context.settings.react && context.settings.react.version) {
                      let settingsVersion = context.settings.react.version;
                  Severity: Minor
                  Found in lib/util/version.js - About 45 mins 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 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast) {
                  Severity: Minor
                  Found in lib/util/propTypesSort.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                  if (returnTypeFunction.length === 0) {
                                    // Cannot find identifier in current scope. It might be an exported type.
                                    this.shouldIgnorePropTypes = true;
                                    return;
                                  }
                    Severity: Major
                    Found in lib/util/propTypes.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                      if (isFunctionType(func)) {
                                        let res = func.body;
                                        if (res.type === 'BlockStatement') {
                                          res = astUtil.findReturnStatement(func);
                                          if (res) {
                      Severity: Major
                      Found in lib/util/propTypes.js - About 45 mins to fix

                        Function getFlowVersionFromContext has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function getFlowVersionFromContext(context) {
                          let confVer = '999.999.999';
                          // .eslintrc shared settings (https://eslint.org/docs/user-guide/configuring#adding-shared-settings)
                          if (context.settings.react && context.settings.react.flowVersion) {
                            let flowVersion = context.settings.react.flowVersion;
                        Severity: Minor
                        Found in lib/util/version.js - About 45 mins 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

                        Consider simplifying this complex logical expression.
                        Open

                            if (
                              unwrappedParentCalleeNode
                              && unwrappedParentCalleeNode.property
                              && unwrappedParentCalleeNode.property.name === 'setState'
                              // Make sure we are in the updater not the callback
                        Severity: Major
                        Found in lib/util/usedPropTypes.js - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                if (node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression') {
                                  const isMethod = parent.type === 'Property' && parent.method;
                                  const isPropertyAssignment = parent.type === 'AssignmentExpression'
                                    && parent.left.type === 'MemberExpression';
                                  const isModuleExportsAssignment = isPropertyAssignment
                          Severity: Major
                          Found in lib/util/Components.js - About 40 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        if (((n.type === 'AssignmentExpression') && propsUtil.isPropTypesDeclaration(n.left))
                                          || ((n.type === 'ClassProperty' || n.type === 'PropertyDefinition' || n.type === 'Property') && propsUtil.isPropTypesDeclaration(n))) {
                                          // Found a propType used inside of another propType. This is not considered usage, we'll still validate
                                          // this component.
                                          isUsedInPropTypes = true;
                            Severity: Major
                            Found in lib/util/propTypes.js - About 40 mins to fix

                              Function isReturningJSX has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function isReturningJSX(isCreateElement, ASTnode, context, strict, ignoreNull) {
                              Severity: Minor
                              Found in lib/util/jsx.js - About 35 mins to fix

                                Function detectReactVersion has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function detectReactVersion(context) {
                                  if (cachedDetectedReactVersion) {
                                    return cachedDetectedReactVersion;
                                  }
                                
                                
                                Severity: Minor
                                Found in lib/util/version.js - About 35 mins 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

                                Severity
                                Category
                                Status
                                Source
                                Language