Skip to content

jsx-max-depth: Maximum call stack size exceeded #2880

@AriPerkkio

Description

@AriPerkkio

Hello, jsx-max-depth rule seems to crash in certain cases. This issue was spotted by automated CI run - it is not blocking my development or anything. https://github.com/AriPerkkio/eslint-remote-tester/actions/runs/428814308

I checked those other RangerError issues and this doesn't look like a duplicate.

"eslint-plugin-react": "^7.21.5",
{
  "root": true,
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "settings": {
    "react": {
      "version": "16.13.1"
    }
  },
  "plugins": ["react"],
  "rules": {
    "react/jsx-max-depth": "error"
  }
}

Minimal repro:

This is really as far minimal as I could narrow it down.

import React, { Component } from 'react'

const MyComponent = () => <div />;

var A = { D: '' };

class B extends Component {
    C() {
        A = A;
    }

    render() {
      const { D } = A;
      return <MyComponent  D={D} />;
    }
}
RangeError: Maximum call stack size exceeded
Occurred while linting <text>:81
    at findJSXElementOrFragment (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:1:1)
Crash reports from real projects

Rule: jsx-max-depth

  • Message: Maximum call stack size exceeded Occurred while linting <text>:81
  • Path: neurahealth/neuracovid/src/components/Login/index.js
  • Link
        const { t, i18n } = this.props;
        const { selectedOption } = lang
        if (localStorage.getItem(firebaseAuthKey) === '1')
        return <Splashscreen t={t} i18n={i18n}/>;
        return <LoginPage handleGoogleLogin={this.handleGoogleLogin} t={t} i18n={i18n} options={options} handleChange={this.handleChange} selectedOption={selectedOption} selectedOptionState={this.state.selectedOption}/>;
    }
}

const LoginPage = ({ handleGoogleLogin, t, i18n, handleChange, selectedOption, selectedOptionState }) => (
RangeError: Maximum call stack size exceeded
Occurred while linting <text>:81
    at findJSXElementOrFragment (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:1:1)
    at find (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:93:18)
    at findJSXElementOrFragment(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:101:49)
    at find (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:93:18)
    at findJSXElementOrFragment(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:101:49)
    at find (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:93:18)
    at findJSXElementOrFragment(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:101:49)
    at find (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:93:18)
    at findJSXElementOrFragment(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:101:49)
    at find (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-react/lib/rules/jsx-max-depth.js:93:18)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions