tools: update ESLint to 3.3.0 and enable rules

Update ESLint 3.3.0 and update .eslintrc:

* replace deprecated no-negated-in-lhs rule with no-unsafe-negation
  * http://eslint.org/docs/rules/no-negated-in-lhs
  * http://eslint.org/docs/rules/no-unsafe-negation
* enable no-template-curly-in-string
  * http://eslint.org/docs/rules/no-template-curly-in-string
* enable no-global-assign
  * http://eslint.org/docs/rules/no-global-assign
* enable func-call-spacing
  * http://eslint.org/docs/rules/func-call-spacing

PR-URL: https://github.com/nodejs/node/pull/8097
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
Rich Trott 2016-08-13 15:06:43 -07:00
parent 88650aaa70
commit 05b566a5ef
391 changed files with 4755 additions and 5775 deletions

View file

@ -9,7 +9,7 @@
// Requirements
//------------------------------------------------------------------------------
let debug = require("./debug-helpers");
const debug = require("./debug-helpers");
//------------------------------------------------------------------------------
// Helpers
@ -22,11 +22,11 @@ let debug = require("./debug-helpers");
* @returns {CodePathSegment[]} The replaced array.
*/
function flattenUnusedSegments(segments) {
let done = Object.create(null);
let retv = [];
const done = Object.create(null);
const retv = [];
for (let i = 0; i < segments.length; ++i) {
let segment = segments[i];
const segment = segments[i];
// Ignores duplicated.
if (done[segment.id]) {
@ -36,7 +36,7 @@ function flattenUnusedSegments(segments) {
// Use previous segments if unused.
if (!segment.internal.used) {
for (let j = 0; j < segment.allPrevSegments.length; ++j) {
let prevSegment = segment.allPrevSegments[j];
const prevSegment = segment.allPrevSegments[j];
if (!done[prevSegment.id]) {
done[prevSegment.id] = true;
@ -175,7 +175,7 @@ CodePathSegment.newNext = function(id, allPrevSegments) {
* @returns {CodePathSegment} The created segment.
*/
CodePathSegment.newUnreachable = function(id, allPrevSegments) {
let segment = new CodePathSegment(id, flattenUnusedSegments(allPrevSegments), false);
const segment = new CodePathSegment(id, flattenUnusedSegments(allPrevSegments), false);
// In `if (a) return a; foo();` case, the unreachable segment preceded by
// the return statement is not used but must not be remove.
@ -215,7 +215,7 @@ CodePathSegment.markUsed = function(segment) {
if (segment.reachable) {
for (i = 0; i < segment.allPrevSegments.length; ++i) {
let prevSegment = segment.allPrevSegments[i];
const prevSegment = segment.allPrevSegments[i];
prevSegment.allNextSegments.push(segment);
prevSegment.nextSegments.push(segment);