From 8d7aa2167f7b87c4143a01be41096aad4c3f0936 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 16 Sep 2018 20:49:11 -0700 Subject: [PATCH] tools: synchronize deepStrictEqual() message rules Update ESLint config to include a rule about assert.deepStrictEqual() messages and string literals. The rule is included in lib and test, but should be included everywhere else as well. PR-URL: https://github.com/nodejs/node/pull/22887 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Teddy Katz Reviewed-By: Richard Lau --- .eslintrc.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index 99cef88669ba79..8aa090e889d70b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -159,6 +159,10 @@ module.exports = { // and test/.eslintrc.yaml. 'no-restricted-syntax': [ 'error', + { + selector: "CallExpression[callee.object.name='assert'][callee.property.name='deepStrictEqual'][arguments.2.type='Literal']", + message: 'Do not use a literal for the third argument of assert.deepStrictEqual()' + }, { selector: "CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']", message: 'Please replace `assert.doesNotThrow()` and add a comment next to the code instead.'