From df0cb440773e5540d926065f9d1a9e3d066173cd Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 21 Sep 2019 10:08:42 -0700 Subject: [PATCH] [Dev Deps] update `eslint` --- dist/qs.js | 12 ++++++------ lib/stringify.js | 14 +++++++------- package.json | 2 +- test/parse.js | 2 -- test/stringify.js | 4 ++-- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/dist/qs.js b/dist/qs.js index 08335520..6d31bda2 100644 --- a/dist/qs.js +++ b/dist/qs.js @@ -114,11 +114,11 @@ var parseValues = function parseQueryStringValues(str, options) { var key, val; if (pos === -1) { - key = options.decoder(part, defaults.decoder, charset); + key = options.decoder(part, defaults.decoder, charset, 'key'); val = options.strictNullHandling ? null : ''; } else { - key = options.decoder(part.slice(0, pos), defaults.decoder, charset); - val = options.decoder(part.slice(pos + 1), defaults.decoder, charset); + key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key'); + val = options.decoder(part.slice(pos + 1), defaults.decoder, charset, 'value'); } if (val && options.interpretNumericEntities && charset === 'iso-8859-1') { @@ -367,7 +367,7 @@ var stringify = function stringify( // eslint-disable-line func-name-matching if (obj === null) { if (strictNullHandling) { - return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset) : prefix; + return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key') : prefix; } obj = ''; @@ -375,8 +375,8 @@ var stringify = function stringify( // eslint-disable-line func-name-matching if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) { if (encoder) { - var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset); - return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset))]; + var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key'); + return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value'))]; } return [formatter(prefix) + '=' + formatter(String(obj))]; } diff --git a/lib/stringify.js b/lib/stringify.js index 96e34d0f..72ded14a 100644 --- a/lib/stringify.js +++ b/lib/stringify.js @@ -5,14 +5,14 @@ var formats = require('./formats'); var has = Object.prototype.hasOwnProperty; var arrayPrefixGenerators = { - brackets: function brackets(prefix) { // eslint-disable-line func-name-matching + brackets: function brackets(prefix) { return prefix + '[]'; }, comma: 'comma', - indices: function indices(prefix, key) { // eslint-disable-line func-name-matching + indices: function indices(prefix, key) { return prefix + '[' + key + ']'; }, - repeat: function repeat(prefix) { // eslint-disable-line func-name-matching + repeat: function repeat(prefix) { return prefix; } }; @@ -39,22 +39,22 @@ var defaults = { formatter: formats.formatters[defaultFormat], // deprecated indices: false, - serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching + serializeDate: function serializeDate(date) { return toISO.call(date); }, skipNulls: false, strictNullHandling: false }; -var isNonNullishPrimitive = function isNonNullishPrimitive(v) { // eslint-disable-line func-name-matching +var isNonNullishPrimitive = function isNonNullishPrimitive(v) { return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || typeof v === 'symbol' - || typeof v === 'bigint'; // eslint-disable-line valid-typeof + || typeof v === 'bigint'; }; -var stringify = function stringify( // eslint-disable-line func-name-matching +var stringify = function stringify( object, prefix, generateArrayPrefix, diff --git a/package.json b/package.json index 29d24086..9fd351ed 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "browserify": "^16.5.0", "covert": "^1.1.1", "eclint": "^2.8.1", - "eslint": "^6.3.0", + "eslint": "^6.4.0", "evalmd": "^0.0.19", "for-each": "^0.3.3", "has-symbols": "^1.0.0", diff --git a/test/parse.js b/test/parse.js index 138e6625..a473b634 100644 --- a/test/parse.js +++ b/test/parse.js @@ -629,7 +629,6 @@ test('parse()', function (t) { }); t.test('prefers an iso-8859-1 charset specified by the utf8 sentinel to a default charset of utf-8', function (st) { - // eslint-disable-next-line quote-props st.deepEqual(qs.parse('utf8=' + urlEncodedNumCheckmark + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true, charset: 'utf-8' }), { 'ø': 'ø' }); st.end(); }); @@ -650,7 +649,6 @@ test('parse()', function (t) { }); t.test('uses the utf8 sentinel to switch to iso-8859-1 when no default charset is given', function (st) { - // eslint-disable-next-line quote-props st.deepEqual(qs.parse('utf8=' + urlEncodedNumCheckmark + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true }), { 'ø': 'ø' }); st.end(); }); diff --git a/test/stringify.js b/test/stringify.js index e36272cd..760d08cb 100644 --- a/test/stringify.js +++ b/test/stringify.js @@ -42,10 +42,10 @@ test('stringify()', function (t) { }); t.test('stringifies bigints', { skip: !hasBigInt }, function (st) { - var three = BigInt(3); // eslint-disable-line new-cap + var three = BigInt(3); var encodeWithN = function (value, defaultEncoder, charset) { var result = defaultEncoder(value, defaultEncoder, charset); - return typeof value === 'bigint' ? result + 'n' : result; // eslint-disable-line valid-typeof + return typeof value === 'bigint' ? result + 'n' : result; }; st.equal(qs.stringify(three), ''); st.equal(qs.stringify([three]), '0=3');