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

Optionally allow extending objects as a top-level side-effect #1109

Open
ericcornelissen opened this issue Aug 1, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@ericcornelissen
Copy link
Owner

Summary

Originally posted by @pallymore in #1080 (comment):

I've noticed the following is also considered a side effect violation:

function SomeReactComponent() { ... }

// ❌ this is reported as a top level side effect violation
SomeReactComponent.displayName = 'MyComponent';

is this expected?

I think it's reasonable to provide an option to allow this pattern. Even though it can be quite "dangerous" (e.g. you can add a new property to an object from another module), in the described case it's pretty reasonable to want to add a property while there's not workaround to add the property at the time the object (a function in this case) is created.

@ericcornelissen ericcornelissen added the enhancement New feature or request label Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant