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.5 to 1.0.6

lib/rules/safe-context-keyword.js

10

CHANGELOG.md

@@ -0,1 +1,11 @@

Version 1.0.6:
* Convert tabs into spaces (@markelog).
* Report illegal space between nested closing curly braces (@twoRoger).
* Use absolute path to config when specified (@vtambourine).
* safeContextKeyword option to check "var that = this" expressions (@doochik).
Version 1.0.4-1.0.5:
* Fixed mistype `disallowMulipleVarDecl` -> `disallowMultipleVarDecl`.
* Fixed error for invalid symlink checking.
Version 1.0.3:

@@ -2,0 +12,0 @@ * Changed behaviour for `disallowMultipleVarDecl` options. Now accepts multiple var decl in `for` decl.

2

lib/checker.js

@@ -69,2 +69,4 @@ var esprima = require('esprima');

this.registerRule(new (require('./rules/disallow-spaces-in-function-expression'))());
this.registerRule(new (require('./rules/safe-context-keyword'))());
},

@@ -71,0 +73,0 @@

3

lib/cli.js

@@ -11,2 +11,3 @@ /**

var Vow = require('vow');
var path = require('path');

@@ -23,3 +24,3 @@ program

var configPath = program.config || (process.cwd() + '/.jscs.json');
var configPath = path.resolve(process.cwd(), program.config || '.jscs.json');

@@ -26,0 +27,0 @@ /**

@@ -137,2 +137,6 @@ var colors = require('colors');

function renderLine(n, line, colorize) {
// Convert tabs to spaces, so errors in code lines with tabs as indention symbol
// could be correctly rendered, plus it will provide less verbose output
line = line.replace(/\t/g, ' ');
// "n + 1" to print lines in human way (counted from 1)

@@ -139,0 +143,0 @@ var lineNumber = prependSpaces((n + 1).toString(), 5) + ' |';

@@ -44,10 +44,12 @@ var assert = require('assert');

var prevToken = tokens[closingBracketPos - 1];
var isNested = mode === 'allButNested' &&
prevToken.type === 'Punctuator' &&
prevToken.value === '}';
if (closingBracket.range[0] === prevToken.range[1]) {
if (!(mode === 'allButNested' &&
prevToken.type === 'Punctuator' &&
prevToken.value === '}'
)) {
if (!isNested) {
errors.add('Missing space before closing curly brace', closingBracket.loc.start);
}
} else if (isNested && closingBracket.loc.start.line === prevToken.loc.start.line) {
errors.add('Illegal space between closing curly braces', prevToken.loc.end);
}

@@ -54,0 +56,0 @@ });

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

"name" : "jscs",
"version" : "1.0.5",
"version" : "1.0.6",
"repository" : "https://github.com/mdevils/node-jscs",

@@ -8,0 +8,0 @@ "contributors" : [

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

/*
Option: safeContextKeyword
Option to check "var that = this" expressions
Valid example:
var that = this;
Invalid example:
var _this = this;
*/
"safeContextKeyword": "that"
/*
Option: validateJSDoc

@@ -437,0 +451,0 @@ Enables jsdoc validation.

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

});
it('should report illegal space between closing braces for nested object', function() {
checker.configure({ requireSpacesInsideObjectBrackets: 'allButNested' });
assert(checker.checkString('var x = { a: { b: 1 } };').getErrorCount() === 1);
});
});
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