Socket
Socket
Sign inDemoInstall

eslint

Package Overview
Dependencies
Maintainers
2
Versions
369
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint - npm Package Compare versions

Comparing version 0.24.0 to 0.24.1

10

lib/eslint.js

@@ -243,3 +243,3 @@ /**

* @param {Object[]} messages The messages queue.
* @returns {void}
* @returns {object} Modified config object
*/

@@ -306,3 +306,3 @@ function modifyConfigsFromComments(filename, ast, config, reportingConfig, messages) {

if (environments[name]) {
util.mergeConfigs(commentConfig, environments[name]);
commentConfig = util.mergeConfigs(commentConfig, environments[name]);
}

@@ -312,3 +312,3 @@ });

util.mergeConfigs(config, commentConfig);
return util.mergeConfigs(config, commentConfig);
}

@@ -617,3 +617,3 @@

// parse global comments and modify config
modifyConfigsFromComments(filename, ast, config, reportingConfig, messages);
config = modifyConfigsFromComments(filename, ast, config, reportingConfig, messages);

@@ -915,3 +915,3 @@ // enable appropriate rules

if (parent.type !== "CallExpression" || parent.callee !== node) {
if (parent.type !== "CallExpression") {
while (parent && !parent.leadingComments && !/Function/.test(parent.type)) {

@@ -918,0 +918,0 @@ parent = parent.parent;

/**
* @fileoverview Rule to check for "block scoped" variables by binding context
* @author Matt DuVall <http://www.mattduvall.com>
* @copyright 2015 Mathieu M-Gosselin. All rights reserved.
*/

@@ -105,2 +106,18 @@ "use strict";

/**
* Declares all relevant identifiers for module exports.
* @param {ASTNode} node The AST node representing an export.
* @returns {void}
* @private
*/
function declareExports(node) {
if (node.exported && node.exported.name) {
declare([node.exported.name]);
if (node.local) {
declare([node.local.name]);
}
}
}
/**
* Declares all relevant identifiers for classes.

@@ -245,2 +262,4 @@ * @param {ASTNode} node The AST node representing a class.

"ExportSpecifier": declareExports,
"BlockStatement": function(node) {

@@ -247,0 +266,0 @@ var statements = node.body;

@@ -57,3 +57,5 @@ /**

"ObjectExpression": checkForTrailingComma,
"ArrayExpression": checkForTrailingComma
"ObjectPattern": checkForTrailingComma,
"ArrayExpression": checkForTrailingComma,
"ArrayPattern": checkForTrailingComma
};

@@ -60,0 +62,0 @@ };

/**
* @fileoverview Enforces empty lines around comments.
* @author Jamund Ferguson
* @copyright 2015 Mathieu M-Gosselin. All rights reserved.
* @copyright 2015 Jamund Ferguson. All rights reserved.
* @copyright 2015 Gyandeep Singh. All rights reserved.
*/

@@ -100,3 +102,4 @@ "use strict";

}
return parent && (parent.type === "BlockStatement" || parent.body.type === "BlockStatement") &&
return parent && (parent.type === "ClassBody" || parent.type === "BlockStatement" || (parent.body && parent.body.type === "BlockStatement")) &&
node.loc.start.line - parent.loc.start.line === 1;

@@ -117,3 +120,4 @@ }

}
return parent && (parent.type === "BlockStatement" || parent.body.type === "BlockStatement") &&
return parent && (parent.type === "ClassBody" || parent.type === "BlockStatement" || (parent.body && parent.body.type === "BlockStatement")) &&
parent.loc.end.line - node.loc.end.line === 1;

@@ -120,0 +124,0 @@ }

