build(aio): fix addNotYetDocumentedProperty processor (#22770)

It was running too late and so was being confused by the
description being split into `shortDescription` and `description`
properties.

Closes #22748

PR Close #22770
This commit is contained in:
Pete Bacon Darwin
2018-03-14 19:15:11 +00:00
committed by Miško Hevery
parent f256c02b5e
commit 19e6b8dad5
3 changed files with 49 additions and 153 deletions

View File

@ -1,37 +1,19 @@
module.exports = function addNotYetDocumentedProperty(EXPORT_DOC_TYPES, log, createDocMessage) {
module.exports = function addNotYetDocumentedProperty(log, createDocMessage) {
return {
$runAfter: ['tags-parsed'],
$runBefore: ['rendering-docs'],
$process: function(docs) {
docs.forEach(function(doc) {
if (EXPORT_DOC_TYPES.indexOf(doc.docType) === -1) return;
// NotYetDocumented means that no top level comments and no member level comments
doc.notYetDocumented = notYetDocumented(doc);
if (doc.constructorDoc) {
doc.constructorDoc.notYetDocumented = notYetDocumented(doc.constructorDoc);
doc.notYetDocumented = doc.notYetDocumented && doc.constructorDoc.notYetDocumented;
}
if (doc.members) {
doc.members.forEach(function(member) {
member.notYetDocumented = notYetDocumented(member);
doc.notYetDocumented = doc.notYetDocumented && member.notYetDocumented;
});
}
if (doc.notYetDocumented) {
docTypes: [],
$runAfter: ['tags-extracted'],
$runBefore: ['processing-docs', 'splitDescription'],
$process(docs) {
docs.forEach(doc => {
if (
this.docTypes.indexOf(doc.docType) !== -1 &&
!doc.noDescription &&
(!doc.description || doc.description.trim().length === 0)
) {
doc.notYetDocumented = true;
log.debug(createDocMessage('Not yet documented', doc));
}
});
return docs;
}
};
};
function notYetDocumented(doc) {
return !doc.noDescription && doc.description.trim().length == 0;
}