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.2 to 1.0.3

3

CHANGELOG.md

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

Version 1.0.3:
* Changed behaviour for `disallowMultipleVarDecl` options. Now accepts multiple var decl in `for` decl.
Version 1.0.2:

@@ -2,0 +5,0 @@ * Option `requireSpacesInsideArrayBrackets` (@mishanga).

4

lib/rules/disallow-multiple-var-decl.js

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

file.iterateNodesByType('VariableDeclaration', function (node) {
if (node.declarations.length > 1) {
// allow multiple var declarations in for statement
// for (var i = 0, j = myArray.length; i < j; i++) {}
if (node.declarations.length > 1 && node.parentNode.type !== 'ForStatement') {
errors.add('Multiple var declaration', node.loc.start);

@@ -27,0 +29,0 @@ }

@@ -5,3 +5,3 @@ {

"name" : "jscs",
"version" : "1.0.2",
"version" : "1.0.3",
"repository" : "https://github.com/mdevils/node-jscs",

@@ -25,4 +25,4 @@ "contributors" : [

"esprima": "1.0.3",
"vow": "0.3.7",
"vow-fs": "0.1.13",
"vow": "0.3.9",
"vow-fs": "0.2.3",
"colors": "0.6.0-1",

@@ -29,0 +29,0 @@ "commander": "1.2.0",

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

Option: disallowMultipleVarDecl
Disallows multiple var declaration.
Disallows multiple var declaration (except for-loop).

@@ -92,2 +92,4 @@ Valid example:

for (var i = 0, j = arr.length; i < j; i++) {}
Invalid example:

@@ -132,3 +134,3 @@

Option: disallowSpacesInsideArrayBrackets
Disallows space after opening array square brace and before closing.
Disallows space after opening array square bracket and before closing.

@@ -167,3 +169,3 @@ Valid example:

Possible values: "all" for strict mode, "allButNested" ignores closing brackets in a row.
Requires space after opening array square brace and before closing.
Requires space after opening array square bracket and before closing.

@@ -170,0 +172,0 @@ Valid example for mode "all":

@@ -22,2 +22,6 @@ var Checker = require('../lib/checker');

});
it('should not report multiple var decl in for statement', function() {
checker.configure({ disallowMultipleVarDecl: true });
assert(checker.checkString('for (var i = 0, j = arr.length; i < j; i++) {}').isEmpty());
});
});

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