From 61b1b6f0e85fce8b9a2ddb3d1dad3b58b846e944 Mon Sep 17 00:00:00 2001 From: paladox Date: Tue, 17 Nov 2015 19:37:17 +0000 Subject: [PATCH 1/3] Support disabling rules in jsdoc Allow us to set null to disable a jsdoc rule. --- lib/rules/validate-jsdoc.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/rules/validate-jsdoc.js b/lib/rules/validate-jsdoc.js index 381d299..a66fe52 100644 --- a/lib/rules/validate-jsdoc.js +++ b/lib/rules/validate-jsdoc.js @@ -13,6 +13,22 @@ var validators = require('./validate-jsdoc/index'); module.exports = function() {}; module.exports.prototype = { + + /** + * List of rules instances. + * + * @protected + * @type {Object} + */ + this._rules = {}; + + /** + * List of configurated rule instances. + * + * @protected + * @type {Object} + */ + this._ruleSettings = {}; /** * Load all rules and init them @@ -20,7 +36,23 @@ module.exports.prototype = { * @param {Object} options * @throws {Error} If options is not an Object */ - configure: function(options) { + configure: function(options,config) { + Object.keys(config).forEach(function(key) { + + + if (this._rules[key]) { + var optionValue = config[key]; + + // Disable rule it it equals "false" or "null" + if (optionValue === null || optionValue === false) { + delete this._ruleSettings[key]; + + } else { + this._ruleSettings[key] = config[key]; + } + + } + }, this); assert(typeof options === 'object', 'jsDoc option requires object value'); // rules structured by scopes-tags for jsdoc-tags From 77437969e9dc2899ed0096e13f6d3b03d3bc7601 Mon Sep 17 00:00:00 2001 From: paladox Date: Fri, 20 Nov 2015 16:03:16 +0000 Subject: [PATCH 2/3] Update validate-jsdoc.js --- lib/rules/validate-jsdoc.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/rules/validate-jsdoc.js b/lib/rules/validate-jsdoc.js index a66fe52..137aedd 100644 --- a/lib/rules/validate-jsdoc.js +++ b/lib/rules/validate-jsdoc.js @@ -39,11 +39,10 @@ module.exports.prototype = { configure: function(options,config) { Object.keys(config).forEach(function(key) { - if (this._rules[key]) { var optionValue = config[key]; - // Disable rule it it equals "false" or "null" + // Disable rule if it equals "false" or "null" if (optionValue === null || optionValue === false) { delete this._ruleSettings[key]; From fccdce69148d0877bb0df0ca8ca0aee5210724fb Mon Sep 17 00:00:00 2001 From: paladox Date: Fri, 20 Nov 2015 16:07:37 +0000 Subject: [PATCH 3/3] Update validate-jsdoc.js --- lib/rules/validate-jsdoc.js | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/rules/validate-jsdoc.js b/lib/rules/validate-jsdoc.js index 137aedd..db49170 100644 --- a/lib/rules/validate-jsdoc.js +++ b/lib/rules/validate-jsdoc.js @@ -13,22 +13,6 @@ var validators = require('./validate-jsdoc/index'); module.exports = function() {}; module.exports.prototype = { - - /** - * List of rules instances. - * - * @protected - * @type {Object} - */ - this._rules = {}; - - /** - * List of configurated rule instances. - * - * @protected - * @type {Object} - */ - this._ruleSettings = {}; /** * Load all rules and init them @@ -37,6 +21,23 @@ module.exports.prototype = { * @throws {Error} If options is not an Object */ configure: function(options,config) { + + /** + * List of rules instances. + * + * @protected + * @type {Object} + */ + this._rules = {}; + + /** + * List of configurated rule instances. + * + * @protected + * @type {Object} + */ + this._ruleSettings = {}; + Object.keys(config).forEach(function(key) { if (this._rules[key]) {