Comparing version 0.21.1 to 0.21.2
@@ -50,3 +50,3 @@ /** | ||
* conventions as require(), meaning that the first character must be nonalphanumeric | ||
* to be considered a file path. | ||
* and not the @ sign which is used for scoped packages to be considered a file path. | ||
* @param {string} filePath The string to check. | ||
@@ -57,3 +57,3 @@ * @returns {boolean} True if it's a filepath, false if not. | ||
function isFilePath(filePath) { | ||
return isAbsolutePath(filePath) || !/\w/.test(filePath[0]); | ||
return isAbsolutePath(filePath) || !/\w|@/.test(filePath[0]); | ||
} | ||
@@ -85,3 +85,8 @@ | ||
if (filePath.indexOf("eslint-config-") === -1) { | ||
filePath = "eslint-config-" + filePath; | ||
if (filePath.indexOf("@") === 0) { | ||
// for scoped packages, insert the eslint-config after the last / | ||
filePath = filePath.replace(/(.*\/)([^\/]+)/, "$1eslint-config-$2"); | ||
} else { | ||
filePath = "eslint-config-" + filePath; | ||
} | ||
} | ||
@@ -88,0 +93,0 @@ |
@@ -890,5 +890,20 @@ /** | ||
/** | ||
* Check to see if its a ES6 export declaration | ||
* @param {ASTNode} astNode - any node | ||
* @returns {boolean} whether the given node represents a export declaration | ||
*/ | ||
function looksLikeExport(astNode) { | ||
return astNode.type === "ExportDefaultDeclaration" || astNode.type === "ExportNamedDeclaration" || | ||
astNode.type === "ExportAllDeclaration" || astNode.type === "ExportSpecifier"; | ||
} | ||
switch (node.type) { | ||
case "FunctionDeclaration": | ||
return findJSDocComment(node.leadingComments); | ||
if (looksLikeExport(parent)) { | ||
return findJSDocComment(parent.leadingComments); | ||
} else { | ||
return findJSDocComment(node.leadingComments); | ||
} | ||
break; | ||
@@ -895,0 +910,0 @@ case "ArrowFunctionExpression": |
@@ -42,4 +42,4 @@ /** | ||
// function names are exempt | ||
variable.defs.length && variable.defs[0].type !== "FunctionName" | ||
// function and class names are exempt | ||
variable.defs.length && variable.defs[0].type !== "FunctionName" && variable.defs[0].type !== "ClassName" | ||
) { | ||
@@ -46,0 +46,0 @@ context.report(variable.identifiers[0], "{{a}} is already declared in the upper scope.", {a: variable.name}); |
@@ -205,15 +205,22 @@ /** | ||
"VariableDeclaration": function(node) { | ||
var type = node.kind; | ||
var declarations = node.declarations; | ||
var declarationCounts = countDeclarations(declarations); | ||
var parent = node.parent, | ||
type, declarations, declarationCounts; | ||
type = node.kind; | ||
if (!options[type]) { | ||
return; | ||
} | ||
declarations = node.declarations; | ||
declarationCounts = countDeclarations(declarations); | ||
// always | ||
if (!hasOnlyOneStatement(type, declarations)) { | ||
if (options[type] && options[type].initialized === MODE_ALWAYS && options[type].uninitialized === MODE_ALWAYS) { | ||
if (options[type].initialized === MODE_ALWAYS && options[type].uninitialized === MODE_ALWAYS) { | ||
context.report(node, "Combine this with the previous '" + type + "' statement."); | ||
} else { | ||
if (options[type] && options[type].initialized === MODE_ALWAYS) { | ||
if (options[type].initialized === MODE_ALWAYS) { | ||
context.report(node, "Combine this with the previous '" + type + "' statement with initialized variables."); | ||
} | ||
if (options[type] && options[type].uninitialized === MODE_ALWAYS) { | ||
if (options[type].uninitialized === MODE_ALWAYS) { | ||
context.report(node, "Combine this with the previous '" + type + "' statement with uninitialized variables."); | ||
@@ -224,16 +231,18 @@ } | ||
// never | ||
if (options[type] && options[type].initialized === MODE_NEVER && options[type].uninitialized === MODE_NEVER) { | ||
if ((declarationCounts.uninitialized + declarationCounts.initialized) > 1) { | ||
context.report(node, "Split '" + type + "' declarations into multiple statements."); | ||
} | ||
} else { | ||
if (options[type] && options[type].initialized === MODE_NEVER) { | ||
if (declarationCounts.initialized > 1) { | ||
context.report(node, "Split initialized '" + type + "' declarations into multiple statements."); | ||
if (parent.type !== "ForStatement" || parent.init !== node) { | ||
if (options[type].initialized === MODE_NEVER && options[type].uninitialized === MODE_NEVER) { | ||
if ((declarationCounts.uninitialized + declarationCounts.initialized) > 1) { | ||
context.report(node, "Split '" + type + "' declarations into multiple statements."); | ||
} | ||
} | ||
if (options[type] && options[type].uninitialized === MODE_NEVER) { | ||
if (declarationCounts.uninitialized > 1) { | ||
context.report(node, "Split uninitialized '" + type + "' declarations into multiple statements."); | ||
} else { | ||
if (options[type].initialized === MODE_NEVER) { | ||
if (declarationCounts.initialized > 1) { | ||
context.report(node, "Split initialized '" + type + "' declarations into multiple statements."); | ||
} | ||
} | ||
if (options[type].uninitialized === MODE_NEVER) { | ||
if (declarationCounts.uninitialized > 1) { | ||
context.report(node, "Split uninitialized '" + type + "' declarations into multiple statements."); | ||
} | ||
} | ||
} | ||
@@ -240,0 +249,0 @@ } |
{ | ||
"name": "eslint", | ||
"version": "0.21.1", | ||
"version": "0.21.2", | ||
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>", | ||
@@ -5,0 +5,0 @@ "description": "An AST-based pattern checker for JavaScript.", |
@@ -6,7 +6,6 @@ [![NPM version][npm-image]][npm-url] | ||
[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=282608)](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE) | ||
[![Join the chat at https://gitter.im/eslint/eslint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
# ESLint | ||
[![Join the chat at https://gitter.im/eslint/eslint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[Website](http://eslint.org) | [Configuring](http://eslint.org/docs/user-guide/configuring) | [Rules](http://eslint.org/docs/rules/) | [Contributing](http://eslint.org/docs/developer-guide/contributing) | [Twitter](https://twitter.com/geteslint) | [Mailing List](https://groups.google.com/group/eslint) | ||
@@ -87,3 +86,3 @@ | ||
Join our [Mailing List](https://groups.google.com/group/eslint) | ||
Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](https://gitter.im/eslint/eslint) | ||
@@ -90,0 +89,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
539183
13691
96