Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
use this.getOptionName() for consistency, options variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
hzoo committed Mar 7, 2015
1 parent 4041911 commit 6816d58
Show file tree
Hide file tree
Showing 88 changed files with 278 additions and 278 deletions.
6 changes: 3 additions & 3 deletions lib/rules/disallow-anonymous-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
6 changes: 3 additions & 3 deletions lib/rules/disallow-capitalized-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
6 changes: 3 additions & 3 deletions lib/rules/disallow-comma-before-line-break.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/disallow-dangling-underscores.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions lib/rules/disallow-empty-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
6 changes: 3 additions & 3 deletions lib/rules/disallow-function-declarations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/disallow-implicit-type-conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions lib/rules/disallow-keywords-in-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
},

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/disallow-keywords.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},

Expand Down
10 changes: 5 additions & 5 deletions lib/rules/disallow-mixed-spaces-and-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ 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() {
return 'disallowMixedSpacesAndTabs';
},

check: function(file, errors) {
var test = this._disallowMixedSpacesAndTabs === true ?
var test = this._options === true ?
(/ \t|\t [^\*]|\t $/) :
(/ \t/);

Expand Down
10 changes: 5 additions & 5 deletions lib/rules/disallow-multiple-line-breaks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
6 changes: 3 additions & 3 deletions lib/rules/disallow-multiple-line-strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
14 changes: 7 additions & 7 deletions lib/rules/disallow-multiple-var-decl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/disallow-newline-before-block-statements.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/disallow-operator-before-line-break.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/disallow-padding-newlines-after-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
6 changes: 3 additions & 3 deletions lib/rules/disallow-padding-newlines-in-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/disallow-padding-newlines-in-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
6 changes: 3 additions & 3 deletions lib/rules/disallow-quoted-keys-in-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/disallow-semicolons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
6 changes: 3 additions & 3 deletions lib/rules/disallow-space-after-line-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/disallow-space-before-binary-operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions lib/rules/disallow-space-before-block-statements.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/disallow-space-before-keywords.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions lib/rules/disallow-space-between-arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
},
Expand Down
Loading

0 comments on commit 6816d58

Please sign in to comment.