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 1.0.7 to 1.0.8

3

CHANGELOG.md

@@ -0,1 +1,4 @@

Version 1.0.8:
* Fixes for `safeContextKeyword`.
Version 1.0.7:

@@ -2,0 +5,0 @@ * Disallow spaces inside parentheses (@ignovak).

14

lib/rules/safe-context-keyword.js

@@ -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 @@

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