-
-
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
sort-prop-types fix to account for comments #1940
Comments
How would you determine whether comments attach to the thing before, or the thing after? |
Hmm... can you give an example where the comment goes after the thing you're commenting on? I'm having a difficulty coming up with a real use case. |
propTypes: {
baz: PropTypes.any,
foo: PropTypes.any,
// ^ this is a foo, but the others don't need explanation
bar: PropTypes.any,
} |
Ok. Haven't really seen code like that. But if it's something people would do in your experience (as opposed to putting |
However, I’d say the current behavior is a bug, so your plan is probably a strict improvement. Perhaps a plugin setting, that defaults to “above”, that determines comment attachment? |
|
(At plugin level tho, not rule) |
Why? Are there other rules that would use it? |
Any rule that moves code around :-) I’ve found over time that many rule configs belong instead as settings, and it’s easier to plan ahead. |
I'm able to use propTypes: {
foo: PropTypes.any,
// ^ this is a foo, but the others don't need explanation
bar: PropTypes.any
} If Also, here propTypes: {
foo: PropTypes.any, // <- this is a foo, but the others don't need explanation
bar: PropTypes.any
} the comment needs to be attached to |
Has there been any progress on this? FWIW the |
|
@ljharb Thanks for pinging me! I can try and take a look at it. I also noticed in the
Currently when running test cases, it passes. However, once I comment them back in, test cases don't pass. I am going to try and read into the history of the code, but if you had any insight please let me know! 👍 |
nah that sounds like it’s probably an oversight. It’d be great to get a PR that uncomments everything passing; and then a second PR that uncomments the rest and fixes the bugs :-) |
I know comments on prop types are not in favour here, but for those who do have them, would it be acceptable to support sorting comments together with their prop types? i.e. currently the rule would fix
to
The text was updated successfully, but these errors were encountered: