summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2017-11-28 16:56:45 -0500
committerJon Moss <me@jonathanmoss.me>2017-11-30 16:49:37 -0500
commit85e34b0c73794d3a241aa9e0c6139292f445c30a (patch)
tree7436d79e86df71550142b95736ef460336f37e46 /tools
parent701dc9a86e117a2da8a0db4aa45217a73b30ecce (diff)
downloadandroid-node-v8-85e34b0c73794d3a241aa9e0c6139292f445c30a.tar.gz
android-node-v8-85e34b0c73794d3a241aa9e0c6139292f445c30a.tar.bz2
android-node-v8-85e34b0c73794d3a241aa9e0c6139292f445c30a.zip
tools: add docs for prefer-util-format-errors rule
I had a little trouble understanding what the rule was trying to say, so am documenting what would pass/fail. PR-URL: https://github.com/nodejs/node/pull/17376 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/eslint-rules/prefer-util-format-errors.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/eslint-rules/prefer-util-format-errors.js b/tools/eslint-rules/prefer-util-format-errors.js
index c3f4819e43..f6993e6277 100644
--- a/tools/eslint-rules/prefer-util-format-errors.js
+++ b/tools/eslint-rules/prefer-util-format-errors.js
@@ -26,6 +26,11 @@ module.exports = {
if (!isArrowFunctionWithTemplateLiteral(msg))
return;
+ // Checks to see if order of arguments to function is the same as the
+ // order of them being concatenated in the template string. The idea is
+ // that if both match, then you can use `util.format`-style args.
+ // Would pass rule: (a, b) => `${b}${a}`.
+ // Would fail rule: (a, b) => `${a}${b}`, and needs to be rewritten.
const { expressions } = msg.body;
const hasSequentialParams = msg.params.every((param, index) => {
const expr = expressions[index];