From bbaef00cd1a9b276be787dcd59de9d33e729ecaa Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 17 Jun 2017 22:35:39 -0700 Subject: [PATCH 1/3] tools: fix indentation in required-modules.js In preparation for applying the more strict indentation linting available in ESLint 4.0.0, correct minor indentation issues in tools/eslint-rules/required-modules.js. This is the only file with indentation that does not conform to the stricter checks. --- tools/eslint-rules/required-modules.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/eslint-rules/required-modules.js b/tools/eslint-rules/required-modules.js index 3e4a8e8aadfc82..7691d5dd7d91a0 100644 --- a/tools/eslint-rules/required-modules.js +++ b/tools/eslint-rules/required-modules.js @@ -77,13 +77,13 @@ module.exports = function(context) { function(module) { return foundModules.indexOf(module === -1); } - ); + ); missingModules.forEach(function(moduleName) { context.report( node, 'Mandatory module "{{moduleName}}" must be loaded.', { moduleName: moduleName } - ); + ); }); } } From 9a2a30cb7a95c5b144a054cbb13165a23032da23 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 17 Jun 2017 22:37:09 -0700 Subject: [PATCH 2/3] tools: apply stricter indentation rules to tools ESLint 4.0.0 provides stricter (and more granular) indentation checking than previous versions. Apply the stricter indentation rules to the tools directory. --- tools/.eslintrc.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tools/.eslintrc.yaml diff --git a/tools/.eslintrc.yaml b/tools/.eslintrc.yaml new file mode 100644 index 00000000000000..e1405dd718bf0f --- /dev/null +++ b/tools/.eslintrc.yaml @@ -0,0 +1,12 @@ +## Tools-specific linter rules + +rules: + # Stylistic Issues + # http://eslint.org/docs/rules/#stylistic-issues + indent: [2, 2, {ArrayExpression: first, + CallExpression: {arguments: first}, + FunctionDeclaration: {parameters: first}, + FunctionExpression: {parameters: first}, + MemberExpression: off, + ObjectExpression: first, + SwitchCase: 1}] From 8b834c36366df6d742b0a76cf7821d9dbeef025f Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 19 Jun 2017 11:13:30 -0700 Subject: [PATCH 3/3] tools: fix error in custom ESLint rule Fix previously-unnoticed typo in `required-modules.js`. Refs: https://github.com/nodejs/node/pull/13758#discussion_r122582786 --- tools/eslint-rules/required-modules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/eslint-rules/required-modules.js b/tools/eslint-rules/required-modules.js index 7691d5dd7d91a0..4a444809b7115c 100644 --- a/tools/eslint-rules/required-modules.js +++ b/tools/eslint-rules/required-modules.js @@ -75,7 +75,7 @@ module.exports = function(context) { if (foundModules.length < requiredModules.length) { var missingModules = requiredModules.filter( function(module) { - return foundModules.indexOf(module === -1); + return foundModules.indexOf(module) === -1; } ); missingModules.forEach(function(moduleName) {