Comparing version 1.5.4 to 1.5.6
@@ -46,3 +46,3 @@ var vowFs = require('vow-fs'); | ||
if ( !_this._isExcluded(path) && _this._hasCorrectExtension(path)) { | ||
if (!_this._isExcluded(path) && _this._hasCorrectExtension(path)) { | ||
return vowFs.read(path, 'utf8').then(function(data) { | ||
@@ -57,2 +57,16 @@ return _this.checkString(data, path); | ||
/** | ||
* Should replace Checker#checkFile method in 2.0 since it would be a breaking change | ||
* | ||
* @param {String} path | ||
* @returns {Promise * Errors} | ||
*/ | ||
Checker.prototype._checkFile = function(path) { | ||
var _this = this; | ||
return vowFs.read(path, 'utf8').then(function(data) { | ||
return _this.checkString(data, path); | ||
}); | ||
}; | ||
/** | ||
* Checks directory recursively. | ||
@@ -113,3 +127,3 @@ * | ||
return Vow.when(_this.checkFile(path)).then(function(errors) { | ||
return _this._checkFile(path).then(function(errors) { | ||
if (errors) { | ||
@@ -145,6 +159,11 @@ return [errors]; | ||
var extension = path.extname(testPath).toLowerCase(); | ||
var basename = path.basename(testPath).toLowerCase(); | ||
return !(this._fileExtensions.indexOf(extension) < 0 && this._fileExtensions.indexOf('*') < 0); | ||
return !( | ||
this._fileExtensions.indexOf(extension) < 0 && | ||
this._fileExtensions.indexOf(basename) < 0 && | ||
this._fileExtensions.indexOf('*') < 0 | ||
); | ||
}; | ||
module.exports = Checker; |
@@ -68,3 +68,8 @@ var assert = require('assert'); | ||
errorIfApplicable(token, i, tokens, operator); | ||
var prevToken = tokens[i - 1]; | ||
// Do not report error if comma not on the same line with the first operand #467 | ||
if (token.loc.start.line === prevToken.loc.start.line) { | ||
errorIfApplicable(token, i, tokens, operator); | ||
} | ||
}); | ||
@@ -71,0 +76,0 @@ } |
@@ -8,5 +8,5 @@ var assert = require('assert'); | ||
var sibling = node.parentCollection[pos + 1]; | ||
if (sibling.type === 'VariableDeclaration') { | ||
if (sibling.type === 'VariableDeclaration' && sibling.kind === node.kind) { | ||
errors.add( | ||
'Var declarations should be joined', | ||
node.kind[0].toUpperCase() + node.kind.slice(1) + ' declarations should be joined', | ||
sibling.loc.start | ||
@@ -22,2 +22,3 @@ ); | ||
var firstVar = true; | ||
var firstConst = true; | ||
var firstParent = true; | ||
@@ -27,2 +28,3 @@ | ||
var type = node && node.type; | ||
var kind = node && node.kind; | ||
@@ -39,10 +41,23 @@ // Don't go in nested scopes | ||
if (type === 'VariableDeclaration') { | ||
if (!firstVar) { | ||
errors.add( | ||
'Var declarations should be joined', | ||
node.loc.start | ||
); | ||
} else { | ||
firstVar = false; | ||
if (kind === 'var') { | ||
if (!firstVar) { | ||
errors.add( | ||
'Var declarations should be joined', | ||
node.loc.start | ||
); | ||
} else { | ||
firstVar = false; | ||
} | ||
} | ||
if (kind === 'const') { | ||
if (!firstConst) { | ||
errors.add( | ||
'Const declarations should be joined', | ||
node.loc.start | ||
); | ||
} else { | ||
firstConst = false; | ||
} | ||
} | ||
} | ||
@@ -49,0 +64,0 @@ }, node); |
@@ -5,3 +5,3 @@ { | ||
"name": "jscs", | ||
"version": "1.5.4", | ||
"version": "1.5.6", | ||
"main": "lib/checker", | ||
@@ -51,6 +51,8 @@ "homepage": "https://github.com/mdevils/node-jscs", | ||
"scripts": { | ||
"lint": "jshint . && node bin/jscs lib test bin", | ||
"lint": "jshint . && node bin/jscs lib test bin publish", | ||
"test": "npm run lint && mocha", | ||
"browserify": "browserify --standalone JscsStringChecker lib/string-checker.js -o jscs-browser.js", | ||
"changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:'%s (%an)' | grep -v 'Merge pull request'" | ||
"changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:'%s (%an)' | grep -v 'Merge pull request'", | ||
"prepublish": "node publish/prepublish", | ||
"postpublish": "node publish/postpublish" | ||
}, | ||
@@ -57,0 +59,0 @@ "files": [ |
@@ -94,3 +94,6 @@ { | ||
"maximumLineLength": 120, | ||
"maximumLineLength": { | ||
"value": 120, | ||
"allowUrlComments": true | ||
}, | ||
"requireLineFeedAtFileEnd": true, | ||
@@ -97,0 +100,0 @@ "disallowMultipleLineBreaks": true, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
236421
5230