@@ -51,3 +51,3 @@ /**

if (line.replace(/\t/g, tabString).length > maxLength) {
context.report(node, { line: i + 1, col: 1 }, "Line " + (i + 1) + " exceeds the maximum line length of " + maxLength + ".");
context.report(node, { line: i + 1, column: 0 }, "Line " + (i + 1) + " exceeds the maximum line length of " + maxLength + ".");
}

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

@@ -15,3 +15,3 @@ /**

module.exports = function(context) {
var IMPLIED_EVAL = /set(?:Timeout|Interval)/;
var IMPLIED_EVAL = /set(?:Timeout|Interval)|execScript/;

@@ -18,0 +18,0 @@ //--------------------------------------------------------------------------

@@ -47,3 +47,3 @@ /**

// globalReturn means one extra scope to check
if (node.type === "Program" && context.ecmaFeatures.globalReturn) {
if (node.type === "Program" && (context.ecmaFeatures.globalReturn || context.ecmaFeatures.modules)) {
findVariablesInScope(scope.childScopes[0]);

@@ -50,0 +50,0 @@ }

@@ -47,3 +47,4 @@ /**

if (node.kind === "get" || node.kind === "set") {
// getters, setters and computed properties are ignored
if (node.kind === "get" || node.kind === "set" || node.computed) {
return;

@@ -50,0 +51,0 @@ }

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

(node.right.type === "Literal" || looksLikeLiteral(node.right)) &&
!(node.left.type === "Literal" || looksLikeLiteral(node.left)) &&
!(!isEqualityOperator(node.operator) && onlyEquality) &&

@@ -213,2 +214,3 @@ isComparisonOperator(node.operator) &&

(node.left.type === "Literal" || looksLikeLiteral(node.left)) &&
!(node.right.type === "Literal" || looksLikeLiteral(node.right)) &&
!(!isEqualityOperator(node.operator) && onlyEquality) &&

@@ -215,0 +217,0 @@ isComparisonOperator(node.operator) &&

@@ -19,40 +19,80 @@ /**

* Merges two config objects. This will not only add missing keys, but will also modify values to match.
* @param {Object} base config object
* @param {Object} custom config object. Overrides in this config object will take priority over base.
* @param {Object} target config object
* @param {Object} src config object. Overrides in this config object will take priority over base.
* @param {boolean} [combine] Whether to combine arrays or not
* @returns {Object} merged config object.
*/
exports.mergeConfigs = function mergeConfigs(base, custom) {
exports.mergeConfigs = function deepmerge(target, src, combine) {
/*
The MIT License (MIT)
Object.keys(custom).forEach(function (key) {
var property = custom[key];
Copyright (c) 2012 Nicholas Fisher
if (key === "plugins") {
if (!base[key]) {
base[key] = [];
}
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
property.forEach(function (plugin) {
// skip duplicates
if (base[key].indexOf(plugin) === -1) {
base[key].push(plugin);
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// This code is taken from deepmerge repo (https://github.com/KyleAMathews/deepmerge) and modified to meet our needs.
var array = Array.isArray(src) || Array.isArray(target);
var dst = array && [] || {};
combine = !!combine;
if (array) {
target = target || [];
dst = dst.concat(target);
if (typeof src !== "object" && !Array.isArray(src)) {
src = [src];
}
Object.keys(src).forEach(function(e, i) {
e = src[i];
if (typeof dst[i] === "undefined") {
dst[i] = e;
} else if (typeof e === "object") {
dst[i] = deepmerge(target[i], e);
} else {
if (!combine) {
dst[i] = e;
} else {
if (dst.indexOf(e) === -1) {
dst.push(e);
}
}
}
});
} else {
if (target && typeof target === "object") {
Object.keys(target).forEach(function (key) {
dst[key] = target[key];
});
return;
}
Object.keys(src).forEach(function (key) {
if (Array.isArray(src[key]) || Array.isArray(target[key])) {
dst[key] = deepmerge(target[key], src[key], key === "plugins");
} else if (typeof src[key] !== "object" || !src[key]) {
dst[key] = src[key];
} else {
if (!target[key]) {
dst[key] = src[key];
} else {
dst[key] = deepmerge(target[key], src[key]);
}
}
});
}
if (Array.isArray(base[key]) && !Array.isArray(property) && typeof property === "number") {
// assume that we are just overriding first attribute
base[key][0] = custom[key];
return;
}
if (typeof property === "object" && !Array.isArray(property) && property !== null) {
// base[key] might not exist, so be careful with recursion here
base[key] = mergeConfigs(base[key] || {}, custom[key]);
} else {
base[key] = custom[key];
}
});
return base;
return dst;
};

@@ -59,0 +99,0 @@

{
"name": "eslint",
"version": "0.24.0",
"version": "0.24.1",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",

@@ -5,0 +5,0 @@ "description": "An AST-based pattern checker for JavaScript.",

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