From 5ba08f0b8c3e1d8402635e0482813a701638c40e Mon Sep 17 00:00:00 2001 From: Jay <41024828+JBhagat841@users.noreply.github.com> Date: Sun, 8 Dec 2019 16:01:55 -0500 Subject: [PATCH] #4326 - TypeError: Cannot read property 'param' of undefined (#4895) * creating rule * rule written * rule replicated * isolated rule * added test files back in * captured case of this.contentTags being undefined * added documentation to test --- src/rules/completed-docs/tagExclusion.ts | 4 ++++ .../completed-docs/defaults/edge-case/test.ts.lint | 5 +++++ .../completed-docs/defaults/edge-case/tslint.json | 13 +++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 test/rules/completed-docs/defaults/edge-case/test.ts.lint create mode 100644 test/rules/completed-docs/defaults/edge-case/tslint.json diff --git a/src/rules/completed-docs/tagExclusion.ts b/src/rules/completed-docs/tagExclusion.ts index f1a6affb0d7..4977d010d74 100644 --- a/src/rules/completed-docs/tagExclusion.ts +++ b/src/rules/completed-docs/tagExclusion.ts @@ -49,6 +49,10 @@ export class TagExclusion extends Exclusion { return true; } + if (this.contentTags === undefined) { + return false; + } + const matcherBody = this.contentTags[tagWithContent[0]]; if (matcherBody === undefined) { continue; diff --git a/test/rules/completed-docs/defaults/edge-case/test.ts.lint b/test/rules/completed-docs/defaults/edge-case/test.ts.lint new file mode 100644 index 00000000000..16d3985926b --- /dev/null +++ b/test/rules/completed-docs/defaults/edge-case/test.ts.lint @@ -0,0 +1,5 @@ +/** + * Snippet where no error occurs (But completed-docs correctly gives an error on the lack of jsdoc). + * @returns {Promise} + */ +export const handler = async () => { ... } diff --git a/test/rules/completed-docs/defaults/edge-case/tslint.json b/test/rules/completed-docs/defaults/edge-case/tslint.json new file mode 100644 index 00000000000..ca96ba6b633 --- /dev/null +++ b/test/rules/completed-docs/defaults/edge-case/tslint.json @@ -0,0 +1,13 @@ +{ + "rules": { + "completed-docs": [ + true, + { + "variables": { + "visibilities": ["exported"], + "tags": { "existence": [""] } + } + } + ] + } + } \ No newline at end of file