yannickcr/eslint-plugin-react

View on GitHub

Showing 502 of 700 total issues

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

    function checkPropsOrder(properties) {
      const propertiesInfos = properties.map((node) => ({
        name: getPropertyName(node),
        getter: node.kind === 'get',
        setter: node.kind === 'set',
Severity: Minor
Found in lib/rules/sort-comp.js - About 1 hr to fix

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

          function checkProperties(declarations) {
            if (declarations) {
              declarations.forEach((declaration) => {
                if (declaration.type !== 'Property') {
                  return;
      Severity: Minor
      Found in lib/rules/forbid-prop-types.js - About 1 hr to fix

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

              JSXSpreadAttribute(node) {
                const jsxOpeningElement = node.parent.name;
                const type = jsxOpeningElement.type;
        
                let tagName;
        Severity: Minor
        Found in lib/rules/jsx-props-no-spreading.js - About 1 hr to fix

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

            create(context) {
              function validate(node, children) {
                let currentIsInline = false;
                let previousIsInline = false;
                if (!children) {
          Severity: Minor
          Found in lib/rules/no-adjacent-inline-elements.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 12 (exceeds 5 allowed). Consider refactoring.
          Open

            create(context) {
              return {
                JSXOpeningElement(node) {
                  let name;
                  if (node.name.namespace) {
          Severity: Minor
          Found in lib/rules/jsx-uses-vars.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 12 (exceeds 5 allowed). Consider refactoring.
          Open

            create(context) {
              function handleClosingElement(node) {
                if (!node.parent) {
                  return;
                }
          Severity: Minor
          Found in lib/rules/jsx-closing-tag-location.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 12 (exceeds 5 allowed). Consider refactoring.
          Open

            create(context) {
              return {
                JSXAttribute(node) {
                  const attributes = new Set(context.options[0] || DEFAULT_ATTRIBUTES);
          
          
          Severity: Minor
          Found in lib/rules/no-invalid-html-attribute.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 isComponentInRenderProp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function isComponentInRenderProp(node, context) {
            if (
              node
              && node.parent
              && node.parent.type === 'Property'
          Severity: Minor
          Found in lib/rules/no-unstable-nested-components.js - About 1 hr to fix

            Function reportFunctionComponent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function reportFunctionComponent(componentNode, declaredPropTypes, defaultProps) {
                  if (defaultProps) {
                    report(context, messages.noDefaultPropsWithFunction, 'noDefaultPropsWithFunction', {
                      node: componentNode,
                    });
            Severity: Minor
            Found in lib/rules/require-default-props.js - About 1 hr to fix

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

                create(context) {
                  /**
                   * Checks for shouldComponentUpdate property
                   * @param {ASTNode} node The AST node being checked.
                   * @returns {Boolean} Whether or not the property exists.
              Severity: Minor
              Found in lib/rules/no-redundant-should-component-update.js - About 1 hr to fix

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

                      'Program:exit'() {
                        if (!rule) {
                          return;
                        }
                
                
                Severity: Minor
                Found in lib/rules/boolean-prop-naming.js - About 1 hr to fix

                  Function checkPropValidValue has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function checkPropValidValue(context, node, value, attribute) {
                    const validTags = VALID_VALUES.get(attribute);
                  
                    if (value.type !== 'Literal') {
                      return; // cannot check non-literals
                  Severity: Minor
                  Found in lib/rules/no-invalid-html-attribute.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                      if (
                        node.expression
                        && node.expression.type === 'AssignmentExpression'
                        && node.expression.operator === '='
                        && node.expression.right.type === 'CallExpression'
                    Severity: Critical
                    Found in lib/util/isCreateContext.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (
                                parent
                                && parent.type === 'MethodDefinition' && (
                                  (parent.static && parent.key.name === 'getDerivedStateFromProps')
                                  || classMethods.indexOf(parent.key.name) !== -1
                      Severity: Critical
                      Found in lib/rules/no-unused-state.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                              if (node.type === 'CallExpression'
                                  && node.callee
                                  && node.callee.type === 'MemberExpression'
                                  && node.callee.object
                                  && isArrayIndex(node.callee.object)
                        Severity: Critical
                        Found in lib/rules/no-array-index-key.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if (
                                    (configuration === 'multiline' && isMultilineJSX(node))
                                    || (configuration === 'multiline-multiprop' && isMultilineJSX(node) && node.attributes.length > 1)
                                    || (configuration === 'multiprop' && node.attributes.length > 1)
                                    || (configuration === 'always')
                          Severity: Critical
                          Found in lib/rules/jsx-first-prop-new-line.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        if (element.type === 'JSXElement' || element.type === 'JSXExpressionContainer') {
                                          const configuration = context.options[0] || {};
                                          const prevent = configuration.prevent || false;
                                          const allowMultilines = configuration.allowMultilines || false;
                            
                            
                            Severity: Critical
                            Found in lib/rules/jsx-newline.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(context, node) && node.id.type === 'Identifier') {
                              Severity: Minor
                              Found in lib/util/usedPropTypes.js - About 1 hr to fix

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

                                  const isJSXValue = (node) => {
                                    if (!node) {
                                      return false;
                                    }
                                    switch (node.type) {
                                Severity: Minor
                                Found in lib/util/jsx.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language