diff options
author | Rich Trott <rtrott@gmail.com> | 2021-03-26 09:17:23 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-05-01 13:25:29 +0300 |
commit | 4254315ebe3c6e8725562fe695d6a6893ca89ecb (patch) | |
tree | 4ca1e52f34a848f4028e572e463932bc6bab4b7a /lib | |
parent | 7b0e4e23f265dbc013a0e4e797959f35a6c21c97 (diff) |
tools: improve valid-typeof lint rule
Require that `typeof` comparisons be to string literals.
PR-URL: https://github.com/nodejs/node/pull/37924
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/encoding.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js index 5226bf518da..8cc9bc13fbb 100644 --- a/lib/internal/encoding.js +++ b/lib/internal/encoding.js @@ -63,6 +63,7 @@ function validateDecoder(obj) { } function validateArgument(prop, expected, propName, expectedName) { + // eslint-disable-next-line valid-typeof if (typeof prop !== expected) throw new ERR_INVALID_ARG_TYPE(propName, expectedName, prop); } |