Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Maximum call stack size exceeded #2861

Closed
avi-dwave opened this issue Nov 20, 2020 · 2 comments
Closed

RangeError: Maximum call stack size exceeded #2861

avi-dwave opened this issue Nov 20, 2020 · 2 comments

Comments

@avi-dwave
Copy link

Environment Info:

  • Node version: v10.23.0
  • npm version: v6.14.8
  • Local ESLint version: v7.13.0
  • Global ESLint version: v7.13.0 (Currently used)

Command Run

eslint ./assets/js/shared/component/partial/ProfileFlyoutV2/ProfileFlyoutV2.jsx

Output

Oops! Something went wrong! :(

ESLint: 7.13.0

RangeError: Maximum call stack size exceeded
Occurred while linting /home/developer/work/sapi/qubist/metalab-cloud-service/assets/js/shared/component/partial/ProfileFlyoutV2/ProfileFlyoutV2.jsx:97
    at Array.join (native)
    at iterateProperties (/home/developer/work/sapi/qubist/metalab-cloud-service/node_modules/eslint-plugin-react/lib/util/propTypes.js:445:55)
    at iterateProperties (/home/developer/work/sapi/qubist/metalab-cloud-service/node_modules/eslint-plugin-react/lib/util/propTypes.js:65:7)
    at buildReactDeclarationTypes (/home/developer/work/sapi/qubist/metalab-cloud-service/node_modules/eslint-plugin-react/lib/util/propTypes.js:443:11)
    at buildReactDeclarationTypes (/home/developer/work/sapi/qubist/metalab-cloud-service/node_modules/eslint-plugin-react/lib/util/propTypes.js:458:25)
    at iterateProperties (/home/developer/work/sapi/qubist/metalab-cloud-service/node_modules/eslint-plugin-react/lib/util/propTypes.js:446:29)
    at iterateProperties (/home/developer/work/sapi/qubist/metalab-cloud-service/node_modules/eslint-plugin-react/lib/util/propTypes.js:65:7)
    at buildReactDeclarationTypes (/home/developer/work/sapi/qubist/metalab-cloud-service/node_modules/eslint-plugin-react/lib/util/propTypes.js:443:11)
    at buildReactDeclarationTypes (/home/developer/work/sapi/qubist/metalab-cloud-service/node_modules/eslint-plugin-react/lib/util/propTypes.js:458:25)
    at iterateProperties (/home/developer/work/sapi/qubist/metalab-cloud-service/node_modules/eslint-plugin-react/lib/util/propTypes.js:446:29)

ProfileFlyoutV2.jsx lines 88-103

const projectType = PropTypes.shape({
  id: PropTypes.string.isRequired,
  name: PropTypes.string.isRequired,
});

const nodesType = PropTypes.arrayOf(
  PropTypes.shape({ project: projectType, children: nodesType }),
);

ProjectNode.propTypes = { // line 97 where the error occurs
  project: projectType.isRequired,
  nodes: nodesType,
  depth: PropTypes.number.isRequired,
  setActiveProject: PropTypes.func.isRequired,
  activeProject: projectType,
};
@avi-dwave
Copy link
Author

Oh, I think I know why - nodesType is recursive. Is there a way to allow this type of structure?

@ljharb
Copy link
Member

ljharb commented Nov 20, 2020

Certainly the linter shouldn't crash on that.

However, I'm pretty sure recursive propTypes like that don't actually work in production - because nodesType is an error until it's finished being assigned, so I think your code is just wrong.

ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Feb 22, 2022
ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Feb 22, 2022
@ljharb ljharb closed this as completed in 1650b62 Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants