yannickcr/eslint-plugin-react

View on GitHub

Showing 502 of 700 total issues

Consider simplifying this complex logical expression.
Open

      if (
        // Support allowAsProps option
        (isDeclaredInsideProps && (allowAsProps || isComponentInRenderProp(node, context)))

        // Prevent reporting components created inside Array.map calls
Severity: Critical
Found in lib/rules/no-unstable-nested-components.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

              if (
                node.decorators[i].expression
                && node.decorators[i].expression.callee
                && node.decorators[i].expression.callee.object
                && node.decorators[i].expression.callee.object.name === 'reactMixin'
    Severity: Critical
    Found in lib/rules/require-optimization.js - About 1 hr to fix

      Function hasTranspilerName has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function hasTranspilerName(node) {
            const namedObjectAssignment = (
              node.type === 'ObjectExpression'
              && node.parent
              && node.parent.parent
      Severity: Minor
      Found in lib/rules/display-name.js - About 1 hr to fix

        Function internalIsDeclaredInComponent has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function internalIsDeclaredInComponent(declaredPropTypes, keyList) {
              for (let i = 0, j = keyList.length; i < j; i++) {
                const key = keyList[i];
                const propType = (
                  declaredPropTypes && (
        Severity: Minor
        Found in lib/rules/prop-types.js - About 1 hr to fix

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

              CallExpression(node) {
                if (node.callee.type !== 'MemberExpression' && node.callee.type !== 'Identifier') {
                  return;
                }
          
          
          Severity: Minor
          Found in lib/rules/void-dom-elements-no-children.js - About 1 hr to fix

            Function create has 41 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;
                  const options = {
            Severity: Minor
            Found in lib/rules/forbid-component-props.js - About 1 hr to fix

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

                create: Components.detect((context, components) => {
                  const configuration = context.options[0] || {};
                  const allowRequiredDefaults = configuration.allowRequiredDefaults || false;
              
                  /**
              Severity: Minor
              Found in lib/rules/default-props-match-prop-types.js - About 1 hr to fix

                Function isCreateContext has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function isCreateContext(node) {
                  if (
                    node.init
                    && node.init.type === 'CallExpression'
                    && node.init.callee
                Severity: Minor
                Found in lib/util/isCreateContext.js - About 1 hr to fix

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

                    create: Components.detect((context, components) => {
                      const configuration = context.options[0] || {};
                      const forbidDefaultForRequired = configuration.forbidDefaultForRequired || false;
                      const classes = configuration.classes || 'defaultProps';
                      /**
                  Severity: Minor
                  Found in lib/rules/require-default-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 traverseReturns has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function traverseReturns(ASTNode, context, onReturn) {
                    const nodeType = ASTNode.type;
                  
                    if (nodeType === 'ReturnStatement') {
                      onReturn(ASTNode.argument, () => {});
                  Severity: Minor
                  Found in lib/util/ast.js - About 1 hr to fix

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

                      create(context) {
                        const configuration = context.options[0] || 'always';
                    
                        // --------------------------------------------------------------------------
                        // Public
                    Severity: Minor
                    Found in lib/rules/jsx-space-before-closing.js - About 1 hr to fix

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

                        Function validate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function validate(node) {
                              if (!node || !node.parent) {
                                return;
                              }
                        
                        
                        Severity: Minor
                        Found in lib/rules/no-unstable-nested-components.js - About 1 hr to fix

                          Function reportInvalidEntity has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function reportInvalidEntity(node) {
                                const configuration = context.options[0] || {};
                                const entities = configuration.forbid || DEFAULTS;
                          
                                // HTML entities are already escaped in node.value (as well as node.raw),
                          Severity: Minor
                          Found in lib/rules/no-unescaped-entities.js - About 1 hr to fix

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

                              create(context) {
                                // --------------------------------------------------------------------------
                                // Public
                                // --------------------------------------------------------------------------
                            
                            
                            Severity: Minor
                            Found in lib/rules/no-render-return-value.js - About 1 hr to fix

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

                                create: Components.detect((context, components, utils) => {
                                  /**
                                   * Checks if the component is valid
                                   * @param {Object} component The component to process
                                   * @returns {Boolean} True if the component is valid, false if not.
                              Severity: Minor
                              Found in lib/rules/no-set-state.js - About 1 hr to fix

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

                                  create(context) {
                                    const configuration = context.options[0] || {};
                                    const allowAllCaps = configuration.allowAllCaps || false;
                                    const allowLeadingUnderscore = configuration.allowLeadingUnderscore || false;
                                    const allowNamespace = configuration.allowNamespace || false;
                                Severity: Minor
                                Found in lib/rules/jsx-pascal-case.js - About 1 hr to fix

                                  Function validateBeforeSelfClosing has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function validateBeforeSelfClosing(context, node, option) {
                                    const sourceCode = getSourceCode(context);
                                    const leftToken = getTokenBeforeClosingBracket(node);
                                    const closingSlash = sourceCode.getTokenAfter(leftToken);
                                  
                                  
                                  Severity: Minor
                                  Found in lib/rules/jsx-tag-spacing.js - About 1 hr to fix

                                    Function verifyDefaultPropsDestructuring has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function verifyDefaultPropsDestructuring(context, properties) {
                                      // Loop through each of the default params
                                      properties.filter((prop) => prop.type === 'Property' && prop.value.type === 'AssignmentPattern').forEach((prop) => {
                                        const propName = prop.key.name;
                                        const propDefaultValue = prop.value;
                                    Severity: Minor
                                    Found in lib/rules/no-object-type-as-default-prop.js - About 1 hr to fix

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

                                            MemberExpression(node) {
                                              if (
                                                node.property.name === 'state'
                                                && node.object.type === 'ThisExpression'
                                                && isClassComponent(node)
                                      Severity: Minor
                                      Found in lib/rules/no-access-state-in-setstate.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language