Comparing version 1.0.7 to 1.0.8
@@ -0,1 +1,4 @@ | ||
Version 1.0.8: | ||
* Fixes for `safeContextKeyword`. | ||
Version 1.0.7: | ||
@@ -2,0 +5,0 @@ * Disallow spaces inside parentheses (@ignovak). |
@@ -8,3 +8,3 @@ var assert = require('assert'); | ||
configure: function(keyword) { | ||
assert(typeof keyword === 'string', 'safeContext option requires string value'); | ||
assert(typeof keyword === 'string', 'safeContextKeyword option requires string value'); | ||
@@ -27,3 +27,7 @@ this._keyword = keyword; | ||
if (decl.init.type === 'ThisExpression' && decl.id.name !== keyword) { | ||
if ( | ||
// decl.init === null in case of "var foo;" | ||
decl.init && | ||
(decl.init.type === 'ThisExpression' && decl.id.name !== keyword) | ||
) { | ||
errors.add( | ||
@@ -40,3 +44,7 @@ 'You should use "' + keyword + '" to safe "this"', | ||
if (node.right.type === 'ThisExpression' && node.left.name !== keyword) { | ||
if ( | ||
// filter property assignments "foo.bar = this" | ||
node.left.type === 'Identifier' && | ||
(node.right.type === 'ThisExpression' && node.left.name !== keyword) | ||
) { | ||
errors.add( | ||
@@ -43,0 +51,0 @@ 'You should use "' + keyword + '" to safe "this"', |
@@ -5,3 +5,3 @@ { | ||
"name" : "jscs", | ||
"version" : "1.0.7", | ||
"version" : "1.0.8", | ||
"repository" : "https://github.com/mdevils/node-jscs", | ||
@@ -8,0 +8,0 @@ "contributors" : [ |
@@ -21,2 +21,6 @@ var Checker = require('../lib/checker'); | ||
}); | ||
it('should not report "var foo;"', function() { | ||
assert(checker.checkString('var foo;').getErrorCount() === 0); | ||
}); | ||
}); | ||
@@ -32,2 +36,6 @@ | ||
}); | ||
it('should not report propery assignment "foo.bar = this"', function() { | ||
assert(checker.checkString('foo.bar = this').getErrorCount() === 0); | ||
}); | ||
}); | ||
@@ -34,0 +42,0 @@ |
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
149765
3403