eslint
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -170,3 +170,3 @@ /** | ||
this.env = options.envs; | ||
this.globals = options.globals ? options.globals.reduce(function (globals, def) { | ||
this.globals = (options.globals || []).reduce(function (globals, def) { | ||
// Default "foo" to false and handle "foo:false" and "foo:true" | ||
@@ -176,3 +176,3 @@ var parts = def.split(":"); | ||
return globals; | ||
}, {}) : []; | ||
}, {}); | ||
useConfig = options.configFile; | ||
@@ -179,0 +179,0 @@ this.options = options; |
/** | ||
* @fileoverview Rule to flag use of constructors without capital letters | ||
* @author Nicholas C. Zakas | ||
* @copyright 2013-2014 Nicholas C. Zakas. All rights reserved. | ||
*/ | ||
var CAPS_ALLOWED = [ | ||
"Number", | ||
"String", | ||
"Boolean", | ||
"Date", | ||
"Array", | ||
"Symbol", | ||
"RegExp" | ||
]; | ||
"use strict"; | ||
var CAPS_ALLOWED = [ | ||
"Number", | ||
"String", | ||
"Boolean", | ||
"Date", | ||
"Array", | ||
"Symbol", | ||
"RegExp" | ||
]; | ||
//------------------------------------------------------------------------------ | ||
@@ -22,4 +25,2 @@ // Rule Definition | ||
"use strict"; | ||
var config = context.options[0] || {}; | ||
@@ -42,9 +43,12 @@ config.newIsCap = config.newIsCap === false ? false : true; | ||
var name = ""; | ||
var name = "", | ||
property; | ||
if (node.callee.type === "MemberExpression") { | ||
if (node.callee.property.type === "Literal") { | ||
name = node.callee.property.value; | ||
} else if (node.callee.property.type === "Identifier" && !node.callee.computed) { | ||
name = node.callee.property.name; | ||
property = node.callee.property; | ||
if (property.type === "Literal" && (typeof property.value === "string")) { | ||
name = property.value; | ||
} else if (property.type === "Identifier" && !node.callee.computed) { | ||
name = property.name; | ||
} | ||
@@ -51,0 +55,0 @@ } else { |
/** | ||
* @fileoverview Disallow mixed spaces and tabs for indentation | ||
* @author Jary Niebur | ||
* @copyright 2014 Nicholas C. Zakas. All rights reserved. | ||
* @copyright 2014 Jary Niebur. All rights reserved. | ||
*/ | ||
@@ -15,2 +17,5 @@ "use strict"; | ||
var COMMENT_START = /^\s*\/\*/, | ||
MAYBE_COMMENT = /^\s*\*/; | ||
//-------------------------------------------------------------------------- | ||
@@ -23,13 +28,14 @@ // Public | ||
"Program": function(node) { | ||
/* | ||
/* | ||
* At least one space followed by a tab | ||
* or the reverse before non-tab/-space | ||
* or the reverse before non-tab/-space | ||
* characters begin. | ||
*/ | ||
var regex = /^(?=[\t ]*(\t | \t))/, | ||
match; | ||
match, | ||
lines = context.getSourceLines(); | ||
if (smartTabs) { | ||
/* | ||
* At least one space followed by a tab | ||
* At least one space followed by a tab | ||
* before non-tab/-space characters begin. | ||
@@ -40,11 +46,13 @@ */ | ||
context | ||
.getSourceLines() | ||
.forEach(function(line, i) { | ||
match = regex.exec(line); | ||
if (match) { | ||
lines.forEach(function(line, i) { | ||
match = regex.exec(line); | ||
if (match) { | ||
if (!MAYBE_COMMENT.test(line) && !COMMENT_START.test(lines[i - 1])) { | ||
context.report(node, { line: i + 1, column: match.index + 1 }, "Mixed spaces and tabs."); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
@@ -51,0 +59,0 @@ |
{ | ||
"name": "eslint", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>", | ||
@@ -5,0 +5,0 @@ "description": "An Esprima-based pattern checker for JavaScript.", |
311608
8028