From c3b8f5a2e2708bca76546000158509504e392412 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 20 Jul 2017 14:35:51 -0700 Subject: [PATCH 1/2] lib: adjust indentation for impending lint change ESLint 4.x provides stricter indentation linting than previous versions. In preparation for enabling the stricter indentation linting, adjust the indentation of four lines in lib/net.js and lib/repl.js. --- lib/net.js | 6 +++--- lib/repl.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/net.js b/lib/net.js index a22754eb302c24..3d7122765bf358 100644 --- a/lib/net.js +++ b/lib/net.js @@ -988,9 +988,9 @@ Socket.prototype.connect = function() { if (pipe) { if (typeof path !== 'string') { throw new errors.TypeError('ERR_INVALID_ARG_TYPE', - 'options.path', - 'string', - path); + 'options.path', + 'string', + path); } internalConnect(this, path); } else { diff --git a/lib/repl.js b/lib/repl.js index 4efe02e94e9c44..059af8d3f9ac4a 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -1058,7 +1058,9 @@ REPLServer.prototype.defineCommand = function(keyword, cmd) { cmd = {action: cmd}; } else if (typeof cmd.action !== 'function') { throw new errors.TypeError('ERR_INVALID_ARG_TYPE', - 'action', 'function', cmd.action); + 'action', + 'function', + cmd.action); } this.commands[keyword] = cmd; }; From 43fc451c31fbbe376ee9d09c0e0d856121bcc7de Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 20 Jul 2017 14:36:08 -0700 Subject: [PATCH 2/2] tools: enable stricter linting in lib directory Enable ESLint 4.x linting and disable legacy linting in the lib directory. While doing this, some indentation in the .eslintrc.yaml file itself was noticed to be incorrect. Fixed that too. --- .eslintrc.yaml | 20 ++++++++++---------- lib/.eslintrc.yaml | 9 +++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 5e025301fe8a62..0ba050d4c60628 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -102,17 +102,17 @@ rules: func-name-matching: error func-style: [error, declaration, {allowArrowFunctions: true}] # indent: [error, 2, {ArrayExpression: first, - # CallExpression: {arguments: first}, - # FunctionDeclaration: {parameters: first}, - # FunctionExpression: {parameters: first}, - # MemberExpression: off, - # ObjectExpression: first, - # SwitchCase: 1}] + # CallExpression: {arguments: first}, + # FunctionDeclaration: {parameters: first}, + # FunctionExpression: {parameters: first}, + # MemberExpression: off, + # ObjectExpression: first, + # SwitchCase: 1}] indent-legacy: [error, 2, {ArrayExpression: first, - CallExpression: {arguments: first}, - MemberExpression: 1, - ObjectExpression: first, - SwitchCase: 1}] + CallExpression: {arguments: first}, + MemberExpression: 1, + ObjectExpression: first, + SwitchCase: 1}] key-spacing: [error, {mode: minimum}] keyword-spacing: error linebreak-style: [error, unix] diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 24f54e682636ee..1015a5fd25f003 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -1,4 +1,13 @@ rules: + indent: [error, 2, {ArrayExpression: first, + CallExpression: {arguments: first}, + FunctionDeclaration: {parameters: first}, + FunctionExpression: {parameters: first}, + MemberExpression: off, + ObjectExpression: first, + SwitchCase: 1}] + indent-legacy: 0 + # Custom rules in tools/eslint-rules require-buffer: error buffer-constructor: error