Socket
Socket
Sign inDemoInstall

jscs

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jscs - npm Package Compare versions

Comparing version 0.0.12 to 1.0.0

.idea/.name

28

.jscs.json
{
"require_curly_braces": ["if", "else", "for", "while", "do"],
"require_space_after_keywords": ["if", "else", "for", "while", "do", "switch", "return"],
"disallow_left_sticked_operators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallow_right_sticked_operators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"require_right_sticked_operators": ["!"],
"require_left_sticked_operators": [","],
"disallow_implicit_type_conversion": ["string"],
"disallow_keywords": ["with"],
"disallow_muliple_line_breaks": true,
"disallow_keywords_on_new_line": ["else"],
"require_line_feed_at_file_end": true,
"validate_jsdoc": {
"check_param_names": true,
"require_param_types": true
"requireCurlyBraces": ["if", "else", "for", "while", "do"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return"],
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"requireRightStickedOperators": ["!"],
"requireLeftStickedOperators": [","],
"disallowImplicitTypeConversion": ["string"],
"disallowKeywords": ["with"],
"disallowMulipleLineBreaks": true,
"disallowKeywordsOnNewLine": ["else"],
"requireLineFeedAtFileEnd": true,
"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
}
}

@@ -0,22 +1,30 @@

Version 1.0.0:
* Camel-case configuration options.
* Option `requireAlignedObjectValues`.
* Option `requireSpaceAfterObjectKeys`.
* JSDoc for core functions and classes.
* Fix error position for disallowSpacesInsideObjectBrackets and disallowSpacesInsideArrayBrackets.
Version 0.0.12:
* Fix in `disallow_space_after_object_keys` location reporting.
* Fix in `disallowSpaceAfterObjectKeys` location reporting.
Version 0.0.11:
* Option `disallow_space_after_object_keys`.
* Option `disallow_spaces_inside_array_brackets`.
* Option `disallowSpaceAfterObjectKeys`.
* Option `disallowSpacesInsideArrayBrackets`.
* Do not automatically exclude hidden files.
Version 0.0.10:
* Fix in `disallow_quoted_keys_in_objects`.
* Fix in `disallowQuotedKeysInObjects`.
Version 0.0.9:
* Fix in `disallow_quoted_keys_in_objects`.
* Fix in `disallowQuotedKeysInObjects`.
Version 0.0.8:
* Fix in `require_spaces_inside_object_brackets`.
* Option `disallow_quoted_keys_in_objects`.
* Fix in `requireSpacesInsideObjectBrackets`.
* Option `disallowQuotedKeysInObjects`.
Version 0.0.7:
* Option 'require_spaces_inside_object_brackets'.
* Option 'disallow_spaces_inside_object_brackets'.
* Option 'requireSpacesInsideObjectBrackets'.
* Option 'disallowSpacesInsideObjectBrackets'.

@@ -31,7 +39,7 @@ Version 0.0.6:

Version 0.0.4:
* Option 'disallow_yoda_conditions'.
* Option 'require_multiple_var_decl'.
* Option 'disallowYodaConditions'.
* Option 'requireMultipleVarDecl'.
Version 0.0.3:
* Option 'exclude_files', which accepts patterns.
* Option 'excludeFiles', which accepts patterns.

@@ -38,0 +46,0 @@ Version 0.0.2:

@@ -8,2 +8,7 @@ var esprima = require('esprima');

/**
* Starts Code Style checking process.
*
* @name Checker
*/
var Checker = function() {

@@ -16,5 +21,14 @@ this._rules = [];

Checker.prototype = {
/**
* Registers single Code Style checking rule.
*
* @param {Rule} rule
*/
registerRule: function(rule) {
this._rules.push(rule);
},
/**
* Registers built-in Code Style cheking rules.
*/
registerDefaultRules: function() {

@@ -41,6 +55,15 @@ this.registerRule(new (require('./rules/require-curly-braces'))());

this.registerRule(new (require('./rules/disallow-spaces-inside-array-brackets'))());
this.registerRule(new (require('./rules/require-space-after-object-keys'))());
this.registerRule(new (require('./rules/disallow-space-after-object-keys'))());
this.registerRule(new (require('./rules/disallow-quoted-keys-in-objects'))());
this.registerRule(new (require('./rules/require-aligned-object-values'))());
},
/**
* Loads configuration from JS Object. Activates and configures required rules.
*
* @param {Object} config
*/
configure: function(config) {
this.throwNonCamelCaseErrorIfNeeded(config);
var activeRules = this._activeRules;

@@ -54,6 +77,54 @@ this._rules.forEach(function(rule) {

});
this._excludes = (config.exclude_files || []).map(function(pattern) {
this._excludes = (config.excludeFiles || []).map(function(pattern) {
return new minimatch.Minimatch(pattern);
});
},
/**
* Throws error for non camel-case options.
*
* @param {Object} config
*/
throwNonCamelCaseErrorIfNeeded: function(config) {
function symbolToUpperCase(s, symbol) {
return symbol.toUpperCase();
}
function fixConfig(originConfig) {
var result = {};
for (var i in originConfig) {
if (originConfig.hasOwnProperty(i)) {
var camelCaseName = i.replace(/_([a-zA-Z])/g, symbolToUpperCase);
var value = originConfig[i];
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
value = fixConfig(value);
}
result[camelCaseName] = value;
}
}
return result;
}
var hasOldStyleConfigParams = false;
for (var i in config) {
if (config.hasOwnProperty(i)) {
if (i.indexOf('_') !== -1) {
hasOldStyleConfigParams = true;
break;
}
}
}
if (hasOldStyleConfigParams) {
throw new Error('JSCS now accepts configuration options in camel case. Sorry for inconvenience. ' +
'On the bright side, we tried to convert your jscs config to camel case.\n' +
'----------------------------------------\n' +
JSON.stringify(fixConfig(config), null, 4) +
'\n----------------------------------------\n');
}
},
/**
* Checks file provided with a string.
* @param {String} str
* @param {String} filename
* @returns {Errors}
*/
checkString: function(str, filename) {

@@ -74,2 +145,9 @@ var tree;

},
/**
* Checks single file.
*
* @param {String} path
* @returns {Promise * Errors}
*/
checkFile: function(path) {

@@ -85,2 +163,9 @@ var _this = this;

},
/**
* Checks directory recursively.
*
* @param {String} path
* @returns {Promise * Error[]}
*/
checkDirectory: function(path) {

@@ -115,2 +200,9 @@ var _this = this;

},
/**
* Checks directory or file.
*
* @param {String} path
* @returns {Error[]}
*/
checkPath: function(path) {

@@ -139,2 +231,8 @@ path = path.replace(/\/$/, '');

},
/**
* Returns true if specified path is not in exluded list.
*
* @returns {Boolean}
*/
_shouldProcess: function(path) {

@@ -152,5 +250,2 @@ path = path.replace(/^\.\//, '');

function filterHiddenFiles(filename) {
return filename.charAt(0) !== '.';
}
module.exports = Checker;

@@ -0,1 +1,8 @@

/**
* Command line implementation for JSCS.
*
* Common usage case is:
*
* ./node_modules/.bin/jscs file1 dir1 file2 dir2
*/
var fs = require('fs');

@@ -16,6 +23,17 @@ var program = require('commander');

/**
* Trying to load config.
* Custom config path can be specified using '-c' option.
*/
if (fs.existsSync(configPath)) {
/**
* Using default rule set.
* There is no support for custom rule sets yet.
*/
checker.registerDefaultRules();
checker.configure(require(configPath));
if (program.args.length > 0) {
/**
* Processing specified files and dirs.
*/
Vow.all(program.args.map(function(path) {

@@ -26,4 +44,10 @@ return checker.checkPath(path);

var errorCount = 0;
/**
* Formatting every error set.
*/
errorsCollection.forEach(function (errors) {
if (!errors.isEmpty()) {
/**
* Formatting every single error.
*/
errors.getErrorList().forEach(function(error) {

@@ -38,2 +62,5 @@ errorCount++;

if (errorCount) {
/**
* Printing summary.
*/
console.log('\n' + errorCount + ' code style errors found.');

@@ -46,2 +73,5 @@ process.exit(1);

console.log(e.stack);
/**
* Quitting with 1 error code.
*/
process.exit(1);

@@ -55,4 +85,7 @@ });

console.log('Configuration file ' + configPath + ' was not found.');
/**
* Quitting with 1 error code.
*/
process.exit(1);
}
var colors = require('colors');
/**
* Set of errors for specified file.
*
* @name Errors
*/
var Errors = function(file) {

@@ -9,3 +14,9 @@ this._errorList = [];

Errors.prototype = {
/**
* Adds style error to the list
*
* @param {String} message
* @param {Number|Object} line
* @param {Number} [column]
*/
add: function(message, line, column) {

@@ -23,2 +34,7 @@ if (typeof line === 'object') {

/**
* Returns style error list.
*
* @returns {Object[]}
*/
getErrorList: function() {

@@ -28,2 +44,7 @@ return this._errorList;

/**
* Returns filename of file this error list is for.
*
* @returns {String}
*/
getFilename: function() {

@@ -33,2 +54,7 @@ return this._file.getFilename();

/**
* Returns true if no errors are added.
*
* @returns {Boolean}
*/
isEmpty: function() {

@@ -38,2 +64,7 @@ return this._errorList.length === 0;

/**
* Returns amount of errors added by the rules.
*
* @returns {Number}
*/
getErrorCount: function () {

@@ -43,2 +74,9 @@ return this._errorList.length;

/**
* Formats error for futher output.
*
* @param {Object} error
* @param {Boolean} colorize
* @returns {String}
*/
explainError: function(error, colorize) {

@@ -68,2 +106,10 @@ var lineNumber = error.line - 1;

/**
* Formats error message header.
*
* @param {String} message
* @param {String} filename
* @param {Boolean} colorize
* @returns {String}
*/
function formatErrorMessage(message, filename, colorize) {

@@ -75,2 +121,9 @@ return (colorize ? colors.bold(message) : message) +

/**
* Simple util for prepending spaces to the string until it fits specified size.
*
* @param {String} s
* @param {Number} len
* @returns {String}
*/
function prependSpaces(s, len) {

@@ -83,2 +136,10 @@ while (s.length < len) {

/**
* Renders single line of code in style error formatted output.
*
* @param {Number} n line number
* @param {String} line
* @param {Boolean} colorize
* @returns {String}
*/
function renderLine(n, line, colorize) {

@@ -89,2 +150,10 @@ var lineNumber = prependSpaces(n.toString(), 5) + ' |';

/**
* Renders pointer:
* ---------------^
*
* @param {Number} column
* @param {Boolean} colorize
* @returns {String}
*/
function renderPointer(column, colorize) {

@@ -91,0 +160,0 @@ var res = (new Array(column + 9)).join('-') + '^';

var treeIterator = require('./tree-iterator');
/**
* File representation for JSCS.
*
* @name JsFile
*/
var JsFile = function(filename, source, tree) {

@@ -23,2 +28,5 @@ this._filename = filename;

JsFile.prototype = {
/**
* Builds token index by starting pos for futher navigation.
*/
_buildTokenIndex: function() {

@@ -32,2 +40,7 @@ var tokens = this._tree.tokens;

},
/**
* Returns token position using range start from the index.
*
* @returns {Object}
*/
getTokenPosByRangeStart: function(start) {

@@ -39,5 +52,17 @@ if (!this._tokenIndex) {

},
/**
* Iterates through the token tree using tree iterator.
* Calls passed function for every token.
*
* @param {Function} cb
*/
iterate: function(cb) {
return treeIterator.iterate(this._tree, cb);
},
/**
* Returns tokens by type(s) from earlier built index.
*
* @param {String|String[]} type
* @returns {Object[]}
*/
getNodesByType: function(type) {

@@ -57,20 +82,55 @@ if (typeof type === 'string') {

},
/**
* Iterates tokens by type(s) from earlier built index.
* Calls passed function for every matched token.
*
* @param {String|String[]} type
* @param {Function} cb
*/
iterateNodesByType: function(type, cb) {
return this.getNodesByType(type).forEach(cb);
},
/**
* Returns string representing contents of the file.
*
* @returns {String}
*/
getSource: function() {
return this._source;
},
/**
* Returns token tree, built using esprima.
*
* @returns {Object}
*/
getTree: function() {
return this._tree;
},
/**
* Returns token list, built using esprima.
*
* @returns {Object[]}
*/
getTokens: function() {
return this._tree.tokens;
},
/**
* Returns comment token list, built using esprima.
*/
getComments: function() {
return this._tree.comments;
},
/**
* Returns source filename for this object representation.
*
* @returns {String}
*/
getFilename: function() {
return this._filename;
},
/**
* Returns array of source lines for the file.
*
* @returns {String[]}
*/
getLines: function() {

@@ -77,0 +137,0 @@ return this._lines;

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(types) {
assert(Array.isArray(types), 'disallow_implicit_type_conversion option requires array value');
assert(Array.isArray(types), 'disallowImplicitTypeConversion option requires array value');
this._typeIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = types.length; i < l; i++) {

getOptionName: function () {
return 'disallow_implicit_type_conversion';
return 'disallowImplicitTypeConversion';
},

@@ -20,0 +20,0 @@

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(keywords) {
assert(Array.isArray(keywords), 'disallow_keywords_on_new_line option requires array value');
assert(Array.isArray(keywords), 'disallowKeywordsOnNewLine option requires array value');
this._keywordIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = keywords.length; i < l; i++) {

getOptionName: function () {
return 'disallow_keywords_on_new_line';
return 'disallowKeywordsOnNewLine';
},

@@ -20,0 +20,0 @@

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(keywords) {
assert(Array.isArray(keywords), 'disallow_keywords option requires array value');
assert(Array.isArray(keywords), 'disallowKeywords option requires array value');
this._keywordIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = keywords.length; i < l; i++) {

getOptionName: function () {
return 'disallow_keywords';
return 'disallowKeywords';
},

@@ -20,0 +20,0 @@

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(operators) {
assert(Array.isArray(operators), 'disallow_left_sticked_operators option requires array value');
assert(Array.isArray(operators), 'disallowLeftStickedOperators option requires array value');
this._operatorIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = operators.length; i < l; i++) {

getOptionName: function () {
return 'disallow_left_sticked_operators';
return 'disallowLeftStickedOperators';
},

@@ -20,0 +20,0 @@

@@ -10,7 +10,7 @@ var assert = require('assert');

typeof disallowMultipleLineBreaks === 'boolean',
'disallow_multiple_line_breaks option requires boolean value'
'disallowMultipleLineBreaks option requires boolean value'
);
assert(
disallowMultipleLineBreaks === true,
'disallow_multiple_line_breaks option requires true value or should be removed'
'disallowMultipleLineBreaks option requires true value or should be removed'
);

@@ -20,3 +20,3 @@ },

getOptionName: function () {
return 'disallow_multiple_line_breaks';
return 'disallowMultipleLineBreaks';
},

@@ -23,0 +23,0 @@

@@ -10,7 +10,7 @@ var assert = require('assert');

typeof disallowMultipleVarDecl === 'boolean',
'disallow_multiple_var_decl option requires boolean value'
'disallowMultipleVarDecl option requires boolean value'
);
assert(
disallowMultipleVarDecl === true,
'disallow_multiple_var_decl option requires true value or should be removed'
'disallowMultipleVarDecl option requires true value or should be removed'
);

@@ -20,3 +20,3 @@ },

getOptionName: function () {
return 'disallow_multiple_var_decl';
return 'disallowMultipleVarDecl';
},

@@ -23,0 +23,0 @@

var assert = require('assert');
var OPTION_NAME = 'disallow_quoted_keys_in_objects';
var OPTION_NAME = 'disallowQuotedKeysInObjects';

@@ -5,0 +5,0 @@ module.exports = function() {};

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(operators) {
assert(Array.isArray(operators), 'disallow_right_sticked_operators option requires array value');
assert(Array.isArray(operators), 'disallowRightStickedOperators option requires array value');
this._operatorIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = operators.length; i < l; i++) {

getOptionName: function () {
return 'disallow_right_sticked_operators';
return 'disallowRightStickedOperators';
},

@@ -20,0 +20,0 @@

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(keywords) {
assert(Array.isArray(keywords), 'disallow_space_after_keywords option requires array value');
assert(Array.isArray(keywords), 'disallowSpaceAfterKeywords option requires array value');
this._keywordIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = keywords.length; i < l; i++) {

getOptionName: function () {
return 'disallow_space_after_keywords';
return 'disallowSpaceAfterKeywords';
},

@@ -20,0 +20,0 @@

@@ -19,3 +19,3 @@ var assert = require('assert');

getOptionName: function() {
return 'disallow_space_after_object_keys';
return 'disallowSpaceAfterObjectKeys';
},

@@ -22,0 +22,0 @@

@@ -19,3 +19,3 @@ var assert = require('assert');

getOptionName: function() {
return 'disallow_spaces_inside_array_brackets';
return 'disallowSpacesInsideArrayBrackets';
},

@@ -34,3 +34,3 @@

) {
errors.add('Illegal space after opening square brace', nextToken.loc.start);
errors.add('Illegal space after opening square brace', openingBracket.loc.end);
}

@@ -45,3 +45,3 @@

) {
errors.add('Illegal space before closing square brace', prevToken.loc.start);
errors.add('Illegal space before closing square brace', prevToken.loc.end);
}

@@ -48,0 +48,0 @@ });

@@ -10,7 +10,7 @@ var assert = require('assert');

typeof disallowSpacesInsideObjectBrackets === 'boolean',
'disallow_spaces_inside_object_brackets option requires boolean value'
'disallowSpacesInsideObjectBrackets option requires boolean value'
);
assert(
disallowSpacesInsideObjectBrackets === true,
'disallow_spaces_inside_object_brackets option requires true value or should be removed'
'disallowSpacesInsideObjectBrackets option requires true value or should be removed'
);

@@ -20,3 +20,3 @@ },

getOptionName: function() {
return 'disallow_spaces_inside_object_brackets';
return 'disallowSpacesInsideObjectBrackets';
},

@@ -35,3 +35,3 @@

) {
errors.add('Illegal space after opening curly brace', nextToken.loc.start);
errors.add('Illegal space after opening curly brace', openingBracket.loc.end);
}

@@ -46,3 +46,3 @@

) {
errors.add('Illegal space before closing curly brace', prevToken.loc.start);
errors.add('Illegal space before closing curly brace', prevToken.loc.end);
}

@@ -49,0 +49,0 @@ });

@@ -10,7 +10,7 @@ var assert = require('assert');

typeof disallowYodaConditions === 'boolean',
'disallow_multiple_var_decl option requires boolean value'
'disallowMultipleVarDecl option requires boolean value'
);
assert(
disallowYodaConditions === true,
'disallow_multiple_var_decl option requires true value or should be removed'
'disallowMultipleVarDecl option requires true value or should be removed'
);

@@ -30,3 +30,3 @@ this._operatorIndex = {

getOptionName: function () {
return 'disallow_yoda_conditions';
return 'disallowYodaConditions';
},

@@ -33,0 +33,0 @@

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(statementTypes) {
assert(Array.isArray(statementTypes), 'force_curly_braces option requires array value');
assert(Array.isArray(statementTypes), 'requireCurlyBraces option requires array value');
this._typeIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = statementTypes.length; i < l; i++) {

getOptionName: function () {
return 'require_curly_braces';
return 'requireCurlyBraces';
},

@@ -20,0 +20,0 @@

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(keywords) {
assert(Array.isArray(keywords), 'require_keywords_on_new_line option requires array value');
assert(Array.isArray(keywords), 'requireKeywordsOnNewLine option requires array value');
this._keywordIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = keywords.length; i < l; i++) {

getOptionName: function () {
return 'require_keywords_on_new_line';
return 'requireKeywordsOnNewLine';
},

@@ -20,0 +20,0 @@

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(operators) {
assert(Array.isArray(operators), 'require_left_sticked_operators option requires array value');
assert(Array.isArray(operators), 'requireLeftStickedOperators option requires array value');
this._operatorIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = operators.length; i < l; i++) {

getOptionName: function () {
return 'require_left_sticked_operators';
return 'requireLeftStickedOperators';
},

@@ -20,0 +20,0 @@

@@ -10,7 +10,7 @@ var assert = require('assert');

typeof requireLineFeedAtFileEnd === 'boolean',
'require_line_feed_at_file_end option requires boolean value'
'requireLineFeedAtFileEnd option requires boolean value'
);
assert(
requireLineFeedAtFileEnd === true,
'require_line_feed_at_file_end option requires true value or should be removed'
'requireLineFeedAtFileEnd option requires true value or should be removed'
);

@@ -20,3 +20,3 @@ },

getOptionName: function () {
return 'require_line_feed_at_file_end';
return 'requireLineFeedAtFileEnd';
},

@@ -23,0 +23,0 @@

@@ -9,7 +9,7 @@ var assert = require('assert');

typeof requireMultipleVarDecl === 'boolean',
'require_multiple_var_decl option requires boolean value'
'requireMultipleVarDecl option requires boolean value'
);
assert(
requireMultipleVarDecl === true,
'require_multiple_var_decl option requires true value or should be removed'
'requireMultipleVarDecl option requires true value or should be removed'
);

@@ -19,3 +19,3 @@ },

getOptionName: function () {
return 'require_multiple_var_decl';
return 'requireMultipleVarDecl';
},

@@ -22,0 +22,0 @@

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(operators) {
assert(Array.isArray(operators), 'require_right_sticked_operators option requires array value');
assert(Array.isArray(operators), 'requireRightStickedOperators option requires array value');
this._operatorIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = operators.length; i < l; i++) {

getOptionName: function () {
return 'require_right_sticked_operators';
return 'requireRightStickedOperators';
},

@@ -20,0 +20,0 @@

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(keywords) {
assert(Array.isArray(keywords), 'require_space_after_keywords option requires array value');
assert(Array.isArray(keywords), 'requireSpaceAfterKeywords option requires array value');
this._keywordIndex = {};

@@ -17,3 +17,3 @@ for (var i = 0, l = keywords.length; i < l; i++) {

getOptionName: function () {
return 'require_space_after_keywords';
return 'requireSpaceAfterKeywords';
},

@@ -20,0 +20,0 @@

@@ -10,3 +10,3 @@ var assert = require('assert');

'all': true,
'all_but_nested': true
'allButNested': true
};

@@ -16,3 +16,3 @@ assert(

modes[mode],
'require_spaces_inside_object_brackets option requires string value \'all\' or \'all_but_nested\''
'requireSpacesInsideObjectBrackets option requires string value \'all\' or \'allButNested\''
);

@@ -23,3 +23,3 @@ this._mode = mode;

getOptionName: function() {
return 'require_spaces_inside_object_brackets';
return 'requireSpacesInsideObjectBrackets';
},

@@ -49,3 +49,3 @@

if (closingBracket.range[0] === prevToken.range[1]) {
if (!(mode === 'all_but_nested' &&
if (!(mode === 'allButNested' &&
prevToken.type === 'Punctuator' &&

@@ -52,0 +52,0 @@ prevToken.value === '}'

@@ -8,3 +8,3 @@ var assert = require('assert');

configure: function(options) {
assert(typeof options === 'object', 'validate_jsdoc option requires object value');
assert(typeof options === 'object', 'validateJSDoc option requires object value');
this._options = options;

@@ -14,3 +14,3 @@ },

getOptionName: function () {
return 'validate_jsdoc';
return 'validateJSDoc';
},

@@ -27,3 +27,3 @@

var paramIndex = 0;
if (options.check_param_names || options.check_redundant_params || options.require_param_types) {
if (options.checkParamNames || options.checkRedundantParams || options.requireParamTypes) {
for (var i = 0, l = jsDocLines.length; i < l; i++) {

@@ -38,3 +38,3 @@ var line = jsDocLines[i].trim();

var jsDocParamName = match[2];
if (options.require_param_types && !jsDocParamType) {
if (options.requireParamTypes && !jsDocParamType) {
errors.add(

@@ -50,3 +50,3 @@ 'Missing JSDoc @param type',

if (jsDocParamName !== param.name) {
if (options.check_param_names) {
if (options.checkParamNames) {
errors.add(

@@ -60,3 +60,3 @@ 'Invalid JSDoc @param argument name',

} else {
if (options.check_redundant_params) {
if (options.checkRedundantParams) {
errors.add(

@@ -63,0 +63,0 @@ 'Redundant JSDoc @param',

@@ -5,4 +5,4 @@ {

"name" : "jscs",
"version" : "0.0.12",
"repository" : "https://github.com/mdevils/jscs",
"version" : "1.0.0",
"repository" : "https://github.com/mdevils/node-jscs",
"contributors" : [

@@ -12,2 +12,8 @@ {

"email": "mdevils@yandex.ru"
},
{
"name": "Ikonnikov Konstantin"
},
{
"name": "Igor Agarlev"
}

@@ -14,0 +20,0 @@ ],

@@ -34,3 +34,3 @@ node-jscs [![Build Status](https://travis-ci.org/mdevils/node-jscs.png?branch=master)](https://travis-ci.org/mdevils/node-jscs)

/*
Option: require_curly_braces
Option: requireCurlyBraces
Requires curly braces after statements.

@@ -48,6 +48,6 @@

*/
"require_curly_braces": ["if", "else", "for", "while", "do"],
"requireCurlyBraces": ["if", "else", "for", "while", "do"],
/*
Option: require_space_after_keywords
Option: requireSpaceAfterKeywords
Requires space after keyword.

@@ -65,6 +65,6 @@

*/
"require_space_after_keywords": ["if", "else", "for", "while", "do", "switch", "return"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return"],
/*
Option: disallow_space_after_keywords
Option: disallowSpaceAfterKeywords
Disallows space after keyword.

@@ -78,6 +78,6 @@

*/
"disallow_space_after_keywords": ["if", "else", "for", "while", "do", "switch"],
"disallowSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch"],
/*
Option: disallow_multiple_var_decl
Option: disallowMultipleVarDecl
Disallows multiple var declaration.

@@ -95,6 +95,6 @@

*/
"disallow_multiple_var_decl": true,
"disallowMultipleVarDecl": true,
/*
Option: require_multiple_var_decl
Option: requireMultipleVarDecl
Requires multiple var declaration.

@@ -112,6 +112,6 @@

*/
"require_multiple_var_decl": true,
"requireMultipleVarDecl": true,
/*
Option: disallow_spaces_inside_object_brackets
Option: disallowSpacesInsideObjectBrackets
Disallows space after opening object curly brace and before closing.

@@ -127,6 +127,6 @@

*/
"disallow_spaces_inside_object_brackets": true,
"disallowSpacesInsideObjectBrackets": true,
/*
Option: disallow_spaces_inside_array_brackets
Option: disallowSpacesInsideArrayBrackets
Disallows space after opening array square brace and before closing.

@@ -142,8 +142,8 @@

*/
"disallow_spaces_inside_array_brackets": true,
"disallowSpacesInsideArrayBrackets": true,
/*
Option: require_spaces_inside_object_brackets
Possible values: "all" for strict mode, "all_but_nested" ignores closing brackets in a row.
Disallows space after opening object curly brace and before closing.
Option: requireSpacesInsideObjectBrackets
Possible values: "all" for strict mode, "allButNested" ignores closing brackets in a row.
Requires space after opening object curly brace and before closing.

@@ -154,3 +154,3 @@ Valid example for mode "all":

Valid example for mode "all_but_nested":
Valid example for mode "allButNested":

@@ -163,6 +163,6 @@ var x = { a: { b: 1 }};

*/
"require_spaces_inside_object_brackets": "all",
"requireSpacesInsideObjectBrackets": "all",
/*
Option: disallow_quoted_keys_in_objects
Option: disallowQuotedKeysInObjects
Disallows quoted keys in object if possible.

@@ -178,6 +178,6 @@

*/
"disallow_quoted_keys_in_objects": true,
"disallowQuotedKeysInObjects": true,
/*
Option: disallow_space_after_object_keys
Option: disallowSpaceAfterObjectKeys
Disallows space after object keys.

@@ -193,6 +193,46 @@

*/
"disallow_space_after_object_keys": true,
"disallowSpaceAfterObjectKeys": true,
/*
Option: disallow_left_sticked_operators
Option: requireSpaceAfterObjectKeys
Requires space after object keys.
Valid example:
var x = {a : 1};
Invalid example:
var x = {a: 1};
*/
"requireSpaceAfterObjectKeys": true,
/*
Option: requireAlignedObjectValues
Possible values:
"all" for strict mode,
"skipWithFunction" ignores objects if one of the property values is a function expression,
"skipWithLineBreak" ignores objects if there are line breaks between properties
Requires proper alignment in object literals.
Valid example:
var x = {
a : 1,
bcd : 2,
ef : 'str'
};
Invalid example:
var x = {
a : 1,
bcd : 2,
ef : 'str'
};
*/
"requireAlignedObjectValues": "all",
/*
Option: disallowLeftStickedOperators
Disallows sticking operators to the left.

@@ -208,7 +248,7 @@

*/
"disallow_left_sticked_operators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
/*
Option: require_right_sticked_operators
Requires sticking operators to the left.
Option: requireRightStickedOperators
Requires sticking operators to the right.

@@ -223,6 +263,6 @@ Valid example:

*/
"require_right_sticked_operators": ["!"],
"requireRightStickedOperators": ["!"],
/*
Option: disallow_right_sticked_operators
Option: disallowRightStickedOperators
Disallows sticking operators to the right.

@@ -238,7 +278,7 @@

*/
"disallow_right_sticked_operators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
/*
Option: disallow_right_sticked_operators
Requires sticking operators to the right.
Option: requireLeftStickedOperators
Requires sticking operators to the left.

@@ -251,8 +291,8 @@ Valid example:

x = [1,2];
x = [1 , 2];
*/
"require_left_sticked_operators": [","],
"requireLeftStickedOperators": [","],
/*
Option: disallow_implicit_type_conversion
Option: disallowImplicitTypeConversion
Disallows implicit type conversion.

@@ -274,6 +314,6 @@

*/
"disallow_implicit_type_conversion": ["numeric", "boolean", "binary", "string"],
"disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"],
/*
Option: disallow_keywords
Option: disallowKeywords
Disallows usage of specified keywords.

@@ -287,6 +327,6 @@

*/
"disallow_keywords": ["with"],
"disallowKeywords": ["with"],
/*
Option: disallow_muliple_line_breaks
Option: disallowMultipleLineBreaks
Disallows multiple blank lines in a row.

@@ -301,6 +341,6 @@

*/
"disallow_muliple_line_breaks": true,
"disallowMultipleLineBreaks": true,
/*
Option: disallow_keywords_on_new_line
Option: disallowKeywordsOnNewLine
Disallows placing keywords on a new line.

@@ -325,6 +365,6 @@

*/
"disallow_keywords_on_new_line": ["else"],
"disallowKeywordsOnNewLine": ["else"],
/*
Option: require_keywords_on_new_line
Option: requireKeywordsOnNewLine
Requires placing keywords on a new line.

@@ -349,35 +389,35 @@

*/
"require_keywords_on_new_line": ["else"],
"requireKeywordsOnNewLine": ["else"],
/*
Option: require_line_feed_at_file_end
Option: requireLineFeedAtFileEnd
Requires placing line feed at file end.
*/
"require_line_feed_at_file_end": true,
"requireLineFeedAtFileEnd": true,
/*
Option: validate_jsdoc
Option: validateJSDoc
Enables jsdoc validation.
Option: validate_jsdoc.check_param_names
Option: validateJSDoc.checkParamNames
Ensures param names in jsdoc and in function declaration are equal.
Option: validate_jsdoc.require_param_types
Option: validateJSDoc.requireParamTypes
Ensures params in jsdoc contains type.
Option: validate_jsdoc.check_redundant_params
Option: validateJSDoc.checkRedundantParams
Reports redundant params in jsdoc.
*/
"validate_jsdoc": {
"check_param_names": true,
"check_redundant_params": true,
"require_param_types": true
"validateJSDoc": {
"checkParamNames": true,
"checkRedundantParams": true,
"requireParamTypes": true
},
/*
Option: exclude_files
Option: excludeFiles
Disables style checking for specified paths.
*/
"exclude_files": ["node_modules/**"]
"excludeFiles": ["node_modules/**"]
}

@@ -11,21 +11,21 @@ var Checker = require('../lib/checker');

it('should report implicit numeric conversion', function() {
checker.configure({ disallow_implicit_type_conversion: ['numeric'] });
checker.configure({ disallowImplicitTypeConversion: ['numeric'] });
assert(checker.checkString('var x = +y;').getErrorCount() === 1);
});
it('should report implicit binary conversion', function() {
checker.configure({ disallow_implicit_type_conversion: ['binary'] });
checker.configure({ disallowImplicitTypeConversion: ['binary'] });
assert(checker.checkString('var x = ~y;').getErrorCount() === 1);
});
it('should report implicit boolean conversion', function() {
checker.configure({ disallow_implicit_type_conversion: ['boolean'] });
checker.configure({ disallowImplicitTypeConversion: ['boolean'] });
assert(checker.checkString('var x = !!y;').getErrorCount() === 1);
});
it('should report implicit string conversion', function() {
checker.configure({ disallow_implicit_type_conversion: ['string'] });
checker.configure({ disallowImplicitTypeConversion: ['string'] });
assert(checker.checkString('var x = y + \'\';').getErrorCount() === 1);
});
it('should not report implicit numeric conversion', function() {
checker.configure({ disallow_implicit_type_conversion: ['numeric'] });
checker.configure({ disallowImplicitTypeConversion: ['numeric'] });
assert(checker.checkString('var x = -y;').isEmpty());
});
});

@@ -11,3 +11,3 @@ var Checker = require('../lib/checker');

it('should report illegal keyword placement', function() {
checker.configure({ disallow_keywords_on_new_line: ['else'] });
checker.configure({ disallowKeywordsOnNewLine: ['else'] });
assert(

@@ -25,3 +25,3 @@ checker.checkString(

it('should not report legal keyword placement', function() {
checker.configure({ disallow_keywords_on_new_line: ['else'] });
checker.configure({ disallowKeywordsOnNewLine: ['else'] });
assert(

@@ -28,0 +28,0 @@ checker.checkString(

@@ -11,9 +11,9 @@ var Checker = require('../lib/checker');

it('should report illegal keyword', function() {
checker.configure({ disallow_keywords: ['with'] });
checker.configure({ disallowKeywords: ['with'] });
assert(checker.checkString('with (x) { y++; }').getErrorCount() === 1);
});
it('should not report legal keywords', function() {
checker.configure({ disallow_keywords: ['with'] });
checker.configure({ disallowKeywords: ['with'] });
assert(checker.checkString('if(x) { x++; }').isEmpty());
});
});

@@ -11,9 +11,9 @@ var Checker = require('../lib/checker');

it('should report sticky operator', function() {
checker.configure({ disallow_left_sticked_operators: ['?'] });
checker.configure({ disallowLeftStickedOperators: ['?'] });
assert(checker.checkString('var x = y? z : w;').getErrorCount() === 1);
});
it('should not report separated operator', function() {
checker.configure({ disallow_left_sticked_operators: ['?'] });
checker.configure({ disallowLeftStickedOperators: ['?'] });
assert(checker.checkString('var x = y ? z : w;').isEmpty());
});
});

@@ -11,9 +11,9 @@ var Checker = require('../lib/checker');

it('should report multiple line break', function() {
checker.configure({ disallow_multiple_line_breaks: true });
checker.configure({ disallowMultipleLineBreaks: true });
assert(checker.checkString('x = 1;\n\n\ny = 2;').getErrorCount() === 1);
});
it('should not report single line break', function() {
checker.configure({ disallow_multiple_line_breaks: true });
checker.configure({ disallowMultipleLineBreaks: true });
assert(checker.checkString('x = 1;\n\ny = 2').isEmpty());
});
});

@@ -11,13 +11,13 @@ var Checker = require('../lib/checker');

it('should report multiple var decl', function() {
checker.configure({ disallow_multiple_var_decl: true });
checker.configure({ disallowMultipleVarDecl: true });
assert(checker.checkString('var x, y;').getErrorCount() === 1);
});
it('should not report single var decl', function() {
checker.configure({ disallow_multiple_var_decl: true });
checker.configure({ disallowMultipleVarDecl: true });
assert(checker.checkString('var x;').isEmpty());
});
it('should not report separated var decl', function() {
checker.configure({ disallow_multiple_var_decl: true });
checker.configure({ disallowMultipleVarDecl: true });
assert(checker.checkString('var x; var y;').isEmpty());
});
});

@@ -9,3 +9,3 @@ var Checker = require('../lib/checker');

checker.registerDefaultRules();
checker.configure({ disallow_quoted_keys_in_objects: true });
checker.configure({ disallowQuotedKeysInObjects: true });
});

@@ -12,0 +12,0 @@

@@ -11,9 +11,9 @@ var Checker = require('../lib/checker');

it('should report sticky operator', function() {
checker.configure({ disallow_right_sticked_operators: ['!'] });
checker.configure({ disallowRightStickedOperators: ['!'] });
assert(checker.checkString('var x = !y;').getErrorCount() === 1);
});
it('should not report separated operator', function() {
checker.configure({ disallow_right_sticked_operators: ['!'] });
checker.configure({ disallowRightStickedOperators: ['!'] });
assert(checker.checkString('var x = ! y;').isEmpty());
});
});

@@ -11,9 +11,9 @@ var Checker = require('../lib/checker');

it('should report illegal space after keyword', function() {
checker.configure({ disallow_space_after_keywords: ['if'] });
checker.configure({ disallowSpaceAfterKeywords: ['if'] });
assert(checker.checkString('if (x) { x++; }').getErrorCount() === 1);
});
it('should not report space after keyword', function() {
checker.configure({ disallow_space_after_keywords: ['if'] });
checker.configure({ disallowSpaceAfterKeywords: ['if'] });
assert(checker.checkString('if(x) { x++; }').isEmpty());
});
});

@@ -10,3 +10,3 @@ var Checker = require('../lib/checker');

checker.registerDefaultRules();
checker.configure({ disallow_space_after_object_keys: true });
checker.configure({ disallowSpaceAfterObjectKeys: true });
});

@@ -13,0 +13,0 @@

@@ -10,3 +10,3 @@ var Checker = require('../lib/checker');

checker.registerDefaultRules();
checker.configure({ disallow_spaces_inside_array_brackets: true });
checker.configure({ disallowSpacesInsideArrayBrackets: true });
});

@@ -13,0 +13,0 @@

@@ -11,17 +11,17 @@ var Checker = require('../lib/checker');

it('should report illegal space after opening brace', function() {
checker.configure({ disallow_spaces_inside_object_brackets: true });
checker.configure({ disallowSpacesInsideObjectBrackets: true });
assert(checker.checkString('var x = { a: 1};').getErrorCount() === 1);
});
it('should report illegal space before closing brace', function() {
checker.configure({ disallow_spaces_inside_object_brackets: true });
checker.configure({ disallowSpacesInsideObjectBrackets: true });
assert(checker.checkString('var x = {a: 1 };').getErrorCount() === 1);
});
it('should report illegal space in both cases', function() {
checker.configure({ disallow_spaces_inside_object_brackets: true });
checker.configure({ disallowSpacesInsideObjectBrackets: true });
assert(checker.checkString('var x = { a: 1 };').getErrorCount() === 2);
});
it('should not report with no spaces', function() {
checker.configure({ disallow_spaces_inside_object_brackets: true });
checker.configure({ disallowSpacesInsideObjectBrackets: true });
assert(checker.checkString('var x = {a: 1};').isEmpty());
});
});

@@ -11,3 +11,3 @@ var Checker = require('../lib/checker');

it('should report yoda condition for strict equality', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -22,3 +22,3 @@ checker.checkString(

it('should report yoda condition for unequality', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -33,3 +33,3 @@ checker.checkString(

it('should report yoda condition for strict unequality', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -44,3 +44,3 @@ checker.checkString(

it('should report yoda condition for gt', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -55,3 +55,3 @@ checker.checkString(

it('should report yoda condition for gte', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -66,3 +66,3 @@ checker.checkString(

it('should report yoda condition for lt', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -77,3 +77,3 @@ checker.checkString(

it('should report yoda condition for lte', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -88,3 +88,3 @@ checker.checkString(

it('should report yoda condition for numeric', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -99,3 +99,3 @@ checker.checkString(

it('should report yoda condition for boolean', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -110,3 +110,3 @@ checker.checkString(

it('should report yoda condition for string', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -121,3 +121,3 @@ checker.checkString(

it('should report yoda condition for null', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -132,3 +132,3 @@ checker.checkString(

it('should report yoda condition for undefined', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -143,3 +143,3 @@ checker.checkString(

it('should not report normal condition', function() {
checker.configure({ disallow_yoda_conditions: true });
checker.configure({ disallowYodaConditions: true });
assert(

@@ -146,0 +146,0 @@ checker.checkString(

@@ -11,49 +11,49 @@ var Checker = require('../lib/checker');

it('should report missing `if` braces', function() {
checker.configure({ require_curly_braces: ['if'] });
checker.configure({ requireCurlyBraces: ['if'] });
assert(checker.checkString('if (x) x++;').getErrorCount() === 1);
});
it('should not report `if` with braces', function() {
checker.configure({ require_curly_braces: ['if'] });
checker.configure({ requireCurlyBraces: ['if'] });
assert(checker.checkString('if (x) { x++; }').isEmpty());
});
it('should report missing `else` braces', function() {
checker.configure({ require_curly_braces: ['else'] });
checker.configure({ requireCurlyBraces: ['else'] });
assert(checker.checkString('if (x) x++; else x--;').getErrorCount() === 1);
});
it('should not report `else` with braces', function() {
checker.configure({ require_curly_braces: ['else'] });
checker.configure({ requireCurlyBraces: ['else'] });
assert(checker.checkString('if (x) x++; else { x--; }').isEmpty());
});
it('should report missing `while` braces', function() {
checker.configure({ require_curly_braces: ['while'] });
checker.configure({ requireCurlyBraces: ['while'] });
assert(checker.checkString('while (x) x++;').getErrorCount() === 1);
});
it('should not report `while` with braces', function() {
checker.configure({ require_curly_braces: ['while'] });
checker.configure({ requireCurlyBraces: ['while'] });
assert(checker.checkString('while (x) { x++; }').isEmpty());
});
it('should report missing `for` braces', function() {
checker.configure({ require_curly_braces: ['for'] });
checker.configure({ requireCurlyBraces: ['for'] });
assert(checker.checkString('for (;;) x++;').getErrorCount() === 1);
});
it('should not report `for` with braces', function() {
checker.configure({ require_curly_braces: ['for'] });
checker.configure({ requireCurlyBraces: ['for'] });
assert(checker.checkString('for (;;) { x++; }').isEmpty());
});
it('should report missing `for in` braces', function() {
checker.configure({ require_curly_braces: ['for'] });
checker.configure({ requireCurlyBraces: ['for'] });
assert(checker.checkString('for (i in z) x++;').getErrorCount() === 1);
});
it('should not report `for in` with braces', function() {
checker.configure({ require_curly_braces: ['for'] });
checker.configure({ requireCurlyBraces: ['for'] });
assert(checker.checkString('for (i in z) { x++; }').isEmpty());
});
it('should report missing `do` braces', function() {
checker.configure({ require_curly_braces: ['do'] });
checker.configure({ requireCurlyBraces: ['do'] });
assert(checker.checkString('do x++; while (x);').getErrorCount() === 1);
});
it('should not report `do` with braces', function() {
checker.configure({ require_curly_braces: ['do'] });
checker.configure({ requireCurlyBraces: ['do'] });
assert(checker.checkString('do { x++; } while (x);').isEmpty());
});
});

@@ -11,3 +11,3 @@ var Checker = require('../lib/checker');

it('should report illegal keyword placement', function() {
checker.configure({ require_keywords_on_new_line: ['else'] });
checker.configure({ requireKeywordsOnNewLine: ['else'] });
assert(

@@ -24,3 +24,3 @@ checker.checkString(

it('should not report legal keyword placement', function() {
checker.configure({ require_keywords_on_new_line: ['else'] });
checker.configure({ requireKeywordsOnNewLine: ['else'] });
assert(

@@ -27,0 +27,0 @@ checker.checkString(

@@ -11,9 +11,9 @@ var Checker = require('../lib/checker');

it('should report missing space before operator', function() {
checker.configure({ require_left_sticked_operators: ['?'] });
checker.configure({ requireLeftStickedOperators: ['?'] });
assert(checker.checkString('var x = y ? z : w;').getErrorCount() === 1);
});
it('should not report sticky operator', function() {
checker.configure({ require_left_sticked_operators: ['?'] });
checker.configure({ requireLeftStickedOperators: ['?'] });
assert(checker.checkString('var x = y? z : w;').isEmpty());
});
});

@@ -11,9 +11,9 @@ var Checker = require('../lib/checker');

it('should report no line feed at file end', function() {
checker.configure({ require_line_feed_at_file_end: true });
checker.configure({ requireLineFeedAtFileEnd: true });
assert(checker.checkString('var x;').getErrorCount() === 1);
});
it('should not report existing line feed at file end', function() {
checker.configure({ require_line_feed_at_file_end: true });
checker.configure({ requireLineFeedAtFileEnd: true });
assert(checker.checkString('var x;\n').isEmpty());
});
});

@@ -11,13 +11,13 @@ var Checker = require('../lib/checker');

it('should report consecutive var decl', function() {
checker.configure({ require_multiple_var_decl: true });
checker.configure({ requireMultipleVarDecl: true });
assert(checker.checkString('var x; var y;').getErrorCount() === 1);
});
it('should not report multiple var decl', function() {
checker.configure({ require_multiple_var_decl: true });
checker.configure({ requireMultipleVarDecl: true });
assert(checker.checkString('var x, y;').isEmpty());
});
it('should not report separated var decl', function() {
checker.configure({ require_multiple_var_decl: true });
checker.configure({ requireMultipleVarDecl: true });
assert(checker.checkString('var x; x++; var y;').isEmpty());
});
});

@@ -11,9 +11,9 @@ var Checker = require('../lib/checker');

it('should report missing space after operator', function() {
checker.configure({ require_right_sticked_operators: ['!'] });
checker.configure({ requireRightStickedOperators: ['!'] });
assert(checker.checkString('var x = ! y;').getErrorCount() === 1);
});
it('should not report sticky operator', function() {
checker.configure({ require_right_sticked_operators: ['!'] });
checker.configure({ requireRightStickedOperators: ['!'] });
assert(checker.checkString('var x = !y;').isEmpty());
});
});

@@ -11,13 +11,13 @@ var Checker = require('../lib/checker');

it('should report missing space after keyword', function() {
checker.configure({ require_space_after_keywords: ['if'] });
checker.configure({ requireSpaceAfterKeywords: ['if'] });
assert(checker.checkString('if(x) { x++; }').getErrorCount() === 1);
});
it('should not report space after keyword', function() {
checker.configure({ require_space_after_keywords: ['if'] });
checker.configure({ requireSpaceAfterKeywords: ['if'] });
assert(checker.checkString('if (x) { x++; }').isEmpty());
});
it('should not report semicolon after keyword', function() {
checker.configure({ require_space_after_keywords: ['return'] });
checker.configure({ requireSpaceAfterKeywords: ['return'] });
assert(checker.checkString('var x = function () { return; }').isEmpty());
});
});

@@ -11,45 +11,45 @@ var Checker = require('../lib/checker');

it('should report missing space after opening brace', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all' });
checker.configure({ requireSpacesInsideObjectBrackets: 'all' });
assert(checker.checkString('var x = {a: 1 };').getErrorCount() === 1);
});
it('should report missing space before closing brace', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all' });
checker.configure({ requireSpacesInsideObjectBrackets: 'all' });
assert(checker.checkString('var x = { a: 1};').getErrorCount() === 1);
});
it('should report missing space in both cases', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all' });
checker.configure({ requireSpacesInsideObjectBrackets: 'all' });
assert(checker.checkString('var x = {a: 1};').getErrorCount() === 2);
});
it('should not report with spaces', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all' });
checker.configure({ requireSpacesInsideObjectBrackets: 'all' });
assert(checker.checkString('var x = { a: 1 };').isEmpty());
});
it('should not report for empty object', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all' });
checker.configure({ requireSpacesInsideObjectBrackets: 'all' });
assert(checker.checkString('var x = {};').isEmpty());
});
it('should report for nested object', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all' });
checker.configure({ requireSpacesInsideObjectBrackets: 'all' });
assert(checker.checkString('var x = { a: { b: 1 }};').getErrorCount() === 1);
});
it('should report missing space after opening brace', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all_but_nested' });
checker.configure({ requireSpacesInsideObjectBrackets: 'allButNested' });
assert(checker.checkString('var x = {a: 1 };').getErrorCount() === 1);
});
it('should report missing space before closing brace', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all_but_nested' });
checker.configure({ requireSpacesInsideObjectBrackets: 'allButNested' });
assert(checker.checkString('var x = { a: 1};').getErrorCount() === 1);
});
it('should report missing space in both cases', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all_but_nested' });
checker.configure({ requireSpacesInsideObjectBrackets: 'allButNested' });
assert(checker.checkString('var x = {a: 1};').getErrorCount() === 2);
});
it('should not report with spaces', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all_but_nested' });
checker.configure({ requireSpacesInsideObjectBrackets: 'allButNested' });
assert(checker.checkString('var x = { a: 1 };').isEmpty());
});
it('should not report for nested object', function() {
checker.configure({ require_spaces_inside_object_brackets: 'all_but_nested' });
checker.configure({ requireSpacesInsideObjectBrackets: 'allButNested' });
assert(checker.checkString('var x = { a: { b: 1 }};').isEmpty());
});
});

@@ -11,3 +11,3 @@ var Checker = require('../lib/checker');

it('should report invalid jsdoc', function() {
checker.configure({ validate_jsdoc: { check_param_names: true } });
checker.configure({ validateJSDoc: { checkParamNames: true } });
assert(

@@ -26,3 +26,3 @@ checker.checkString(

it('should report error in jsdoc for function', function() {
checker.configure({ validate_jsdoc: { check_param_names: true } });
checker.configure({ validateJSDoc: { checkParamNames: true } });
assert(

@@ -41,3 +41,3 @@ checker.checkString(

it('should report error in jsdoc for method', function() {
checker.configure({ validate_jsdoc: { check_param_names: true } });
checker.configure({ validateJSDoc: { checkParamNames: true } });
assert(

@@ -57,3 +57,3 @@ checker.checkString(

it('should not report valid jsdoc for method', function() {
checker.configure({ validate_jsdoc: { check_param_names: true } });
checker.configure({ validateJSDoc: { checkParamNames: true } });
assert(

@@ -72,3 +72,3 @@ checker.checkString(

it('should not report valid jsdoc for function', function() {
checker.configure({ validate_jsdoc: { check_param_names: true } });
checker.configure({ validateJSDoc: { checkParamNames: true } });
assert(

@@ -89,3 +89,3 @@ checker.checkString(

it('should report redundant jsdoc-param for function', function() {
checker.configure({ validate_jsdoc: { check_redundant_params: true } });
checker.configure({ validateJSDoc: { checkRedundantParams: true } });
assert(

@@ -104,3 +104,3 @@ checker.checkString(

it('should report redundant jsdoc-param for method', function() {
checker.configure({ validate_jsdoc: { check_redundant_params: true } });
checker.configure({ validateJSDoc: { checkRedundantParams: true } });
assert(

@@ -120,3 +120,3 @@ checker.checkString(

it('should not report valid jsdoc for method', function() {
checker.configure({ validate_jsdoc: { check_redundant_params: true } });
checker.configure({ validateJSDoc: { checkRedundantParams: true } });
assert(

@@ -135,3 +135,3 @@ checker.checkString(

it('should not report valid jsdoc for function', function() {
checker.configure({ validate_jsdoc: { check_redundant_params: true } });
checker.configure({ validateJSDoc: { checkRedundantParams: true } });
assert(

@@ -152,3 +152,3 @@ checker.checkString(

it('should report missing jsdoc-param type for function', function() {
checker.configure({ validate_jsdoc: { require_param_types: true } });
checker.configure({ validateJSDoc: { requireParamTypes: true } });
assert(

@@ -167,3 +167,3 @@ checker.checkString(

it('should report missing jsdoc-param type for method', function() {
checker.configure({ validate_jsdoc: { require_param_types: true } });
checker.configure({ validateJSDoc: { requireParamTypes: true } });
assert(

@@ -183,3 +183,3 @@ checker.checkString(

it('should not report valid jsdoc for method', function() {
checker.configure({ validate_jsdoc: { require_param_types: true } });
checker.configure({ validateJSDoc: { requireParamTypes: true } });
assert(

@@ -198,3 +198,3 @@ checker.checkString(

it('should not report valid jsdoc for function', function() {
checker.configure({ validate_jsdoc: { require_param_types: true } });
checker.configure({ validateJSDoc: { requireParamTypes: true } });
assert(

@@ -201,0 +201,0 @@ checker.checkString(

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc