react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

Linter breaks example for escape hatches

Open rickhanlonii opened this issue 3 months ago • 2 comments

Summary

This lint is correct, but the sandbox is intentionally bad/broken:

Image

Page

https://react.dev/learn/escape-hatches#removing-effect-dependencies

Details

No response

rickhanlonii avatar Oct 02 '25 13:10 rickhanlonii

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

CompuIves avatar Oct 02 '25 14:10 CompuIves

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.

gaearon avatar Oct 02 '25 14:10 gaearon