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

Should stateless component be ignored for the multi-component lint rule? #50

Closed
matthargett opened this issue May 3, 2019 · 4 comments
Labels

Comments

@matthargett
Copy link
Contributor

Ask your Question

I am running into a scenario where I declare an HOC component, and then export it using React.forwardRef() in the same file. This is triggering an error that I have 2 components declared in 1 file.

This option can be disabled for essentially HOC components:

"react/no-multi-comp": [<enabled>, { "ignoreStateless": <boolean> }]

I'd like to propose adding that tweak. Otherwise, can it be explained how to resolve the rule firing when using forwardRef()?

@thymikee
Copy link
Member

thymikee commented May 6, 2019

I'm not a fan of this rule honestly and would like to just disable it (wasn't aware it was turned on really).

In my experience the teams I'm working with, having this rule enabled, use to create more _renderSomething class methods to achieve something that would be extracted to a small local component (and maybe to a reusable one sometime later easily), resulting in more imperative code.

What do you think?

cc @satya164 @michalchudziak @ferrannp

@satya164
Copy link
Member

satya164 commented May 6, 2019

Yes lets disable it

@ferrannp
Copy link
Collaborator

ferrannp commented May 6, 2019

I'm ok with disabling it.

matthargett added a commit to matthargett/eslint-config-callstack that referenced this issue May 7, 2019
@matthargett
Copy link
Contributor Author

Submitted PR #51

thymikee pushed a commit that referenced this issue May 11, 2019
* Dsiable  react/no-multi-comp rule

Discussed in #50.

* Only disable for stateless components
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants