Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Patch that adds JSDoc to all modules not covered in #2493683: JSDoc for JS using Backbone.
Added @file to all files.
Wrapped comment lines to 80 char.
Almost all first line comments are actually on one line.
Added JSDoc for all "public" function (but not all descriptions). Some function local function not present in the global scope don't have complete jsdoc yet.
Comment | File | Size | Author |
---|---|---|---|
#15 | interdiff.txt | 3.16 KB | nod_ |
#15 | core-jsdoc-modules-2493691-15.patch | 109.49 KB | nod_ |
Comments
Comment #3
nod_I ended up putting all the modules here, including the ones in #2493683: JSDoc for JS using Backbone because it's a pain to do the diff. If anyone has some git-fu and has an easy way to exclude 4 folders from a diff, let me know.
Comment #4
nod_Well, that worked.
git diff 8.0.x..jsdoc-modules -- core/modules/ ":(exclude)core/modules/quickedit" ":(exclude)core/modules/toolbar" ":(exclude)core/modules/editor" ":(exclude)core/modules/ckeditor"
Ignore previous comment.
Comment #5
nod_Adding more type info.
Comment #6
nod_Reroll
Comment #7
nod_Just a reroll following #2168893: Views filters groups adding and removing is broken and #2470769: Color module lock hooks don't show up correctly API site updated.
Comment #8
nod_@link stuff.
Comment #9
nod_Reroll adding the new file from #2429443: Date format form is unusable.
Comment #10
dawehnerYou know, this patch does not do any harm, but rather make it actually possible to be parsed by jsdoc.
I mean you could iterate on the patch level, but I think it would be way more sane to iterate for such tasks on a per issue level.
If people agree with that, I think we should RTBC the other 2 ones as well.
I'm curious, is there something like inline type comments like
/** @var \Drupal... $foo
in PHPDo we have an issue for that todo?
Comment #11
eiriksmYou beat me to it :)
I was also looking through this now, and although I am not done looking, I agree with the view presented by @dawehner.
Also:
You can do stuff like /** @property {string} selector */ inline. Not sure how the output would be for Drupal jsDoc setup, but as a worst case, one can do it on several lines:
In theory. One would have to agree on a standard, though.
I'll look through the rest of the patch too, but looking good so far.
Comment #12
jhodgdonThanks! Yes that's the approach we agreed to on the meta-issue. So the review on this and the other two should be something like "Is there anything blatantly wrong in this and can we verify it just adds/updates comments and not code". Thanks you two for doing this one!
Comment #13
eiriksmOK, so that patch was quite the marathon. Did not check each and every variable and return value if it was actually the correct type, but as dawehner say, this is such a great start anyway.
A couple of things. Some very minor.
Juuust 1 character too much :p
81 characters :p
Typo. Should be triggeR not triggeT
I see you have a lot of these. Is the extra new line before the @return to make room for other things?
Earlier in this file you had @example followed by a new line. Should be the norm IMO
Should be something like @see {@link Drupal.tour.views.ToggleTourView#_getDocument} IMO. Just since we can. Although of course in this case, the link is like 250px above this one, but as a norm, I think we should use @link where possible.
Seems like a new line that stems from reformatting from 80 chars.
If no one bets me to it I'll upload an altered patch myself to make up for being the jerk that sets a RTBC issue to needs work ;)
Comment #14
eiriksmHm, well there is nothing blatantly wrong I guess. And it does just add/update comments and not code. So please feel free to tell me if I am being too strict with setting to needs work here :)
Comment #15
nod_#10.1 : we could do that as #11 said. This is an internal variable, no point in JS-Documenting it now.
#10.2 : Not yet.
#12 : fixed everything but 4. Extra line is from PHPStorm auto commenting stuff, won't fix that here.
Comment #16
dawehnerAlright, let's ship it
Comment #17
eiriksmawesome!
Comment #18
jhodgdonMost of this looks great! Obviously will need some more stuff filled in, but overall it adds a lot.
Follow-ups (besides generally filling stuff in):
- core/modules/field_ui/field_ui.js -- a bit off in places with wrapping and indentation, especially in - lists
- core/modules/views_ui/js/views-admin.js
58 files changed, 1157 insertions(+), 316 deletions(-)
Wow. that's a lot of work. Committed to 8.0.x. Thanks!