From 59673c4e30add182af7456dcc2f11ff4bcfa7e6b Mon Sep 17 00:00:00 2001 From: Gajus Kuizinas Date: Tue, 22 May 2018 08:31:47 +0100 Subject: [PATCH] fix: add settings (fixes #75) --- README.md | 14 ++++++++++++++ bin/readme-assertions.js | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index 155cd7b21..8763e7d20 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,7 @@ function quux (foo = 'FOO') { function quux (foo = 'FOO') { } +// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}} // Message: Expected @arg names to be "foo". Got "Foo". /** @@ -442,6 +443,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}} // Message: Invalid JSDoc tag (preference). Replace "param" JSDoc tag with "arg". /** @@ -458,6 +460,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"additionalTagNames":{"customTags":["bar"]}}} // Message: Invalid JSDoc tag name "baz". /** @@ -467,6 +470,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"additionalTagNames":{"customTags":["bar"]}}} // Message: Invalid JSDoc tag name "baz". ``` @@ -486,6 +490,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}} /** * @bar foo @@ -493,6 +498,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"additionalTagNames":{"customTags":["bar"]}}} /** * @baz @bar foo @@ -500,6 +506,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"additionalTagNames":{"customTags":["baz","bar"]}}} /** * @abstract @@ -1250,6 +1257,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}} // Message: Missing JSDoc @arg "foo" declaration. /** @@ -1292,6 +1300,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}} /** * @override @@ -1307,6 +1316,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"allowOverrideWithoutParam":true}} ``` @@ -1337,6 +1347,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}} // Message: Missing JSDoc @arg "foo" description. ``` @@ -1439,6 +1450,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}} // Message: Missing JSDoc @arg "foo" type. ``` @@ -1488,6 +1500,7 @@ function quux (foo) { function quux (foo) { } +// Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}} // Message: Missing JSDoc @return description. ``` @@ -1545,6 +1558,7 @@ function quux () { function quux () { } +// Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}} // Message: Missing JSDoc @return type. ``` diff --git a/bin/readme-assertions.js b/bin/readme-assertions.js index 179e93241..db1ad3994 100644 --- a/bin/readme-assertions.js +++ b/bin/readme-assertions.js @@ -11,6 +11,10 @@ const formatCodeSnippet = (setup) => { paragraphs.push(trimCode(setup.code)); + if (setup.settings) { + paragraphs.push('// Settings: ' + JSON.stringify(setup.settings)); + } + if (setup.options) { paragraphs.push('// Options: ' + JSON.stringify(setup.options)); }