Comparing version 2.3.4 to 2.3.5
@@ -90,2 +90,8 @@ /** | ||
// exception for function params | ||
if (node.params && | ||
node.params[0].loc.start.line === node.params[node.params.length - 1].loc.end.line) { | ||
return true; | ||
} | ||
// See #1841 | ||
@@ -92,0 +98,0 @@ if (!exceptFunction || !node.properties) { |
@@ -68,4 +68,4 @@ /** | ||
// Make an exception if the next token is also a keyword (a space would be required). | ||
if (nextToken.type === 'Keyword') { | ||
// Make an exception if the next token is not a Punctuator such as a Keyword or Identifier | ||
if (nextToken.type !== 'Punctuator') { | ||
return; | ||
@@ -72,0 +72,0 @@ } |
@@ -21,2 +21,4 @@ /** | ||
* var bar = {a: "a", b: "b"} | ||
* const [1, 2, 3]; | ||
* const {a: "a", b: "b"} | ||
* ``` | ||
@@ -49,3 +51,6 @@ * | ||
check: function(file, errors) { | ||
file.iterateNodesByType(['ObjectExpression', 'ArrayExpression'], function(node) { | ||
file.iterateNodesByType([ | ||
'ObjectExpression', 'ArrayExpression', | ||
'ObjectPattern', 'ArrayPattern' | ||
], function(node) { | ||
var closingToken = file.getLastNodeToken(node); | ||
@@ -52,0 +57,0 @@ |
@@ -65,2 +65,7 @@ /** | ||
// check export declaration | ||
if (nextToken.value === 'export') { | ||
nextToken = file.getNextToken(nextToken); | ||
} | ||
if (nextToken.value in {'var': true, 'let': true, 'const': true}) { | ||
@@ -67,0 +72,0 @@ return; |
@@ -32,3 +32,5 @@ /** | ||
* ```js | ||
* return true; | ||
* if (x) { | ||
* x++; | ||
* } | ||
* ``` | ||
@@ -35,0 +37,0 @@ * |
@@ -44,2 +44,3 @@ /** | ||
var assert = require('assert'); | ||
var TokenCategorizer = require('../token-categorizer'); | ||
@@ -64,4 +65,11 @@ module.exports = function() {}; | ||
var testToken = file.getFirstNodeToken(node.test); | ||
var prevToken = file.getPrevToken(testToken); | ||
if (prevToken.value === '(' && | ||
TokenCategorizer.categorizeOpenParen(prevToken, file) === 'ParenthesizedExpression') { | ||
testToken = prevToken; | ||
prevToken = file.getPrevToken(prevToken); | ||
} | ||
errors.assert.spacesBetween({ | ||
token: file.getPrevToken(testToken), | ||
token: prevToken, | ||
nextToken: testToken, | ||
@@ -68,0 +76,0 @@ exactly: 1, |
@@ -85,5 +85,8 @@ /** | ||
file.iterateNodesByType(['ObjectExpression', 'ArrayExpression'], function(node) { | ||
var isObject = node.type === 'ObjectExpression'; | ||
var entities = isObject ? node.properties : node.elements; | ||
file.iterateNodesByType([ | ||
'ObjectExpression', 'ArrayExpression', | ||
'ObjectPattern', 'ArrayPattern' | ||
], function(node) { | ||
var isLikeObject = node.type === 'ObjectExpression' || node.type === 'ObjectPattern'; | ||
var entities = isLikeObject ? node.properties : node.elements; | ||
@@ -107,3 +110,3 @@ if (entities.length === 0) { | ||
expectedTokenBefore: {type: 'Punctuator', value: ','}, | ||
message: 'Missing comma before closing ' + (isObject ? 'curly brace' : 'bracket') | ||
message: 'Missing comma before closing ' + (isLikeObject ? 'curly brace' : 'bracket') | ||
}); | ||
@@ -110,0 +113,0 @@ }); |
@@ -8,3 +8,3 @@ { | ||
"name": "jscs", | ||
"version": "2.3.4", | ||
"version": "2.3.5", | ||
"main": "lib/checker", | ||
@@ -11,0 +11,0 @@ "homepage": "http://jscs.info", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
5026803
21428