-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
react/jsx-curly-spacing not working #857
Comments
The |
Oh I see... I'll better read the doc next time. <Comp>
{something}
</Comp> |
ESLint rules does not apply to |
I'm relatively sure we have a rule that enforces this spacing in our airbnb config; it's different from object curly spacing because it's not object curlies. Not sure off the top of my head which rule tho. |
From my testing, the rule is not applied for the example I posted. I checked all the jsx rules and couldn't find another rule which check this. |
Same issue :-) |
Same issue, is there any other rule that works for this? <Comp>
{something}
</Comp> |
I think that perhaps an option to |
Also this doesn't work.
|
Is there currently no rule to support this? |
I'd like to work on this during the weekend :) Should this be an expansion of |
Thanks for the pointer, I missed that. |
I've got a few questions about the config:
Seeing as some people were confused as to why this rule was not working with the child expressions maybe another option is not necessary for now? (so the answers would be "no" and "no") The additional option could be added later on if there was a need. Otherwise the answers to those questions will help me get the shape of the new option right. |
Yes, children and attributes should be under their own options. Both should be separately configurable to be ignored, or spaces required, or spaces forbidden. |
Ok, so how about this:
Examples:
|
By default, it should do precisely what it does now, to avoid a breaking change. For number 3, I'd say "children" etc should either just be |
So how would config look for ignored attributes and "never" in children? I think that's the final piece of info I need. |
{
allowMultiline: true,
children: { allowMultiline: false }, // checked + overrides allowMultiline
attributes: false, // ignored
} {
allowMultiline: false,
children: false, // ignored
attributes: true, // checked + inherits allowMultiline
} ? |
Makes sense, I thought of Thanks for the patience! Will hopefully finish implementing this soon. |
Hmm, I don't think they both should have to be always or never at the same time. Let's add a new schema instead that gets rid of the string option entirely, only allows an object with allowMultiline and "foo" (always or never), and also children and attributes overrides for both? (Not yet sure what to call "foo") |
Good idea :) I will go with In this case
The default for the whole thing becomes |
Maybe let's just call it "spaces"? That sounds good. Although, to clarify, |
Ok, let's go with that. And yes, the full defaults are this. |
Btw. I think there was a small bug: when only "spacing" was set in the extended options, the following line was setting "allowMultiline" to
Then in all the following conditions Now I'll be checking if the property exists on the config object (using the |
There were no tests for this behavior - I'll add some. |
I think we should do something about the "spacing" property name, it's quite similar to the new "spaces" property. How about merging the "spacing" object into the config object? |
Ah, that's a good point. I think leaving |
Ok, will change it to "when", sounds good. |
Found another bug:
This would get 2 errors using the default settings: This is because conditions for the object literal spacing were written so that the second one was never reached:
If the first condition fails, Will fix this and add appropriate tests. |
It would be helpful if the bug fix is in a separate PR; or at least a separate commit. |
Each of the bugfixes is in a separate commit indeed. Separate PRs would mean some work on the tests (they are the most time-consuming), but I could do them if this would help. Edit: oops, the first fix is mixed in with other things, unfortunately. |
Fixed in #1177 |
Awesome! Will you publish sometime today? |
That's up to @yannickcr |
For some reasons, I can't get the jsx-curly-spacing rule to report errors.
After enabling it (using the default airbnb settings), I set several use case and nothing is reported.
The config has the following setting so all these cases should be reported, but they are not in my case.
The text was updated successfully, but these errors were encountered: