react.dev
react.dev copied to clipboard
Linter breaks example for escape hatches
Summary
This lint is correct, but the sandbox is intentionally bad/broken:
Page
https://react.dev/learn/escape-hatches#removing-effect-dependencies
Details
No response
I think the way to fix this is to have an escape hatch (maybe an argument?) that can be given so that this code returns null, regardless of whether there are lint errors: https://github.com/reactjs/react.dev/blob/main/src/components/MDX/Sandpack/Preview.tsx#L69-L80
I recall just suppressing the linter with a comment in some sandboxes to work around this. Another alternative is to tweak the text to make it clear the lint error is expected and good.