pustovalov/eslint-plugin-react-extended

View on GitHub

Showing 101 of 125 total issues

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

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

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

        getStatelessComponent(node) {
          const parent = node.parent;
          if (
            node.type === 'FunctionDeclaration'
            && (!node.id || isFirstLetterCapitalized(node.id.name))
    Severity: Major
    Found in lib/util/Components.js - About 2 hrs to fix

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

      function findReturnStatement(node) {
        if (
          (!node.value || !node.value.body || !node.value.body.body)
          && (!node.body || !node.body.body)
        ) {
      Severity: Minor
      Found in lib/util/ast.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 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function isReturningJSX(isCreateElement, ASTnode, context, strict, ignoreNull) {
        let found = false;
        astUtil.traverseReturns(ASTnode, context, (node) => {
          // Traverse return statement
          astUtil.traverse(node, {
      Severity: Major
      Found in lib/util/jsx.js - About 2 hrs to fix

        Function isReactHookCall has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            isReactHookCall(node, expectedHookNames) {
              if (node.type !== 'CallExpression') {
                return false;
              }
        
        
        Severity: Major
        Found in lib/util/Components.js - About 2 hrs to fix

          File ast.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * @fileoverview Utility functions for AST
           */
          
          'use strict';
          Severity: Minor
          Found in lib/util/ast.js - About 2 hrs to fix

            Function isDestructuredFromPragmaImport has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function isDestructuredFromPragmaImport(variable, context) {
              const pragma = pragmaUtil.getFromContext(context);
              const variables = variableUtil.variablesInScope(context);
              const variableInScope = variableUtil.getVariable(variables, variable);
              if (variableInScope) {
            Severity: Major
            Found in lib/util/isDestructuredFromPragmaImport.js - About 2 hrs to fix

              Function searchDeclarationByName has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  searchDeclarationByName(node) {
                    let typeName;
                    if (astUtil.isTSTypeReference(node)) {
                      typeName = node.typeName.name;
                      const leftMostName = getLeftMostTypeName(node.typeName);
              Severity: Major
              Found in lib/util/propTypes.js - About 2 hrs to fix

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

                module.exports = function makeNoMethodSetStateRule(methodName, shouldCheckUnsafeCb) {
                  return {
                    meta: {
                      docs: {
                        description: `Prevent 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 enter has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      enter(childNode) {
                        const setFound = () => {
                          found = true;
                          this.skip();
                        };
                Severity: Minor
                Found in lib/util/jsx.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

                    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

                      Function sorter has a Cognitive Complexity of 13 (exceeds 5 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

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

                          ObjectTypeAnnotation(annotation, parentName, seen) {
                            let containsUnresolvedObjectTypeSpread = false;
                            let containsSpread = false;
                            const containsIndexers = Boolean(annotation.indexers && annotation.indexers.length);
                            const shapeTypeDefinition = {
                      Severity: Minor
                      Found in lib/util/propTypes.js - About 1 hr to fix

                        Function fixPropTypesSort has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function fixPropTypesSort(fixer, context, declarations, ignoreCase, requiredFirst, callbacksLast, sortShapeProp) {
                          function sortInSource(allNodes, source) {
                            const originalSource = source;
                            const nodeGroups = allNodes.reduce((acc, curr) => {
                              if (curr.type === 'ExperimentalSpreadProperty' || curr.type === 'SpreadElement') {
                        Severity: Minor
                        Found in lib/util/propTypesSort.js - About 1 hr to fix

                          Function isReturningOnlyNull has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function isReturningOnlyNull(isCreateElement, ASTnode, context) {
                            let found = false;
                            let foundSomethingElse = false;
                            astUtil.traverseReturns(ASTnode, context, (node) => {
                              // Traverse return statement
                          Severity: Minor
                          Found in lib/util/jsx.js - About 1 hr to fix

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

                                VariableDeclarator(node) {
                                  const unwrappedInitNode = ast.unwrapTSAsExpression(node.init);
                            
                                  // let props = this.props
                                  if (isThisDotProps(unwrappedInitNode) && isInClassComponent(utils) && node.id.type === 'Identifier') {
                            Severity: Minor
                            Found in lib/util/usedPropTypes.js - About 1 hr to fix

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

                                      CallExpression(node) {
                                        if (shouldBeNoop(context, methodName)) {
                                          return;
                                        }
                              
                              
                              Severity: Minor
                              Found in lib/util/makeNoMethodSetStateRule.js - About 1 hr to fix

                                Function resolveBasedir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function resolveBasedir(contextOrFilename) {
                                  if (contextOrFilename) {
                                    const filename = typeof contextOrFilename === 'string' ? contextOrFilename : contextOrFilename.getFilename();
                                    const dirname = path.dirname(filename);
                                    try {
                                Severity: Minor
                                Found in lib/util/version.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 sortInSource has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  function sortInSource(allNodes, source) {
                                    const originalSource = source;
                                    const nodeGroups = allNodes.reduce((acc, curr) => {
                                      if (curr.type === 'ExperimentalSpreadProperty' || curr.type === 'SpreadElement') {
                                        acc.push([]);
                                Severity: Minor
                                Found in lib/util/propTypesSort.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language