build(docs-infra): add `_` to ignored ignoreGenericWords (#36316)

Previously, when a document included `_`, the autoLinker will try to
generate a link, e.g from `core/ɵComponentDef._`. This commit adds it
to the ignored words to prevent that.

PR Close #36316
This commit is contained in:
Sonu Kapoor 2020-04-14 08:05:13 -04:00 committed by Matias Niemelä
parent aebd5f9af6
commit e5f9e3d018
2 changed files with 7 additions and 1 deletions

View File

@ -5,6 +5,6 @@
*/ */
module.exports = function ignoreGenericWords() { module.exports = function ignoreGenericWords() {
const ignoredWords = new Set(['a', 'classes', 'create', 'error', 'group', 'request', 'target', 'value']); const ignoredWords = new Set(['a', 'classes', 'create', 'error', 'group', 'request', 'target', 'value', '_']);
return (docs, words, index) => ignoredWords.has(words[index].toLowerCase()) ? [] : docs; return (docs, words, index) => ignoredWords.has(words[index].toLowerCase()) ? [] : docs;
}; };

View File

@ -16,6 +16,12 @@ describe('ignoreGenericWords', () => {
expect(ignoreGenericWords(docs, words, 1)).toEqual([]); expect(ignoreGenericWords(docs, words, 1)).toEqual([]);
expect(ignoreGenericWords(docs, words, 2)).toEqual(docs); expect(ignoreGenericWords(docs, words, 2)).toEqual(docs);
}); });
it('should ignore `_` in all docs', () => {
const docs = [{docType: 'package', name: 'create'}, {docType: 'class', name: 'Foo'}];
const words = ['_'];
expect(ignoreGenericWords(docs, words, 0)).toEqual([]);
});
}); });