-
-
Notifications
You must be signed in to change notification settings - Fork 163
Add line alignment tags support when using always
#703
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
Add line alignment tags support when using always
#703
Conversation
Ah, it still needs some more tests for full coverage. EDIT: Done! ✅ |
36bab4a
to
29a7cc5
Compare
Ran it against my codebase and it worked without any bugs. I just wish that you could have 2 spaces after a variable name. without it, it becomes hard to read and looks like it's all just one sentence. example: /**
* Mocks the process.platform to a specified value.
*
* @param {string} platform 'win32', 'linux', or 'darwin'.
*/ I'd prefer a two space buffer before and after a variable name /**
* Mocks the process.platform to a specified value.
*
* @param {string} platform 'win32', 'linux', or 'darwin'.
*/ would be nice if there was a setting for this like |
@TheJaredWilcurt, thank you for testing! About these other requisites, I think it could be part of a different PR. I also tested it against the Gutenberg project and I identified only one issue. Basically, if we have only the I'm not sure yet how we could fix this. Do you have any idea @brettz9? I'd like to fix it without changing the align transformer because I tried to make it more similar to the original as possible, so we could remove this if we add it to the comment parser lib. If you don't have any idea, maybe I'll try to fix it in the align transformer code. |
I found another issue related to the indentation with tabs. Fixed here: 8389ad3 |
It's almost there. Now I found another weird error with the I think it's probably because this, but I'll try to check it another day. |
I took some time to debug it. The issue is that we're getting the /**
* With template tag.
*
* @template T
*
* @param {string} lorem Description.
* @param {int} sit Description multi words.
*/
const fn = ( lorem, sit ) => {} See the result debugging the commented part. The same happens for |
Hey @brettz9! |
If you log against the existing tests, you can see
|
64f77fb
to
efa2efb
Compare
Hey @brettz9 ! Thank you for your explanation! I was creating a fix (just adding a conditional to the let postName = '';
let description = '';
if (pos !== -1) {
[, postName, description] = extra.match(/(\s*)(.*)/);
} But I noticed that part was extracted for another dependency ( |
The repo is at https://github.com/es-joy/jsdoccomment , but I can add if I can see the reason for it. However, I don't imagine we can add such a conditional because if it is something like the example used at https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#template |
Hey @brettz9 ! I'm not in the computer now, but I remember I tested with the examples of this link and it worked well. When Basically, the problem is with a case like (when we don't have anything after the name):
In this case, it's setting |
Ah yes, sorry, @renatho . Fixed in 31.1.1 |
Nice!!! Than you @brettz9 !! \o/ Update: Just added a test with the |
21c1239
to
e9b1314
Compare
e9b1314
to
09438bf
Compare
Thanks for all your work and persistence on this, @renatho ! |
…ys"; gajus#703 Adds custom align transform with support for tags Co-authored-by: Renatho De Carli Rosa <renatho@automattic.com> Co-authored-by: Brett Zamir <brettz9@yahoo.com>
Ugh, seems my commit message was not well-formed. Adding a commit to revert and yet another to add back in the proper format. |
🎉 This PR is included in version 33.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Part of #680
Close #689
This PR adds support to the
tags
option when using thealways
option.The first PR for this feature was the #689, but the approach wasn't being enough, needing a lot of hacks. So I changed the approach, creating a new transform based on the original
align
, but adding support to custom tags.It still reports the errors for the entire block, different than what was suggested in #680 (comment).
Another idea for a new feature in the future:
never
for the tags that aren't in thetags
when using thealways
.