forked from ReactiveX/rxjs
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix errors and warnings when building docs + fix links (ReactiveX#5943)
* docs(navigation): remove non-existing url * docs(Subscription): fix links * docs(publishReply): fix link to asObservable * docs(windowTime): fix jsdoc return statement * chore(services): add `disambiguateByNonMember` disambiguator * docs: fix `@see` links * chore(links-package): change disambiguators ordering Fix Timestamp @see link to point to timestamp operator instead of Timestamp#timestamp member. * chore: add links to @see sections
- Loading branch information
1 parent
4dd7118
commit d783cd1
Showing
13 changed files
with
67 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
docs_app/tools/transforms/links-package/services/disambiguators/disambiguateByNonMember.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* This link disambiguator will remove all the members from the list of ambiguous links | ||
* if there is at least one link to a doc that is not a member. | ||
* | ||
* The heuristic is that exports are more important than members when linking, and that | ||
* in general members will be linked to via a more explicit code links such as | ||
* `MyClass.member` rather than simply `member`. | ||
*/ | ||
module.exports = function disambiguateByNonMember() { | ||
return (alias, originatingDoc, docs) => { | ||
const filteredDocs = docs.filter(doc => doc.docType !== 'member'); | ||
return filteredDocs.length > 0 ? filteredDocs : docs; | ||
}; | ||
}; |
23 changes: 23 additions & 0 deletions
23
...pp/tools/transforms/links-package/services/disambiguators/disambiguateByNonMember.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const disambiguateByNonMember = require('./disambiguateByNonMember')(); | ||
const doc1 = { id: 'doc1', docType: 'function', containerDoc: {} }; | ||
const doc2 = { id: 'doc2', docType: 'member', containerDoc: {} }; | ||
const doc3 = { id: 'doc3', docType: 'member', containerDoc: {} }; | ||
const doc4 = { id: 'doc4', docType: 'class', containerDoc: {} }; | ||
const doc5 = { id: 'doc5', docType: 'member', containerDoc: {} }; | ||
|
||
describe('disambiguateByNonMember', () => { | ||
it('should filter out docs that are not members', () => { | ||
const docs = [doc1, doc2, doc3, doc4, doc5]; | ||
expect(disambiguateByNonMember('alias', {}, docs)).toEqual([doc1, doc4]); | ||
}); | ||
|
||
it('should return all docs if there are no members', () => { | ||
const docs = [doc1, doc4]; | ||
expect(disambiguateByNonMember('alias', {}, docs)).toEqual([doc1, doc4]); | ||
}); | ||
|
||
it('should return all docs if there are only members', () => { | ||
const docs = [doc2, doc3, doc5]; | ||
expect(disambiguateByNonMember('alias', {}, docs)).toEqual([doc2, doc3, doc5]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters