mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
This lets us expose the component stack to the error reporting that happens here as `console.error` patching. Now if you just call `console.error` in the error handlers it'll get the component stack added to the end by React DevTools. However, unfortunately this happens a little too late so the Fiber will be disconnected with its `.return` pointer set to null already. So it'll be too late to extract a parent component stack from but you can at least get the stack from source to error boundary. To work around this I manually add the parent component stack in our default handlers when owner stacks are off. We could potentially fix this but you can also just include it yourself if you're calling `console.error` and it's not a problem for owner stacks. This is not a problem for owner stacks because we'll still have those and so for those just calling `console.error` just works. However, the main feature is that by letting React add them, we can switch to using native error stacks when available. |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| index.js | ||
| no-primitive-constructors.js | ||
| no-production-logging.js | ||
| no-to-warn-dev-within-to-throw.js | ||
| package.json | ||
| prod-error-codes.js | ||
| README.md | ||
| safe-string-coercion.js | ||
| warning-args.js | ||
Custom ESLint Rules
This is a dummy npm package that allows us to treat it as an eslint-plugin. It's not actually published, nor are the rules here useful for users of React. If you want to lint your React code, try https://github.com/yannickcr/eslint-plugin-react.
If you modify this rule, you must re-run npm install ./eslint-rules for it to take effect.