From 7a144e030a0896c64a020a0b34ce165858893323 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 24 May 2019 10:16:16 -0700 Subject: [PATCH] tools: edit .eslintrc.js for minor maintainability improvements * Add a comment explaining the Module._findPath() hacks so that someone else doesn't do what I do and try to remove them because they seem unnecessary for `make lint` and friends. * Add a trailing comma for consistency with the rest of the file. --- .eslintrc.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 55b61cea63be6c..32c85741802f39 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -8,6 +8,10 @@ const path = require('path'); const NodePlugin = require('./tools/node_modules/eslint-plugin-node-core'); NodePlugin.RULES_DIR = path.resolve(__dirname, 'tools', 'eslint-rules'); +// The Module._findPath() monkeypatching is to make it so that ESLint will work +// if invoked by a globally-installed ESLint or ESLint installed elsewhere +// rather than the one we ship. This makes it possible for IDEs to lint files +// with our rules while people edit them. const ModuleFindPath = Module._findPath; const hacks = [ 'eslint-plugin-node-core', @@ -236,7 +240,7 @@ module.exports = { { selector: "CallExpression[callee.property.name='strictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])", message: 'The first argument should be the `actual`, not the `expected` value.', - } + }, ], /* eslint-enable max-len */ 'no-return-await': 'error',