yannickcr/eslint-plugin-react

View on GitHub

Showing 710 of 710 total issues

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

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

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

          JSXOpeningElement(node) {
            if (!node.attributes.length) {
              return;
            }
    
    
    Severity: Minor
    Found in lib/rules/jsx-max-props-per-line.js - About 1 hr to fix

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

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

            function lintUnnecessaryCurly(JSXExpressionNode) {
              const expression = JSXExpressionNode.expression;
              const expressionType = expression.type;
        
              const sourceCode = getSourceCode(context);
        Severity: Minor
        Found in lib/rules/jsx-curly-brace-presence.js - About 1 hr to fix

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

              function comparePropsOrder(propertiesInfos, propA, propB) {
                let i;
                let j;
                let k;
                let l;
          Severity: Minor
          Found in lib/rules/sort-comp.js - About 1 hr to fix

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

            function detectReactVersion(context) {
              if (cachedDetectedReactVersion) {
                return cachedDetectedReactVersion;
              }
            
            
            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 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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              create(context) {
                // --------------------------------------------------------------------------
                // Public
                // --------------------------------------------------------------------------
            
            
            Severity: Minor
            Found in lib/rules/no-render-return-value.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 11 (exceeds 5 allowed). Consider refactoring.
            Open

              create(context) {
                return {
                  CallExpression(node) {
                    const callee = node.callee;
                    if (callee.type !== 'MemberExpression') {
            Severity: Minor
            Found in lib/rules/no-is-mounted.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 11 (exceeds 5 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

            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 11 (exceeds 5 allowed). Consider refactoring.
            Open

              create(context) {
                const checkRefsUsage = testReactVersion(context, '< 18.3.0'); // `this.refs` is writable in React 18.3.0 and later, see https://github.com/facebook/react/pull/28867
                const detectTemplateLiterals = context.options[0] ? context.options[0].noTemplateLiterals : false;
                /**
                 * Checks if we are using refs
            Severity: Minor
            Found in lib/rules/no-string-refs.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 getTokensLocations has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function getTokensLocations(node) {
                  const sourceCode = getSourceCode(context);
                  const opening = sourceCode.getFirstToken(node).loc.start;
                  const closing = sourceCode.getLastTokens(node, node.selfClosing ? 2 : 1)[0].loc.start;
                  const tag = sourceCode.getFirstToken(node.name).loc.start;
            Severity: Minor
            Found in lib/rules/jsx-closing-bracket-location.js - About 1 hr to fix

              Function getComponentTypeAnnotation has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function getComponentTypeAnnotation(component) {
                    // If this is a functional component that uses a global type, check it
                    if (
                      (component.node.type === 'FunctionDeclaration' || component.node.type === 'ArrowFunctionExpression')
                      && component.node.params
              Severity: Minor
              Found in lib/rules/boolean-prop-naming.js - About 1 hr to fix

                Function handleJSX has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    const handleJSX = (node) => {
                      let lastChild = null;
                      let child = null;
                      (node.children.concat([null])).forEach((nextChild) => {
                        if (
                Severity: Minor
                Found in lib/rules/jsx-child-element-spacing.js - About 1 hr to fix

                  Function FunctionExpression, ArrowFunctionExpression has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        'FunctionExpression, ArrowFunctionExpression'(node) {
                          if (!isForwardRefCall(node.parent)) {
                            return;
                          }
                  
                  
                  Severity: Minor
                  Found in lib/rules/forward-ref-uses-ref.js - About 1 hr to fix

                    Function isForbidden has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function isForbidden(prop, tagName) {
                          const options = getPropOptions(prop);
                          if (!options) {
                            return false;
                          }
                    Severity: Minor
                    Found in lib/rules/forbid-component-props.js - About 1 hr to fix

                      Function checkIdentifierInJSX has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function checkIdentifierInJSX(node) {
                            let scope = eslintUtil.getScope(context, node);
                            const sourceCode = eslintUtil.getSourceCode(context);
                            const sourceType = sourceCode.ast.sourceType;
                            const scopeUpperBound = !allowGlobals && sourceType === 'module' ? 'module' : 'global';
                      Severity: Minor
                      Found in lib/rules/jsx-no-undef.js - About 1 hr to fix

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

                                CallExpression(node) {
                                  const callee = node.callee;
                                  if (
                                    callee.type !== 'MemberExpression'
                                    || callee.object.type !== 'ThisExpression'
                        Severity: Minor
                        Found in lib/util/makeNoMethodSetStateRule.js - About 1 hr to fix

                          Function sorter has 30 lines of code (exceeds 25 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 1 hr to fix

                            Function checkPropValidValue has 30 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
                              Severity
                              Category
                              Status
                              Source
                              Language