From 6816d581b002d9ced3185c01cd7cb287d1249ba3 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 7 Mar 2015 15:05:35 -0500 Subject: [PATCH] use this.getOptionName() for consistency, options variable name --- lib/rules/disallow-anonymous-functions.js | 6 ++--- lib/rules/disallow-capitalized-comments.js | 6 ++--- lib/rules/disallow-comma-before-line-break.js | 6 ++--- lib/rules/disallow-dangling-underscores.js | 2 +- lib/rules/disallow-empty-blocks.js | 10 ++++----- lib/rules/disallow-function-declarations.js | 6 ++--- .../disallow-implicit-type-conversion.js | 2 +- lib/rules/disallow-keywords-in-comments.js | 14 ++++++------ lib/rules/disallow-keywords.js | 2 +- lib/rules/disallow-mixed-spaces-and-tabs.js | 10 ++++----- lib/rules/disallow-multiple-line-breaks.js | 10 ++++----- lib/rules/disallow-multiple-line-strings.js | 6 ++--- lib/rules/disallow-multiple-var-decl.js | 14 ++++++------ ...isallow-newline-before-block-statements.js | 6 ++--- .../disallow-operator-before-line-break.js | 2 +- .../disallow-padding-newlines-after-blocks.js | 4 ++-- ...w-padding-newlines-before-line-comments.js | 2 +- .../disallow-padding-newlines-in-blocks.js | 6 ++--- .../disallow-padding-newlines-in-objects.js | 2 +- lib/rules/disallow-quoted-keys-in-objects.js | 6 ++--- lib/rules/disallow-semicolons.js | 6 ++--- .../disallow-space-after-line-comment.js | 6 ++--- .../disallow-space-before-binary-operators.js | 2 +- .../disallow-space-before-block-statements.js | 10 ++++----- lib/rules/disallow-space-before-keywords.js | 2 +- lib/rules/disallow-space-between-arguments.js | 6 ++--- ...spaces-in-anonymous-function-expression.js | 8 +++---- .../disallow-spaces-in-call-expression.js | 6 ++--- lib/rules/disallow-spaces-in-for-statement.js | 6 ++--- ...disallow-spaces-in-function-declaration.js | 8 +++---- .../disallow-spaces-in-function-expression.js | 8 +++---- lib/rules/disallow-spaces-in-function.js | 8 +++---- ...low-spaces-in-named-function-expression.js | 8 +++---- .../disallow-spaces-inside-array-brackets.js | 2 +- lib/rules/disallow-spaces-inside-brackets.js | 2 +- .../disallow-spaces-inside-object-brackets.js | 2 +- .../disallow-spaces-inside-parentheses.js | 2 +- lib/rules/disallow-trailing-comma.js | 10 ++++----- lib/rules/disallow-trailing-whitespace.js | 8 +++---- lib/rules/disallow-yoda-conditions.js | 10 ++++----- lib/rules/maximum-line-length.js | 4 ++-- lib/rules/require-anonymous-functions.js | 6 ++--- lib/rules/require-blocks-on-newline.js | 8 +++---- ...uire-camelcase-or-uppercase-identifiers.js | 8 +++---- lib/rules/require-capitalized-comments.js | 6 ++--- lib/rules/require-capitalized-constructors.js | 8 +++---- lib/rules/require-comma-before-line-break.js | 6 ++--- lib/rules/require-curly-braces.js | 2 +- lib/rules/require-dot-notation.js | 8 +++---- lib/rules/require-function-declarations.js | 6 ++--- ...re-line-break-after-variable-assignment.js | 10 ++++----- lib/rules/require-line-feed-at-file-end.js | 6 ++--- lib/rules/require-multiple-var-decl.js | 14 ++++++------ ...require-newline-before-block-statements.js | 10 ++++----- .../require-operator-before-line-break.js | 2 +- .../require-padding-newlines-after-blocks.js | 4 ++-- ...equire-padding-newlines-before-keywords.js | 2 +- ...e-padding-newlines-before-line-comments.js | 4 ++-- .../require-padding-newlines-in-blocks.js | 8 +++---- .../require-padding-newlines-in-objects.js | 4 ++-- lib/rules/require-parentheses-around-iife.js | 10 ++++----- .../require-space-after-binary-operators.js | 2 +- lib/rules/require-space-after-keywords.js | 2 +- lib/rules/require-space-after-line-comment.js | 22 +++++++++---------- lib/rules/require-space-after-object-keys.js | 4 ++-- .../require-space-before-binary-operators.js | 2 +- .../require-space-before-block-statements.js | 10 ++++----- .../require-space-before-object-values.js | 4 ++-- lib/rules/require-space-between-arguments.js | 6 ++--- ...spaces-in-anonymous-function-expression.js | 8 +++---- .../require-spaces-in-call-expression.js | 6 ++--- lib/rules/require-spaces-in-for-statement.js | 6 ++--- .../require-spaces-in-function-declaration.js | 8 +++---- .../require-spaces-in-function-expression.js | 8 +++---- lib/rules/require-spaces-in-function.js | 8 +++---- ...ire-spaces-in-named-function-expression.js | 8 +++---- .../require-spaces-inside-array-brackets.js | 2 +- lib/rules/require-spaces-inside-brackets.js | 2 +- .../require-spaces-inside-object-brackets.js | 2 +- .../require-spaces-inside-parentheses.js | 2 +- lib/rules/require-trailing-comma.js | 20 ++++++++--------- lib/rules/require-yoda-conditions.js | 10 ++++----- lib/rules/safe-context-keyword.js | 2 +- lib/rules/validate-indentation.js | 18 +++++++-------- lib/rules/validate-jsdoc.js | 2 +- lib/rules/validate-line-breaks.js | 2 +- lib/rules/validate-parameter-separator.js | 8 +++---- lib/rules/validate-quote-marks.js | 4 ++-- 88 files changed, 278 insertions(+), 278 deletions(-) diff --git a/lib/rules/disallow-anonymous-functions.js b/lib/rules/disallow-anonymous-functions.js index 56252e03d..428d3c5c1 100644 --- a/lib/rules/disallow-anonymous-functions.js +++ b/lib/rules/disallow-anonymous-functions.js @@ -41,10 +41,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(disallowAnonymousFunctions) { + configure: function(options) { assert( - disallowAnonymousFunctions === true, - 'disallowAnonymousFunctions option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-capitalized-comments.js b/lib/rules/disallow-capitalized-comments.js index d4b49c9ca..6e16166da 100644 --- a/lib/rules/disallow-capitalized-comments.js +++ b/lib/rules/disallow-capitalized-comments.js @@ -42,10 +42,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(disallowCapitalizedComments) { + configure: function(options) { assert( - disallowCapitalizedComments === true, - 'disallowCapitalizedComments option requires a value of true or should be removed' + options === true, + this.getOptionName() + ' option requires a value of true or should be removed' ); }, diff --git a/lib/rules/disallow-comma-before-line-break.js b/lib/rules/disallow-comma-before-line-break.js index 8bb40da5f..e629f1be8 100644 --- a/lib/rules/disallow-comma-before-line-break.js +++ b/lib/rules/disallow-comma-before-line-break.js @@ -39,10 +39,10 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowCommaBeforeLineBreak) { + configure: function(options) { assert( - disallowCommaBeforeLineBreak === true, - 'disallowCommaBeforeLineBreak option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-dangling-underscores.js b/lib/rules/disallow-dangling-underscores.js index c69ab0b1b..fa73e0713 100644 --- a/lib/rules/disallow-dangling-underscores.js +++ b/lib/rules/disallow-dangling-underscores.js @@ -63,7 +63,7 @@ module.exports.prototype = { typeof identifiers !== 'object' || Array.isArray(identifiers.allExcept) && typeof identifiers.allExcept[0] === 'string', - 'Property `allExcept` in disallowDanglingUnderscores should be an array of strings' + 'Property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); var isTrue = identifiers === true; diff --git a/lib/rules/disallow-empty-blocks.js b/lib/rules/disallow-empty-blocks.js index 607377593..3bf96a8ab 100644 --- a/lib/rules/disallow-empty-blocks.js +++ b/lib/rules/disallow-empty-blocks.js @@ -33,14 +33,14 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowEmptyBlocks) { + configure: function(options) { assert( - typeof disallowEmptyBlocks === 'boolean', - 'disallowEmptyBlocks option requires boolean value' + typeof options === 'boolean', + this.getOptionName() + ' option requires boolean value' ); assert( - disallowEmptyBlocks === true, - 'disallowEmptyBlocks option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-function-declarations.js b/lib/rules/disallow-function-declarations.js index 8ea30d36d..34a4a2a5d 100644 --- a/lib/rules/disallow-function-declarations.js +++ b/lib/rules/disallow-function-declarations.js @@ -41,10 +41,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(disallowFunctionDeclarations) { + configure: function(options) { assert( - disallowFunctionDeclarations === true, - 'disallowFunctionDeclarations option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-implicit-type-conversion.js b/lib/rules/disallow-implicit-type-conversion.js index 24306c009..b40a389f8 100644 --- a/lib/rules/disallow-implicit-type-conversion.js +++ b/lib/rules/disallow-implicit-type-conversion.js @@ -37,7 +37,7 @@ module.exports = function() {}; module.exports.prototype = { configure: function(types) { - assert(Array.isArray(types), 'disallowImplicitTypeConversion option requires array value'); + assert(Array.isArray(types), this.getOptionName() + ' option requires array value'); this._typeIndex = {}; for (var i = 0, l = types.length; i < l; i++) { this._typeIndex[types[i]] = true; diff --git a/lib/rules/disallow-keywords-in-comments.js b/lib/rules/disallow-keywords-in-comments.js index 99cdc317b..e00b31174 100644 --- a/lib/rules/disallow-keywords-in-comments.js +++ b/lib/rules/disallow-keywords-in-comments.js @@ -61,27 +61,27 @@ function getCommentErrors(comment, keywordRegEx) { module.exports = function() {}; module.exports.prototype = { - configure: function(disallowKeywordsInComments) { + configure: function(keywords) { this._message = 'Comments cannot contain the following keywords: '; this._keywords = ['todo', 'fixme']; switch (true) { - case Array.isArray(disallowKeywordsInComments): + case Array.isArray(keywords): // use the array of strings provided to build RegExp pattern - this._keywords = disallowKeywordsInComments; + this._keywords = keywords; /* falls through */ - case disallowKeywordsInComments: + case keywords: // use default keywords this._message += this._keywords.join(', '); this._keywordRegEx = new RegExp('\\b(' + this._keywords.join('|') + ')\\b', 'gi'); break; - case typeof disallowKeywordsInComments === 'string': + case typeof keywords === 'string': // use string passed in as the RegExp pattern this._message = 'Comments cannot contain keywords based on the expression you provided'; - this._keywordRegEx = new RegExp(disallowKeywordsInComments, 'gi'); + this._keywordRegEx = new RegExp(keywords, 'gi'); break; default: - assert(false, 'disallowKeywordsInComments option requires a value of true, a string or an array'); + assert(false, this.getOptionName() + ' option requires a value of true, a string or an array'); } }, diff --git a/lib/rules/disallow-keywords.js b/lib/rules/disallow-keywords.js index 133c6c864..91b857145 100644 --- a/lib/rules/disallow-keywords.js +++ b/lib/rules/disallow-keywords.js @@ -27,7 +27,7 @@ module.exports = function() {}; module.exports.prototype = { configure: function(keywords) { - assert(Array.isArray(keywords), 'disallowKeywords option requires array value'); + assert(Array.isArray(keywords), this.getOptionName() + ' option requires array value'); this._keywords = keywords; }, diff --git a/lib/rules/disallow-mixed-spaces-and-tabs.js b/lib/rules/disallow-mixed-spaces-and-tabs.js index 79834d44c..0ef32824e 100644 --- a/lib/rules/disallow-mixed-spaces-and-tabs.js +++ b/lib/rules/disallow-mixed-spaces-and-tabs.js @@ -55,13 +55,13 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowMixedSpacesAndTabs) { + configure: function(options) { assert( - disallowMixedSpacesAndTabs === true || disallowMixedSpacesAndTabs === 'smart', - 'disallowMixedSpacesAndTabs option requires true or "smart" value' + options === true || options === 'smart', + this.getOptionName() + ' option requires true or "smart" value' ); - this._disallowMixedSpacesAndTabs = disallowMixedSpacesAndTabs; + this._options = options; }, getOptionName: function() { @@ -69,7 +69,7 @@ module.exports.prototype = { }, check: function(file, errors) { - var test = this._disallowMixedSpacesAndTabs === true ? + var test = this._options === true ? (/ \t|\t [^\*]|\t $/) : (/ \t/); diff --git a/lib/rules/disallow-multiple-line-breaks.js b/lib/rules/disallow-multiple-line-breaks.js index 61a77ea5f..4cc823632 100644 --- a/lib/rules/disallow-multiple-line-breaks.js +++ b/lib/rules/disallow-multiple-line-breaks.js @@ -33,14 +33,14 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowMultipleLineBreaks) { + configure: function(options) { assert( - typeof disallowMultipleLineBreaks === 'boolean', - 'disallowMultipleLineBreaks option requires boolean value' + typeof options === 'boolean', + this.getOptionName() + ' option requires boolean value' ); assert( - disallowMultipleLineBreaks === true, - 'disallowMultipleLineBreaks option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-multiple-line-strings.js b/lib/rules/disallow-multiple-line-strings.js index c3285da97..ad1304e12 100644 --- a/lib/rules/disallow-multiple-line-strings.js +++ b/lib/rules/disallow-multiple-line-strings.js @@ -33,10 +33,10 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowMultipleLineStrings) { + configure: function(options) { assert( - disallowMultipleLineStrings === true, - 'disallowMultipleLineStrings option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-multiple-var-decl.js b/lib/rules/disallow-multiple-var-decl.js index 2d035e069..1c6d79822 100644 --- a/lib/rules/disallow-multiple-var-decl.js +++ b/lib/rules/disallow-multiple-var-decl.js @@ -57,16 +57,16 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowMultipleVarDecl) { + configure: function(options) { assert( - disallowMultipleVarDecl === true || - disallowMultipleVarDecl === 'strict' || - disallowMultipleVarDecl === 'exceptUndefined', - 'disallowMultipleVarDecl option requires true, "strict", or "exceptUndefined" value' + options === true || + options === 'strict' || + options === 'exceptUndefined', + this.getOptionName() + ' option requires true, "strict", or "exceptUndefined" value' ); - this.strictMode = disallowMultipleVarDecl === 'strict'; - this.exceptUndefined = disallowMultipleVarDecl === 'exceptUndefined'; + this.strictMode = options === 'strict'; + this.exceptUndefined = options === 'exceptUndefined'; }, getOptionName: function() { diff --git a/lib/rules/disallow-newline-before-block-statements.js b/lib/rules/disallow-newline-before-block-statements.js index 7f26a4296..b19477ff2 100644 --- a/lib/rules/disallow-newline-before-block-statements.js +++ b/lib/rules/disallow-newline-before-block-statements.js @@ -74,10 +74,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(disallowNewlineBeforeBlockStatements) { + configure: function(options) { assert( - disallowNewlineBeforeBlockStatements === true, - 'disallowNewlineBeforeBlockStatements option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-operator-before-line-break.js b/lib/rules/disallow-operator-before-line-break.js index 0e6c1105c..06002c0cd 100644 --- a/lib/rules/disallow-operator-before-line-break.js +++ b/lib/rules/disallow-operator-before-line-break.js @@ -40,7 +40,7 @@ module.exports = function() {}; module.exports.prototype = { configure: function(operators) { assert(Array.isArray(operators) || operators === true, - 'disallowOperatorBeforeLineBreak option requires array or true value'); + this.getOptionName() + ' option requires array or true value'); if (operators === true) { operators = defaultOperators; diff --git a/lib/rules/disallow-padding-newlines-after-blocks.js b/lib/rules/disallow-padding-newlines-after-blocks.js index f6c1181f5..5e64c581f 100644 --- a/lib/rules/disallow-padding-newlines-after-blocks.js +++ b/lib/rules/disallow-padding-newlines-after-blocks.js @@ -66,11 +66,11 @@ module.exports.prototype = { configure: function(value) { assert( typeof value === 'boolean', - 'disallowPaddingNewLinesAfterBlocks option requires boolean value' + this.getOptionName() + ' option requires boolean value' ); assert( value === true, - 'disallowPaddingNewLinesAfterBlocks option requires true value or should be removed' + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-padding-newlines-before-line-comments.js b/lib/rules/disallow-padding-newlines-before-line-comments.js index 73f21eaa8..1c051c5e3 100644 --- a/lib/rules/disallow-padding-newlines-before-line-comments.js +++ b/lib/rules/disallow-padding-newlines-before-line-comments.js @@ -38,7 +38,7 @@ module.exports.prototype = { configure: function(value) { assert( value === true, - 'disallowPaddingNewLinesBeforeLineComments option requires true value or should be removed' + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-padding-newlines-in-blocks.js b/lib/rules/disallow-padding-newlines-in-blocks.js index f75fff81f..dcf964e96 100644 --- a/lib/rules/disallow-padding-newlines-in-blocks.js +++ b/lib/rules/disallow-padding-newlines-in-blocks.js @@ -38,10 +38,10 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowPaddingNewlinesInBlocks) { + configure: function(options) { assert( - disallowPaddingNewlinesInBlocks === true, - 'disallowPaddingNewlinesInBlocks option requires the value true or should be removed' + options === true, + this.getOptionName() + ' option requires the value true or should be removed' ); }, diff --git a/lib/rules/disallow-padding-newlines-in-objects.js b/lib/rules/disallow-padding-newlines-in-objects.js index a156ab3a8..094138e0d 100644 --- a/lib/rules/disallow-padding-newlines-in-objects.js +++ b/lib/rules/disallow-padding-newlines-in-objects.js @@ -41,7 +41,7 @@ module.exports.prototype = { configure: function(value) { assert( value === true, - 'disallowPaddingNewLinesInObjects option requires true value or should be removed' + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-quoted-keys-in-objects.js b/lib/rules/disallow-quoted-keys-in-objects.js index 4b0f1e914..8f27f813a 100644 --- a/lib/rules/disallow-quoted-keys-in-objects.js +++ b/lib/rules/disallow-quoted-keys-in-objects.js @@ -41,13 +41,13 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowQuotedKeysInObjects) { + configure: function(options) { assert( - disallowQuotedKeysInObjects === true || disallowQuotedKeysInObjects === 'allButReserved', + options === true || options === 'allButReserved', this.getOptionName() + ' options should be true or "allButReserved" value' ); - this._mode = disallowQuotedKeysInObjects; + this._mode = options; }, getOptionName: function() { diff --git a/lib/rules/disallow-semicolons.js b/lib/rules/disallow-semicolons.js index a95c6db61..742398ba6 100644 --- a/lib/rules/disallow-semicolons.js +++ b/lib/rules/disallow-semicolons.js @@ -31,10 +31,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(disallowSemicolons) { + configure: function(options) { assert( - disallowSemicolons === true, - 'disallowSemicolons option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-space-after-line-comment.js b/lib/rules/disallow-space-after-line-comment.js index f0b8bf7bb..dc62b90dc 100644 --- a/lib/rules/disallow-space-after-line-comment.js +++ b/lib/rules/disallow-space-after-line-comment.js @@ -31,10 +31,10 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowSpaceAfterLineComment) { + configure: function(options) { assert( - disallowSpaceAfterLineComment === true, - 'disallowSpaceAfterLineComment option requires the value true' + options === true, + this.getOptionName() + ' option requires the value true' ); }, diff --git a/lib/rules/disallow-space-before-binary-operators.js b/lib/rules/disallow-space-before-binary-operators.js index 338682652..d6864b293 100644 --- a/lib/rules/disallow-space-before-binary-operators.js +++ b/lib/rules/disallow-space-before-binary-operators.js @@ -48,7 +48,7 @@ module.exports.prototype = { assert( Array.isArray(operators) || isTrue, - 'disallowSpaceBeforeBinaryOperators option requires array or true value' + this.getOptionName() + ' option requires array or true value' ); if (isTrue) { diff --git a/lib/rules/disallow-space-before-block-statements.js b/lib/rules/disallow-space-before-block-statements.js index 7db7efb17..e48e2b3e7 100644 --- a/lib/rules/disallow-space-before-block-statements.js +++ b/lib/rules/disallow-space-before-block-statements.js @@ -53,14 +53,14 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(disallowSpaceBeforeBlockStatements) { + configure: function(options) { assert( - typeof disallowSpaceBeforeBlockStatements === 'boolean', - 'disallowSpaceBeforeBlockStatements option requires boolean value' + typeof options === 'boolean', + this.getOptionName() + ' option requires boolean value' ); assert( - disallowSpaceBeforeBlockStatements === true, - 'disallowSpaceBeforeBlockStatements option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-space-before-keywords.js b/lib/rules/disallow-space-before-keywords.js index 13e326627..5bff270a4 100644 --- a/lib/rules/disallow-space-before-keywords.js +++ b/lib/rules/disallow-space-before-keywords.js @@ -42,7 +42,7 @@ module.exports.prototype = { configure: function(keywords) { assert( Array.isArray(keywords) || keywords === true, - 'disallowSpaceBeforeKeywords option requires array or true value'); + this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; diff --git a/lib/rules/disallow-space-between-arguments.js b/lib/rules/disallow-space-between-arguments.js index 6d413e181..c9559de61 100644 --- a/lib/rules/disallow-space-between-arguments.js +++ b/lib/rules/disallow-space-between-arguments.js @@ -30,13 +30,13 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowSpaceBetweenArguments) { + configure: function(options) { assert( - typeof disallowSpaceBetweenArguments === 'boolean', + typeof options === 'boolean', this.getOptionName() + ' option requires boolean value' ); assert( - disallowSpaceBetweenArguments === true, + options === true, this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-spaces-in-anonymous-function-expression.js b/lib/rules/disallow-spaces-in-anonymous-function-expression.js index 087cdb580..f73657673 100644 --- a/lib/rules/disallow-spaces-in-anonymous-function-expression.js +++ b/lib/rules/disallow-spaces-in-anonymous-function-expression.js @@ -44,13 +44,13 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'object', - 'disallowSpacesInAnonymousFunctionExpression option must be the object' + this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, - 'disallowSpacesInAnonymousFunctionExpression.beforeOpeningRoundBrace ' + + this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } @@ -58,14 +58,14 @@ module.exports.prototype = { if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, - 'disallowSpacesInAnonymousFunctionExpression.beforeOpeningCurlyBrace ' + + this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, - 'disallowSpacesInAnonymousFunctionExpression must have beforeOpeningCurlyBrace ' + + this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + ' or beforeOpeningRoundBrace property' ); diff --git a/lib/rules/disallow-spaces-in-call-expression.js b/lib/rules/disallow-spaces-in-call-expression.js index fc51e2a9b..6d76bb871 100644 --- a/lib/rules/disallow-spaces-in-call-expression.js +++ b/lib/rules/disallow-spaces-in-call-expression.js @@ -29,10 +29,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(requireSpacesInCallExpression) { + configure: function(options) { assert( - requireSpacesInCallExpression === true, - 'disallowSpacesInCallExpression option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-spaces-in-for-statement.js b/lib/rules/disallow-spaces-in-for-statement.js index ac8ec62dd..ed1679a49 100644 --- a/lib/rules/disallow-spaces-in-for-statement.js +++ b/lib/rules/disallow-spaces-in-for-statement.js @@ -45,10 +45,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(disallowSpacesInForStatement) { + configure: function(options) { assert( - disallowSpacesInForStatement === true, - 'disallowSpacesInForStatement option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-spaces-in-function-declaration.js b/lib/rules/disallow-spaces-in-function-declaration.js index a995a8180..d7d72163e 100644 --- a/lib/rules/disallow-spaces-in-function-declaration.js +++ b/lib/rules/disallow-spaces-in-function-declaration.js @@ -38,13 +38,13 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'object', - 'disallowSpacesInFunctionDeclaration option must be the object' + this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, - 'disallowSpacesInFunctionDeclaration.beforeOpeningRoundBrace ' + + this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } @@ -52,14 +52,14 @@ module.exports.prototype = { if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, - 'disallowSpacesInFunctionDeclaration.beforeOpeningCurlyBrace ' + + this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, - 'disallowSpacesInFunctionDeclaration must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' + this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); diff --git a/lib/rules/disallow-spaces-in-function-expression.js b/lib/rules/disallow-spaces-in-function-expression.js index a4c53cc39..c37a345ee 100644 --- a/lib/rules/disallow-spaces-in-function-expression.js +++ b/lib/rules/disallow-spaces-in-function-expression.js @@ -43,13 +43,13 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'object', - 'disallowSpacesInFunctionExpression option must be the object' + this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, - 'disallowSpacesInFunctionExpression.beforeOpeningRoundBrace ' + + this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } @@ -57,14 +57,14 @@ module.exports.prototype = { if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, - 'disallowSpacesInFunctionExpression.beforeOpeningCurlyBrace ' + + this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, - 'disallowSpacesInFunctionExpression must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' + this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); diff --git a/lib/rules/disallow-spaces-in-function.js b/lib/rules/disallow-spaces-in-function.js index e15b82b4d..7fb5bb2e3 100644 --- a/lib/rules/disallow-spaces-in-function.js +++ b/lib/rules/disallow-spaces-in-function.js @@ -49,13 +49,13 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'object', - 'disallowSpacesInFunction option must be the object' + this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, - 'disallowSpacesInFunction.beforeOpeningRoundBrace ' + + this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } @@ -63,14 +63,14 @@ module.exports.prototype = { if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, - 'disallowSpacesInFunction.beforeOpeningCurlyBrace ' + + this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, - 'disallowSpacesInFunction must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' + this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); diff --git a/lib/rules/disallow-spaces-in-named-function-expression.js b/lib/rules/disallow-spaces-in-named-function-expression.js index 509a67c38..1992bd538 100644 --- a/lib/rules/disallow-spaces-in-named-function-expression.js +++ b/lib/rules/disallow-spaces-in-named-function-expression.js @@ -38,13 +38,13 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'object', - 'disallowSpacesInNamedFunctionExpression option must be the object' + this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, - 'disallowSpacesInNamedFunctionExpression.beforeOpeningRoundBrace ' + + this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } @@ -52,14 +52,14 @@ module.exports.prototype = { if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, - 'disallowSpacesInNamedFunctionExpression.beforeOpeningCurlyBrace ' + + this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, - 'disallowSpacesInNamedFunctionExpression must have beforeOpeningCurlyBrace ' + + this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + 'or beforeOpeningRoundBrace property' ); diff --git a/lib/rules/disallow-spaces-inside-array-brackets.js b/lib/rules/disallow-spaces-inside-array-brackets.js index b0c00a901..1ee11e9e4 100644 --- a/lib/rules/disallow-spaces-inside-array-brackets.js +++ b/lib/rules/disallow-spaces-inside-array-brackets.js @@ -59,7 +59,7 @@ module.exports.prototype = { }; var isObject = typeof value === 'object'; - var error = 'disallowSpacesInsideArrayBrackets rule' + + var error = this.getOptionName() + ' rule' + ' requires string value "all" or "nested" or object'; if (typeof value === 'string' || value === true) { diff --git a/lib/rules/disallow-spaces-inside-brackets.js b/lib/rules/disallow-spaces-inside-brackets.js index 430b565bb..133e019ad 100644 --- a/lib/rules/disallow-spaces-inside-brackets.js +++ b/lib/rules/disallow-spaces-inside-brackets.js @@ -47,7 +47,7 @@ module.exports.prototype = { configure: function(value) { var isObject = typeof value === 'object'; - var error = 'disallowSpacesInsideBrackets rule requires string value true or object'; + var error = this.getOptionName() + ' rule requires string value true or object'; if (isObject) { assert('allExcept' in value, error); diff --git a/lib/rules/disallow-spaces-inside-object-brackets.js b/lib/rules/disallow-spaces-inside-object-brackets.js index 6c5a15535..16bc55aec 100644 --- a/lib/rules/disallow-spaces-inside-object-brackets.js +++ b/lib/rules/disallow-spaces-inside-object-brackets.js @@ -56,7 +56,7 @@ module.exports.prototype = { }; var isObject = typeof value === 'object'; - var error = 'disallowSpacesInsideObjectBrackets rule' + + var error = this.getOptionName() + ' rule' + ' requires string "all" or "nested", true value or object'; if (typeof value === 'string' || value === true) { diff --git a/lib/rules/disallow-spaces-inside-parentheses.js b/lib/rules/disallow-spaces-inside-parentheses.js index 0023f382c..bcfb4fe67 100644 --- a/lib/rules/disallow-spaces-inside-parentheses.js +++ b/lib/rules/disallow-spaces-inside-parentheses.js @@ -44,7 +44,7 @@ module.exports.prototype = { configure: function(option) { var isObject = typeof option === 'object'; - var error = 'disallowSpacesInsideParentheses option requires' + + var error = this.getOptionName() + ' option requires' + ' true or object value with "only" properties '; // backcompat for 1.10: {all: true} #1027 diff --git a/lib/rules/disallow-trailing-comma.js b/lib/rules/disallow-trailing-comma.js index a532ce51e..db2e123ce 100644 --- a/lib/rules/disallow-trailing-comma.js +++ b/lib/rules/disallow-trailing-comma.js @@ -33,14 +33,14 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(disallowTrailingComma) { + configure: function(options) { assert( - typeof disallowTrailingComma === 'boolean', - 'disallowTrailingComma option requires boolean value' + typeof options === 'boolean', + this.getOptionName() + ' option requires boolean value' ); assert( - disallowTrailingComma === true, - 'disallowTrailingComma option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/disallow-trailing-whitespace.js b/lib/rules/disallow-trailing-whitespace.js index 7f56266e0..7f9cf54df 100644 --- a/lib/rules/disallow-trailing-whitespace.js +++ b/lib/rules/disallow-trailing-whitespace.js @@ -50,12 +50,12 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowTrailingWhitespace) { + configure: function(options) { assert( - disallowTrailingWhitespace === true || disallowTrailingWhitespace === 'ignoreEmptyLines', - 'disallowTrailingWhitespace option requires true value or "ignoreEmptyLines" string' + options === true || options === 'ignoreEmptyLines', + this.getOptionName() + ' option requires true value or "ignoreEmptyLines" string' ); - this._ignoreEmptyLines = disallowTrailingWhitespace === 'ignoreEmptyLines'; + this._ignoreEmptyLines = options === 'ignoreEmptyLines'; }, getOptionName: function() { diff --git a/lib/rules/disallow-yoda-conditions.js b/lib/rules/disallow-yoda-conditions.js index 991368f9e..75d1cd61f 100644 --- a/lib/rules/disallow-yoda-conditions.js +++ b/lib/rules/disallow-yoda-conditions.js @@ -34,14 +34,14 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallowYodaConditions) { + configure: function(options) { assert( - typeof disallowYodaConditions === 'boolean', - 'disallowYodaConditions option requires boolean value' + typeof options === 'boolean', + this.getOptionName() + ' option requires boolean value' ); assert( - disallowYodaConditions === true, - 'disallowYodaConditions option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); this._operatorIndex = { '==': true, diff --git a/lib/rules/maximum-line-length.js b/lib/rules/maximum-line-length.js index e5c2b71bc..f6470916d 100644 --- a/lib/rules/maximum-line-length.js +++ b/lib/rules/maximum-line-length.js @@ -48,7 +48,7 @@ module.exports.prototype = { if (typeof maximumLineLength === 'object') { assert( typeof maximumLineLength.value === 'number', - 'maximumLineLength option requires the "value" property to be defined' + this.getOptionName() + ' option requires the "value" property to be defined' ); this._maximumLineLength = maximumLineLength.value; @@ -64,7 +64,7 @@ module.exports.prototype = { } else { assert( typeof maximumLineLength === 'number', - 'maximumLineLength option requires number value or options object' + this.getOptionName() + ' option requires number value or options object' ); this._maximumLineLength = maximumLineLength; diff --git a/lib/rules/require-anonymous-functions.js b/lib/rules/require-anonymous-functions.js index 2ced50cb1..175c93ff9 100644 --- a/lib/rules/require-anonymous-functions.js +++ b/lib/rules/require-anonymous-functions.js @@ -41,10 +41,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(requireAnonymousFunctions) { + configure: function(options) { assert( - requireAnonymousFunctions === true, - 'requireAnonymousFunctions option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-blocks-on-newline.js b/lib/rules/require-blocks-on-newline.js index ce4f1ffb3..3445832a5 100644 --- a/lib/rules/require-blocks-on-newline.js +++ b/lib/rules/require-blocks-on-newline.js @@ -51,13 +51,13 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireBlocksOnNewline) { + configure: function(options) { assert( - requireBlocksOnNewline === true || typeof requireBlocksOnNewline === 'number', - 'requireBlocksOnNewline option requires the value true or an Integer' + options === true || typeof options === 'number', + this.getOptionName() + ' option requires the value true or an Integer' ); - this._minStatements = requireBlocksOnNewline === true ? 0 : requireBlocksOnNewline; + this._minStatements = options === true ? 0 : options; }, getOptionName: function() { diff --git a/lib/rules/require-camelcase-or-uppercase-identifiers.js b/lib/rules/require-camelcase-or-uppercase-identifiers.js index 005485943..7a9fe6986 100644 --- a/lib/rules/require-camelcase-or-uppercase-identifiers.js +++ b/lib/rules/require-camelcase-or-uppercase-identifiers.js @@ -59,13 +59,13 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireCamelCase) { + configure: function(options) { assert( - requireCamelCase === true || requireCamelCase === 'ignoreProperties', - 'requireCamelCaseOrUpperCaseIdentifiers option requires true value or `ignoreProperties` string' + options === true || options === 'ignoreProperties', + this.getOptionName() + ' option requires true value or `ignoreProperties` string' ); - this._ignoreProperties = (requireCamelCase === 'ignoreProperties'); + this._ignoreProperties = (options === 'ignoreProperties'); }, getOptionName: function() { diff --git a/lib/rules/require-capitalized-comments.js b/lib/rules/require-capitalized-comments.js index e69388089..783b19f64 100644 --- a/lib/rules/require-capitalized-comments.js +++ b/lib/rules/require-capitalized-comments.js @@ -52,10 +52,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(requireCapitalizedComments) { + configure: function(options) { assert( - requireCapitalizedComments === true, - 'requireCapitalizedComments option requires a value of true or should be removed' + options === true, + this.getOptionName() + ' option requires a value of true or should be removed' ); }, diff --git a/lib/rules/require-capitalized-constructors.js b/lib/rules/require-capitalized-constructors.js index f01dd2fb8..f3973c3a6 100644 --- a/lib/rules/require-capitalized-constructors.js +++ b/lib/rules/require-capitalized-constructors.js @@ -36,14 +36,14 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(requireCapitalizedConstructors) { + configure: function(options) { assert( - requireCapitalizedConstructors === true || Array.isArray(requireCapitalizedConstructors.allExcept), - 'requireCapitalizedConstructors option requires object of exceptions or true value' + options === true || Array.isArray(options.allExcept), + this.getOptionName() + ' option requires object of exceptions or true value' ); this._allowedConstructors = {}; - var allExcept = requireCapitalizedConstructors.allExcept; + var allExcept = options.allExcept; if (allExcept) { for (var i = 0, l = allExcept.length; i < l; i++) { this._allowedConstructors[allExcept[i]] = true; diff --git a/lib/rules/require-comma-before-line-break.js b/lib/rules/require-comma-before-line-break.js index 26c3d5410..70c5e272c 100644 --- a/lib/rules/require-comma-before-line-break.js +++ b/lib/rules/require-comma-before-line-break.js @@ -39,10 +39,10 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireCommaBeforeLineBreak) { + configure: function(options) { assert( - requireCommaBeforeLineBreak === true, - 'requireCommaBeforeLineBreak option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-curly-braces.js b/lib/rules/require-curly-braces.js index 0f3406dec..2fea17762 100644 --- a/lib/rules/require-curly-braces.js +++ b/lib/rules/require-curly-braces.js @@ -48,7 +48,7 @@ module.exports.prototype = { configure: function(statementTypes) { assert( Array.isArray(statementTypes) || statementTypes === true, - 'requireCurlyBraces option requires array or true value' + this.getOptionName() + ' option requires array or true value' ); if (statementTypes === true) { diff --git a/lib/rules/require-dot-notation.js b/lib/rules/require-dot-notation.js index 8508e6466..cde6b6045 100644 --- a/lib/rules/require-dot-notation.js +++ b/lib/rules/require-dot-notation.js @@ -80,12 +80,12 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireDotNotation) { + configure: function(options) { assert( - requireDotNotation === true || requireDotNotation === 'except_snake_case', - 'requireDotNotation option requires true value or "except_snake_case" string' + options === true || options === 'except_snake_case', + this.getOptionName() + ' option requires true value or "except_snake_case" string' ); - this._exceptSnakeCase = requireDotNotation === 'except_snake_case'; + this._exceptSnakeCase = options === 'except_snake_case'; }, getOptionName: function() { diff --git a/lib/rules/require-function-declarations.js b/lib/rules/require-function-declarations.js index 479f38e41..72e72c1f7 100644 --- a/lib/rules/require-function-declarations.js +++ b/lib/rules/require-function-declarations.js @@ -56,10 +56,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(requireFunctionDeclarations) { + configure: function(options) { assert( - requireFunctionDeclarations === true, - 'requireFunctionDeclarations option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-line-break-after-variable-assignment.js b/lib/rules/require-line-break-after-variable-assignment.js index ffe4fb604..df6cce824 100644 --- a/lib/rules/require-line-break-after-variable-assignment.js +++ b/lib/rules/require-line-break-after-variable-assignment.js @@ -43,14 +43,14 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireLineBreakAfterVariableAssignment) { + configure: function(options) { assert( - typeof requireLineBreakAfterVariableAssignment === 'boolean', - 'requireLineFeedAtFileEnd option requires boolean value' + typeof options === 'boolean', + this.getOptionName() + ' option requires boolean value' ); assert( - requireLineBreakAfterVariableAssignment === true, - 'requireLineFeedAtFileEnd option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-line-feed-at-file-end.js b/lib/rules/require-line-feed-at-file-end.js index 1b574ce8f..801bef2f7 100644 --- a/lib/rules/require-line-feed-at-file-end.js +++ b/lib/rules/require-line-feed-at-file-end.js @@ -18,10 +18,10 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireLineFeedAtFileEnd) { + configure: function(options) { assert( - requireLineFeedAtFileEnd === true, - 'requireLineFeedAtFileEnd option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-multiple-var-decl.js b/lib/rules/require-multiple-var-decl.js index 8cb5bce7d..1e8696bb7 100644 --- a/lib/rules/require-multiple-var-decl.js +++ b/lib/rules/require-multiple-var-decl.js @@ -97,18 +97,18 @@ function onevar(file, errors) { module.exports = function() {}; module.exports.prototype = { - configure: function(requireMultipleVarDecl) { + configure: function(options) { assert( - typeof requireMultipleVarDecl === 'boolean' || - typeof requireMultipleVarDecl === 'string', - 'requireMultipleVarDecl option requires boolean or string' + typeof options === 'boolean' || + typeof options === 'string', + this.getOptionName() + ' option requires boolean or string' ); assert( - requireMultipleVarDecl === true || requireMultipleVarDecl === 'onevar', - 'requireMultipleVarDecl option requires true value or `onevar` string' + options === true || options === 'onevar', + this.getOptionName() + ' option requires true value or `onevar` string' ); - this._check = typeof requireMultipleVarDecl === 'string' ? onevar : consecutive; + this._check = typeof options === 'string' ? onevar : consecutive; }, getOptionName: function() { diff --git a/lib/rules/require-newline-before-block-statements.js b/lib/rules/require-newline-before-block-statements.js index 90849386e..ea2742e55 100644 --- a/lib/rules/require-newline-before-block-statements.js +++ b/lib/rules/require-newline-before-block-statements.js @@ -74,14 +74,14 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(requireNewlineBeforeBlockStatements) { + configure: function(options) { assert( - typeof requireNewlineBeforeBlockStatements === 'boolean', - 'requireNewlineBeforeBlockStatements option requires boolean value' + typeof options === 'boolean', + this.getOptionName() + ' option requires boolean value' ); assert( - requireNewlineBeforeBlockStatements === true, - 'requireNewlineBeforeBlockStatements option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-operator-before-line-break.js b/lib/rules/require-operator-before-line-break.js index 344263741..93566005e 100644 --- a/lib/rules/require-operator-before-line-break.js +++ b/lib/rules/require-operator-before-line-break.js @@ -58,7 +58,7 @@ module.exports.prototype = { assert( Array.isArray(operators) || isTrue, - 'requireOperatorBeforeLineBreak option requires array value or true value' + this.getOptionName() + ' option requires array value or true value' ); if (isTrue) { diff --git a/lib/rules/require-padding-newlines-after-blocks.js b/lib/rules/require-padding-newlines-after-blocks.js index 06ad33e65..f27c630ba 100644 --- a/lib/rules/require-padding-newlines-after-blocks.js +++ b/lib/rules/require-padding-newlines-after-blocks.js @@ -74,11 +74,11 @@ module.exports.prototype = { configure: function(value) { assert( typeof value === 'boolean', - 'requirePaddingNewLinesAfterBlocks option requires boolean value' + this.getOptionName() + ' option requires boolean value' ); assert( value === true, - 'requirePaddingNewLinesAfterBlocks option requires true value or should be removed' + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-padding-newlines-before-keywords.js b/lib/rules/require-padding-newlines-before-keywords.js index 671f7a329..a9af45e0c 100644 --- a/lib/rules/require-padding-newlines-before-keywords.js +++ b/lib/rules/require-padding-newlines-before-keywords.js @@ -70,7 +70,7 @@ module.exports.prototype = { configure: function(keywords) { assert(Array.isArray(keywords) || keywords === true, - 'requirePaddingNewlinesBeforeKeywords option requires array or true value'); + this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; diff --git a/lib/rules/require-padding-newlines-before-line-comments.js b/lib/rules/require-padding-newlines-before-line-comments.js index cec210bda..40a7a6e39 100644 --- a/lib/rules/require-padding-newlines-before-line-comments.js +++ b/lib/rules/require-padding-newlines-before-line-comments.js @@ -65,12 +65,12 @@ module.exports.prototype = { if (typeof value === 'object') { assert(typeof value.allExcept === 'string' && value.allExcept === 'firstAfterCurly', - 'requirePaddingNewLinesBeforeLineComments option requires the "allExcept" ' + + this.getOptionName() + ' option requires the "allExcept" ' + 'property to equal "firstAfterCurly"'); this._allowFirstAfterCurly = true; } else { assert(value === true, - 'requirePaddingNewLinesBeforeLineComments option requires true value or object' + this.getOptionName() + ' option requires true value or object' ); } }, diff --git a/lib/rules/require-padding-newlines-in-blocks.js b/lib/rules/require-padding-newlines-in-blocks.js index c38333175..a03d0a97c 100644 --- a/lib/rules/require-padding-newlines-in-blocks.js +++ b/lib/rules/require-padding-newlines-in-blocks.js @@ -65,13 +65,13 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requirePaddingNewlinesInBlocks) { + configure: function(options) { assert( - requirePaddingNewlinesInBlocks === true || typeof requirePaddingNewlinesInBlocks === 'number', - 'requirePaddingNewlinesInBlocks option requires the value true or an Integer' + options === true || typeof options === 'number', + this.getOptionName() + ' option requires the value true or an Integer' ); - this._minStatements = requirePaddingNewlinesInBlocks === true ? 0 : requirePaddingNewlinesInBlocks; + this._minStatements = options === true ? 0 : options; }, getOptionName: function() { diff --git a/lib/rules/require-padding-newlines-in-objects.js b/lib/rules/require-padding-newlines-in-objects.js index 15c2c8075..33820d499 100644 --- a/lib/rules/require-padding-newlines-in-objects.js +++ b/lib/rules/require-padding-newlines-in-objects.js @@ -41,11 +41,11 @@ module.exports.prototype = { configure: function(value) { assert( typeof value === 'boolean', - 'requirePaddingNewLinesInObjects option requires boolean value' + this.getOptionName() + ' option requires boolean value' ); assert( value === true, - 'requirePaddingNewLinesInObjects option requires true value or should be removed' + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-parentheses-around-iife.js b/lib/rules/require-parentheses-around-iife.js index 3c686aaaa..421626ccf 100644 --- a/lib/rules/require-parentheses-around-iife.js +++ b/lib/rules/require-parentheses-around-iife.js @@ -40,14 +40,14 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireParenthesesAroundIIFE) { + configure: function(options) { assert( - typeof requireParenthesesAroundIIFE === 'boolean', - 'requireParenthesesAroundIIFE option requires boolean value' + typeof options === 'boolean', + this.getOptionName() + ' option requires boolean value' ); assert( - requireParenthesesAroundIIFE === true, - 'requireParenthesesAroundIIFE option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-space-after-binary-operators.js b/lib/rules/require-space-after-binary-operators.js index 4f976272f..8781e4a01 100644 --- a/lib/rules/require-space-after-binary-operators.js +++ b/lib/rules/require-space-after-binary-operators.js @@ -48,7 +48,7 @@ module.exports.prototype = { assert( Array.isArray(operators) || isTrue, - 'requireSpaceAfterBinaryOperators option requires array or true value' + this.getOptionName() + ' option requires array or true value' ); if (isTrue) { diff --git a/lib/rules/require-space-after-keywords.js b/lib/rules/require-space-after-keywords.js index 89b1a53c4..480f59d9c 100644 --- a/lib/rules/require-space-after-keywords.js +++ b/lib/rules/require-space-after-keywords.js @@ -52,7 +52,7 @@ module.exports.prototype = { configure: function(keywords) { assert( Array.isArray(keywords) || keywords === true, - 'requireSpaceAfterKeywords option requires array or true value'); + this.getOptionName() + ' option requires array or true value'); if (keywords === true) { keywords = defaultKeywords; diff --git a/lib/rules/require-space-after-line-comment.js b/lib/rules/require-space-after-line-comment.js index 9688bdede..ca163ef8d 100644 --- a/lib/rules/require-space-after-line-comment.js +++ b/lib/rules/require-space-after-line-comment.js @@ -37,28 +37,28 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireSpaceAfterLineComment) { + configure: function(options) { assert( - requireSpaceAfterLineComment === true || - requireSpaceAfterLineComment === 'allowSlash' || - typeof requireSpaceAfterLineComment === 'object', - 'requireSpaceAfterLineComment option requires the value `true` ' + + options === true || + options === 'allowSlash' || + typeof options === 'object', + this.getOptionName() + ' option requires the value `true` ' + 'or an object with String[] `allExcept` property' ); // verify first item in `allExcept` property in object (if it's an object) assert( - typeof requireSpaceAfterLineComment !== 'object' || - Array.isArray(requireSpaceAfterLineComment.allExcept) && - typeof requireSpaceAfterLineComment.allExcept[0] === 'string', - 'Property `allExcept` in requireSpaceAfterLineComment should be an array of strings' + typeof options !== 'object' || + Array.isArray(options.allExcept) && + typeof options.allExcept[0] === 'string', + 'Property `allExcept` in ' + this.getOptionName() + ' should be an array of strings' ); // don't check triple slashed comments, microsoft js doc convention. see #593 // exceptions. see #592 // need to drop allowSlash support in 2.0. Fixes #697 - this._allExcept = requireSpaceAfterLineComment === 'allowSlash' ? ['/'] : - requireSpaceAfterLineComment.allExcept || []; + this._allExcept = options === 'allowSlash' ? ['/'] : + options.allExcept || []; }, getOptionName: function() { diff --git a/lib/rules/require-space-after-object-keys.js b/lib/rules/require-space-after-object-keys.js index c70edc24b..f71e14822 100644 --- a/lib/rules/require-space-after-object-keys.js +++ b/lib/rules/require-space-after-object-keys.js @@ -27,9 +27,9 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireSpaceAfterObjectKeys) { + configure: function(options) { assert( - requireSpaceAfterObjectKeys === true, + options === true, this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-space-before-binary-operators.js b/lib/rules/require-space-before-binary-operators.js index 47ab68fd3..39df13111 100644 --- a/lib/rules/require-space-before-binary-operators.js +++ b/lib/rules/require-space-before-binary-operators.js @@ -52,7 +52,7 @@ module.exports.prototype = { assert( Array.isArray(operators) || isTrue, - 'requireSpaceBeforeBinaryOperators option requires array or true value' + this.getOptionName() + ' option requires array or true value' ); if (isTrue) { diff --git a/lib/rules/require-space-before-block-statements.js b/lib/rules/require-space-before-block-statements.js index b9703bd36..5afe64ab2 100644 --- a/lib/rules/require-space-before-block-statements.js +++ b/lib/rules/require-space-before-block-statements.js @@ -53,14 +53,14 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(requireSpaceBeforeBlockStatements) { + configure: function(options) { assert( - typeof requireSpaceBeforeBlockStatements === 'boolean', - 'requireSpaceBeforeBlockStatements option requires boolean value' + typeof options === 'boolean', + this.getOptionName() + ' option requires boolean value' ); assert( - requireSpaceBeforeBlockStatements === true, - 'requireSpaceBeforeBlockStatements option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-space-before-object-values.js b/lib/rules/require-space-before-object-values.js index 7cba2e845..af9a18ba9 100644 --- a/lib/rules/require-space-before-object-values.js +++ b/lib/rules/require-space-before-object-values.js @@ -27,9 +27,9 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(disallow) { + configure: function(options) { assert( - disallow === true, + options === true, this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-space-between-arguments.js b/lib/rules/require-space-between-arguments.js index b45308728..ca8372515 100644 --- a/lib/rules/require-space-between-arguments.js +++ b/lib/rules/require-space-between-arguments.js @@ -30,13 +30,13 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireSpaceBetweenArguments) { + configure: function(options) { assert( - typeof requireSpaceBetweenArguments === 'boolean', + typeof options === 'boolean', this.getOptionName() + ' option requires boolean value' ); assert( - requireSpaceBetweenArguments === true, + options === true, this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-spaces-in-anonymous-function-expression.js b/lib/rules/require-spaces-in-anonymous-function-expression.js index 486392a11..3a93454a1 100644 --- a/lib/rules/require-spaces-in-anonymous-function-expression.js +++ b/lib/rules/require-spaces-in-anonymous-function-expression.js @@ -44,13 +44,13 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'object', - 'requireSpacesInAnonymousFunctionExpression option must be the object' + this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, - 'requireSpacesInAnonymousFunctionExpression.beforeOpeningRoundBrace ' + + this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } @@ -58,14 +58,14 @@ module.exports.prototype = { if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, - 'requireSpacesInAnonymousFunctionExpression.beforeOpeningCurlyBrace ' + + this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, - 'requireSpacesInAnonymousFunctionExpression must have beforeOpeningCurlyBrace ' + + this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + ' or beforeOpeningRoundBrace property' ); diff --git a/lib/rules/require-spaces-in-call-expression.js b/lib/rules/require-spaces-in-call-expression.js index f2e206b65..f05179f74 100644 --- a/lib/rules/require-spaces-in-call-expression.js +++ b/lib/rules/require-spaces-in-call-expression.js @@ -29,10 +29,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(requireSpacesInCallExpression) { + configure: function(options) { assert( - requireSpacesInCallExpression === true, - 'requireSpacesInCallExpression option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-spaces-in-for-statement.js b/lib/rules/require-spaces-in-for-statement.js index 1e06f19ab..ad085a440 100644 --- a/lib/rules/require-spaces-in-for-statement.js +++ b/lib/rules/require-spaces-in-for-statement.js @@ -45,10 +45,10 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(requireSpacesInForStatement) { + configure: function(options) { assert( - requireSpacesInForStatement === true, - 'requireSpacesInForStatement option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); }, diff --git a/lib/rules/require-spaces-in-function-declaration.js b/lib/rules/require-spaces-in-function-declaration.js index 53f3bc525..9440135d1 100644 --- a/lib/rules/require-spaces-in-function-declaration.js +++ b/lib/rules/require-spaces-in-function-declaration.js @@ -38,13 +38,13 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'object', - 'requireSpacesInFunctionDeclaration option must be the object' + this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, - 'requireSpacesInFunctionDeclaration.beforeOpeningRoundBrace ' + + this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } @@ -52,14 +52,14 @@ module.exports.prototype = { if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, - 'requireSpacesInFunctionDeclaration.beforeOpeningCurlyBrace ' + + this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, - 'requireSpacesInFunctionDeclaration must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' + this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); diff --git a/lib/rules/require-spaces-in-function-expression.js b/lib/rules/require-spaces-in-function-expression.js index 26a35e2fc..c1556b9d5 100644 --- a/lib/rules/require-spaces-in-function-expression.js +++ b/lib/rules/require-spaces-in-function-expression.js @@ -43,13 +43,13 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'object', - 'requireSpacesInFunctionExpression option must be the object' + this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, - 'requireSpacesInFunctionExpression.beforeOpeningRoundBrace ' + + this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } @@ -57,14 +57,14 @@ module.exports.prototype = { if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, - 'requireSpacesInFunctionExpression.beforeOpeningCurlyBrace ' + + this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, - 'requireSpacesInFunctionExpression must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' + this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); diff --git a/lib/rules/require-spaces-in-function.js b/lib/rules/require-spaces-in-function.js index 459d6b554..47274e104 100644 --- a/lib/rules/require-spaces-in-function.js +++ b/lib/rules/require-spaces-in-function.js @@ -49,13 +49,13 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'object', - 'requireSpacesInFunction option must be the object' + this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, - 'requireSpacesInFunction.beforeOpeningRoundBrace ' + + this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } @@ -63,14 +63,14 @@ module.exports.prototype = { if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, - 'requireSpacesInFunction.beforeOpeningCurlyBrace ' + + this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, - 'requireSpacesInFunction must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' + this.getOptionName() + ' must have beforeOpeningCurlyBrace or beforeOpeningRoundBrace property' ); this._beforeOpeningRoundBrace = Boolean(options.beforeOpeningRoundBrace); diff --git a/lib/rules/require-spaces-in-named-function-expression.js b/lib/rules/require-spaces-in-named-function-expression.js index a6bd33291..777da6643 100644 --- a/lib/rules/require-spaces-in-named-function-expression.js +++ b/lib/rules/require-spaces-in-named-function-expression.js @@ -38,13 +38,13 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'object', - 'requireSpacesInNamedFunctionExpression option must be the object' + this.getOptionName() + ' option must be the object' ); if ('beforeOpeningRoundBrace' in options) { assert( options.beforeOpeningRoundBrace === true, - 'requireSpacesInNamedFunctionExpression.beforeOpeningRoundBrace ' + + this.getOptionName() + '.beforeOpeningRoundBrace ' + 'property requires true value or should be removed' ); } @@ -52,14 +52,14 @@ module.exports.prototype = { if ('beforeOpeningCurlyBrace' in options) { assert( options.beforeOpeningCurlyBrace === true, - 'requireSpacesInNamedFunctionExpression.beforeOpeningCurlyBrace ' + + this.getOptionName() + '.beforeOpeningCurlyBrace ' + 'property requires true value or should be removed' ); } assert( options.beforeOpeningCurlyBrace || options.beforeOpeningRoundBrace, - 'requireSpacesInNamedFunctionExpression must have beforeOpeningCurlyBrace ' + + this.getOptionName() + ' must have beforeOpeningCurlyBrace ' + 'or beforeOpeningRoundBrace property' ); diff --git a/lib/rules/require-spaces-inside-array-brackets.js b/lib/rules/require-spaces-inside-array-brackets.js index ed1607590..ba060f66a 100644 --- a/lib/rules/require-spaces-inside-array-brackets.js +++ b/lib/rules/require-spaces-inside-array-brackets.js @@ -58,7 +58,7 @@ module.exports.prototype = { }; var isObject = typeof value === 'object'; - var error = 'requireSpacesInsideArrayBrackets rule' + + var error = this.getOptionName() + ' rule' + ' requires string value "all" or "allButNested" or object'; if (typeof value === 'string') { diff --git a/lib/rules/require-spaces-inside-brackets.js b/lib/rules/require-spaces-inside-brackets.js index 19b2bfefc..d4aacf70c 100644 --- a/lib/rules/require-spaces-inside-brackets.js +++ b/lib/rules/require-spaces-inside-brackets.js @@ -47,7 +47,7 @@ module.exports.prototype = { configure: function(value) { var isObject = typeof value === 'object'; - var error = 'requireSpacesInsideBrackets rule requires string value true or object'; + var error = this.getOptionName() + ' rule requires string value true or object'; if (isObject) { assert('allExcept' in value, error); diff --git a/lib/rules/require-spaces-inside-object-brackets.js b/lib/rules/require-spaces-inside-object-brackets.js index 70a15c2da..91c16101d 100644 --- a/lib/rules/require-spaces-inside-object-brackets.js +++ b/lib/rules/require-spaces-inside-object-brackets.js @@ -57,7 +57,7 @@ module.exports.prototype = { }; var isObject = typeof value === 'object'; - var error = 'requireSpacesInsideObjectBrackets rule' + + var error = this.getOptionName() + ' rule' + ' requires string value \'all\' or \'allButNested\' or object'; if (typeof value === 'string') { diff --git a/lib/rules/require-spaces-inside-parentheses.js b/lib/rules/require-spaces-inside-parentheses.js index 8178bb48e..9f506e67e 100644 --- a/lib/rules/require-spaces-inside-parentheses.js +++ b/lib/rules/require-spaces-inside-parentheses.js @@ -54,7 +54,7 @@ module.exports.prototype = { }; var isObject = typeof value === 'object'; - var error = 'requireSpacesInsideParentheses rule' + + var error = this.getOptionName() + ' rule' + ' requires string value \'all\' or \'allButNested\' or object'; if (typeof value === 'string') { diff --git a/lib/rules/require-trailing-comma.js b/lib/rules/require-trailing-comma.js index eb93f6eb5..f47192c99 100644 --- a/lib/rules/require-trailing-comma.js +++ b/lib/rules/require-trailing-comma.js @@ -50,27 +50,27 @@ var assert = require('assert'); module.exports = function() {}; module.exports.prototype = { - configure: function(requireTrailingComma) { + configure: function(options) { - if (typeof requireTrailingComma === 'object') { - if ('ignoreSingleValue' in requireTrailingComma) { + if (typeof options === 'object') { + if ('ignoreSingleValue' in options) { assert( - requireTrailingComma.ignoreSingleValue === true, - 'requireTrailingComma option ignoreSingleValue requires true value or should be removed' + options.ignoreSingleValue === true, + this.getOptionName() + ' option ignoreSingleValue requires true value or should be removed' ); this._ignoreSingleValue = true; } - if ('ignoreSingleLine' in requireTrailingComma) { + if ('ignoreSingleLine' in options) { assert( - requireTrailingComma.ignoreSingleLine === true, - 'requireTrailingComma option ignoreSingleLine requires true value or should be removed' + options.ignoreSingleLine === true, + this.getOptionName() + ' option ignoreSingleLine requires true value or should be removed' ); this._ignoreSingleLine = true; } } else { assert( - requireTrailingComma === true, - 'requireTrailingComma option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); } }, diff --git a/lib/rules/require-yoda-conditions.js b/lib/rules/require-yoda-conditions.js index c945e5719..1a9046d57 100644 --- a/lib/rules/require-yoda-conditions.js +++ b/lib/rules/require-yoda-conditions.js @@ -33,14 +33,14 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(requireYodaConditions) { + configure: function(options) { assert( - typeof requireYodaConditions === 'boolean', - 'requireYodaConditions option requires boolean value' + typeof options === 'boolean', + this.getOptionName() + ' option requires boolean value' ); assert( - requireYodaConditions === true, - 'requireYodaConditions option requires true value or should be removed' + options === true, + this.getOptionName() + ' option requires true value or should be removed' ); this._operatorIndex = { '==': true, diff --git a/lib/rules/safe-context-keyword.js b/lib/rules/safe-context-keyword.js index e81fff058..a92b590e5 100644 --- a/lib/rules/safe-context-keyword.js +++ b/lib/rules/safe-context-keyword.js @@ -33,7 +33,7 @@ module.exports.prototype = { configure: function(keywords) { assert( Array.isArray(keywords) || typeof keywords === 'string', - 'safeContextKeyword option requires string or array value' + this.getOptionName() + ' option requires string or array value' ); this._keywords = keywords; diff --git a/lib/rules/validate-indentation.js b/lib/rules/validate-indentation.js index 466ae2ff6..0092ed6a2 100644 --- a/lib/rules/validate-indentation.js +++ b/lib/rules/validate-indentation.js @@ -114,24 +114,24 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(validateIndentation) { + configure: function(options) { this._includeEmptyLines = false; - if (typeof validateIndentation === 'object') { - this._includeEmptyLines = (validateIndentation.includeEmptyLines === true); - validateIndentation = validateIndentation.value; + if (typeof options === 'object') { + this._includeEmptyLines = (options.includeEmptyLines === true); + options = options.value; } assert( - validateIndentation === '\t' || - (typeof validateIndentation === 'number' && validateIndentation > 0), - 'validateIndentation option requires a positive number of spaces or "\\t"' + + options === '\t' || + (typeof options === 'number' && options > 0), + this.getOptionName() + ' option requires a positive number of spaces or "\\t"' + ' or options object with "value" property' ); - if (typeof validateIndentation === 'number') { + if (typeof options === 'number') { this._indentChar = ' '; - this._indentSize = validateIndentation; + this._indentSize = options; } else { this._indentChar = '\t'; this._indentSize = 1; diff --git a/lib/rules/validate-jsdoc.js b/lib/rules/validate-jsdoc.js index 3a42433b2..c38130d94 100644 --- a/lib/rules/validate-jsdoc.js +++ b/lib/rules/validate-jsdoc.js @@ -5,7 +5,7 @@ module.exports = function() {}; module.exports.prototype = { configure: function(options) { - assert(typeof options === 'object', 'validateJSDoc option requires object value'); + assert(typeof options === 'object', this.getOptionName() + ' option requires object value'); this._options = options; }, diff --git a/lib/rules/validate-line-breaks.js b/lib/rules/validate-line-breaks.js index 6fa508873..f4ae247d6 100644 --- a/lib/rules/validate-line-breaks.js +++ b/lib/rules/validate-line-breaks.js @@ -33,7 +33,7 @@ module.exports.prototype = { configure: function(options) { assert( typeof options === 'string' || typeof options === 'object', - 'validateLineBreaks option requires string or object value' + this.getOptionName() + ' option requires string or object value' ); if (typeof options === 'string') { diff --git a/lib/rules/validate-parameter-separator.js b/lib/rules/validate-parameter-separator.js index bc94f5407..c9f209efb 100644 --- a/lib/rules/validate-parameter-separator.js +++ b/lib/rules/validate-parameter-separator.js @@ -35,13 +35,13 @@ module.exports = function() {}; module.exports.prototype = { - configure: function(validateParameterSeparator) { + configure: function(options) { assert( - typeof validateParameterSeparator === 'string' && /^[ ]?,[ ]?$/.test(validateParameterSeparator), - 'validateParameterSpacing option requires string value containing only a comma and optional spaces' + typeof options === 'string' && /^[ ]?,[ ]?$/.test(options), + this.getOptionName() + ' option requires string value containing only a comma and optional spaces' ); - this._separator = validateParameterSeparator; + this._separator = options; }, getOptionName: function() { diff --git a/lib/rules/validate-quote-marks.js b/lib/rules/validate-quote-marks.js index 7a4ed8e28..e9be92b7f 100644 --- a/lib/rules/validate-quote-marks.js +++ b/lib/rules/validate-quote-marks.js @@ -66,7 +66,7 @@ module.exports.prototype = { if (typeof quoteMark === 'object') { assert( typeof quoteMark.escape === 'boolean' && quoteMark.mark !== undefined, - 'validateQuoteMarks option requires the "escape" and "mark" property to be defined' + this.getOptionName() + ' option requires the "escape" and "mark" property to be defined' ); this._allowEscape = quoteMark.escape; quoteMark = quoteMark.mark; @@ -74,7 +74,7 @@ module.exports.prototype = { assert( quoteMark === '"' || quoteMark === '\'' || quoteMark === true, - 'validateQuoteMarks option requires \'"\', "\'", or boolean true' + this.getOptionName() + ' option requires \'"\', "\'", or boolean true' ); this._quoteMark = quoteMark;