-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Core] Suggestion to fix eslint error with CodeCopy.tsx with immutable object #44348
base: master
Are you sure you want to change the base?
Conversation
Netlify deploy previewhttps://deploy-preview-44348--material-ui.netlify.app/ Bundle size report |
I'm not sure what we gain from this refactor, the code still contains an ignore directive, which means the whole file still doesn't get transformed. I believe the canonical solution to this problem would be to expose the |
Yea noticed CI testlint failing now when i turned the eslintrc check back to false again with "// eslint-disable-next-line react-compiler/react-compiler" with now giving errors .. I would argue that im still new to open source development and MUI project, so thankful for the fast feedback! Will look into exposing the setNode into the context instead with that seeming to be a more thoughtful approach! 😄 |
yes, but even that, isn't this just a false positive in the eslint plugin? I assume it's only complaining because it can't infer that in fact rootNode is a mutable ref. |
Yeah, that makes sense - it does seem like a false positive, especially since setting eslint.rc to false resolves it. And yes, rootNode is indeed mutable. Should we consider adjusting the ESLint configuration if the inline comment isn’t working as intended, or how should we proceed forward? |
…Callback with passing the argument instead of directly and due to rootNode.current = node still being immutable (eslint error), can disable it with react compiler - saw that it was done previously in the code.
…ded useMemo inside the codeCopyProvider
02869ca
to
b254db9
Compare
Suggested push from feedback from @Janpot with:
This removed the eslint error and tested it with compiling and used codeCopy and seems to work 😃 So open for feedback/suggestions/ Reviews! |
Suggestion for fix #42564 with CodeCopy.tsx.
So suggestion with using React Callback with passing the argument instead of directly and due to rootNode.current = node still being immutable (eslint error), can disable it with react compiler - saw that it was done previously in the code. So open for suggestions for this solution/ feedback to change the code! 😃