Skip to content

Commit

Permalink
chore: linting, bump deps (closes #1727)
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Jun 1, 2022
1 parent d7ca5dd commit a7a14d3
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 55 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"form-data": "^4.0.0",
"formidable": "^2.0.1",
"methods": "^1.1.2",
"mime": "^2.5.0",
"mime": "2.6.0",
"qs": "^6.10.3",
"readable-stream": "^3.6.0",
"semver": "^7.3.7"
Expand All @@ -37,8 +37,8 @@
"@babel/plugin-transform-runtime": "^7.18.2",
"@babel/preset-env": "^7.18.2",
"@babel/runtime": "^7.18.3",
"@commitlint/cli": "^17.0.1",
"@commitlint/config-conventional": "^17.0.0",
"@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^17.0.2",
"Base64": "^1.1.0",
"babelify": "^10.0.0",
"basic-auth-connect": "^1.0.0",
Expand All @@ -62,7 +62,7 @@
"multer": "^1.4.4",
"nyc": "^15.1.0",
"remark-cli": "^10.0.1",
"remark-preset-github": "^4.0.1",
"remark-preset-github": "^4.0.2",
"rimraf": "^3.0.2",
"should": "^13.2.3",
"should-http": "^0.1.1",
Expand Down Expand Up @@ -133,4 +133,4 @@
"test-http2": "npm run build && npm run lint && make test-node-http2"
},
"unpkg": "dist/superagent.min.js"
}
}
3 changes: 1 addition & 2 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ exports.Request = Request;
request.getXHR = () => {
if (
root.XMLHttpRequest &&
(!root.location ||
root.location.protocol !== 'file:')
(!root.location || root.location.protocol !== 'file:')
) {
return new XMLHttpRequest();
}
Expand Down
15 changes: 5 additions & 10 deletions src/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1365,18 +1365,13 @@ function isText(mime) {
// in the long run to have file that includes all binary
// content types from https://www.iana.org/assignments/media-types/media-types.xhtml
function isBinary(mime) {
let [ registry, name ] = mime.split('/');
let [registry, name] = mime.split('/');
if (registry) registry = registry.toLowerCase().trim();
if (name) name = name.toLowerCase().trim();
return [
'audio',
'font',
'image',
'video'
].includes(registry) || [
'gz',
'gzip',
].includes(name);
return (
['audio', 'font', 'image', 'video'].includes(registry) ||
['gz', 'gzip'].includes(name)
);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/node/parsers/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
exports['application/x-www-form-urlencoded'] = require('./urlencoded');
exports['application/json'] = require('./json');
exports.text = require('./text');

exports['application/json-seq'] = exports.text;

const binary = require('./image');
Expand Down
4 changes: 2 additions & 2 deletions src/request-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = RequestBase;
* @api public
*/

function RequestBase() { }
function RequestBase() {}

/**
* Clear previous timeout.
Expand Down Expand Up @@ -460,7 +460,7 @@ RequestBase.prototype.field = function (name, value, options) {
value = String(value);
}

//fix https://github.com/visionmedia/superagent/issues/1680
// fix https://github.com/visionmedia/superagent/issues/1680
if (options) this._getFormData().append(name, value, options);
else this._getFormData().append(name, value);

Expand Down
4 changes: 2 additions & 2 deletions test/node/agency.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ let http = require('http');

if (process.env.HTTP2_TEST) {
http = require('http2');
http.Http2ServerResponse.prototype._implicitHeader = function() {
http.Http2ServerResponse.prototype._implicitHeader = function () {
this.writeHead(this.statusCode);
}
};
}

app.use(cookieParser());
Expand Down
7 changes: 4 additions & 3 deletions test/node/utils.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use strict';
const assert = require('assert');
const utils = process.env.OLD_NODE_TEST === '1' ?
// eslint-disable-next-line node/no-missing-require
require('../../../utils') : require('../../lib/utils');
const utils =
process.env.OLD_NODE_TEST === '1'
? require('../../../utils')
: require('../../lib/utils');

describe('utils.type(str)', () => {
it('should return the mime type', () => {
Expand Down
1 change: 1 addition & 0 deletions test/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const assert = require('assert');
const getSetup = require('./support/setup');

const request = require('./support/client');

const binData = fs.readFileSync(`${__dirname}/node/fixtures/test.aac`);

describe('request', function () {
Expand Down
4 changes: 1 addition & 3 deletions test/support/express/responseDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,7 @@ function setMethods(res) {

res.set = res.header = function header(field, value_) {
if (arguments.length === 2) {
let value = Array.isArray(value_)
? value_.map((v) => String(v))
: String(value_);
let value = Array.isArray(value_) ? value_.map(String) : String(value_);

// add charset to content-type
if (field.toLowerCase() === 'content-type') {
Expand Down
2 changes: 1 addition & 1 deletion test/support/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ app.get('/image-as-octets', (request, res) => {
app.get('/binary-data', (request, res) => {
const binData = fs.readFileSync(`${__dirname}/../node/fixtures/test.aac`);
res.writeHead(200, { 'Content-type': 'audio/aac' });
res.end(binData, 'binary')
res.end(binData, 'binary');
});

app.get('/chunked-json', (request, res) => {
Expand Down
55 changes: 28 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@
"@babel/helper-validator-identifier" "^7.16.7"
to-fast-properties "^2.0.0"

"@commitlint/cli@^17.0.1":
"@commitlint/cli@^17.0.2":
version "17.0.2"
resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-17.0.2.tgz#57c925fb5f09b8e4a83448d94db291ddf7aa58ee"
integrity sha512-Axe89Js0YzGGd4gxo3JLlF7yIdjOVpG1LbOorGc6PfYF+drBh14PvarSDLzyd2TNqdylUCq9wb9/A88ZjIdyhA==
Expand All @@ -940,7 +940,7 @@
resolve-global "1.0.0"
yargs "^17.0.0"

"@commitlint/config-conventional@^17.0.0":
"@commitlint/config-conventional@^17.0.2":
version "17.0.2"
resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-17.0.2.tgz#298c9076e25c1e8760f04ee1be8ce43c856a4b72"
integrity sha512-MfP0I/JbxKkzo+HXWB7B3WstGS4BiniotU3d3xQ9gK8cR0DbeZ4MuyGCWF65YDyrcDTS3WlrJ3ndSPA1pqhoPw==
Expand Down Expand Up @@ -1351,7 +1351,7 @@
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==

"@typescript-eslint/eslint-plugin@*":
"@typescript-eslint/eslint-plugin@^5.24.0":
version "5.27.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.27.0.tgz#23d82a4f21aaafd8f69dbab7e716323bb6695cc8"
integrity sha512-DDrIA7GXtmHXr1VCcx9HivA39eprYBIFxbQEHI6NyraRDxCGpxAFiYQAT/1Y0vh1C+o2vfBiy4IuPoXxtTZCAQ==
Expand All @@ -1366,7 +1366,7 @@
semver "^7.3.7"
tsutils "^3.21.0"

"@typescript-eslint/parser@*":
"@typescript-eslint/parser@^5.24.0":
version "5.27.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.27.0.tgz#62bb091ed5cf9c7e126e80021bb563dcf36b6b12"
integrity sha512-8oGjQF46c52l7fMiPPvX4It3u3V3JipssqDfHQ2hcR0AeR8Zge+OYyKUCm5b70X72N1qXt0qgHenwN6Gc2SXZA==
Expand Down Expand Up @@ -3984,7 +3984,7 @@ eslint-config-xo-lass@^1.0.6:
resolved "https://registry.yarnpkg.com/eslint-config-xo-lass/-/eslint-config-xo-lass-1.0.6.tgz#6c27c2b694aea2e3ebc49ab50b4699ce747a5a5b"
integrity sha512-C/oftF0mIBWuuj9tiy41qS1EmpXryEu9oVmoujNOnC31Ouyhvj8rQ4RgRn7QMBGs0vSbShq9TAZyLb3rPh2Ozw==

eslint-config-xo-typescript@*:
eslint-config-xo-typescript@^0.51.1:
version "0.51.1"
resolved "https://registry.yarnpkg.com/eslint-config-xo-typescript/-/eslint-config-xo-typescript-0.51.1.tgz#0f9166edffb06cbb1dabddf84d295c843e43cd1f"
integrity sha512-bqUYpPLylgOtuueawFJnLFX/t2W6shKYR+IwbwBZhw9ivr2sLd+8I2vLfKDDzxMrHzij8bkdVoRoDLRvugQoXg==
Expand Down Expand Up @@ -7372,7 +7372,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==

mime@^2.5.0:
mime@2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367"
integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==
Expand Down Expand Up @@ -8009,7 +8009,7 @@ [email protected], on-finished@^2.3.0:
on-finished@~2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.2.1.tgz#5c85c1cc36299f78029653f667f27b6b99ebc029"
integrity sha1-XIXBzDYpn3gCllP2Z/J7a5nrwCk=
integrity sha512-9HvMYLv7im5uzOAcg1lon2cEUxycCF4OI+zPz1R/x3MvBv5s2F+DuxrGwkPe+UwvStDQpWbrkXfLZv12mHbl4A==
dependencies:
ee-first "1.1.0"

Expand All @@ -8021,7 +8021,7 @@ on-headers@~1.0.0, on-headers@~1.0.2:
[email protected], [email protected], once@^1.3.0, once@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==
dependencies:
wrappy "1"

Expand Down Expand Up @@ -8054,19 +8054,19 @@ open@^8.4.0:
[email protected]:
version "1.4.0"
resolved "https://registry.yarnpkg.com/opener/-/opener-1.4.0.tgz#d11f86eeeb076883735c9d509f538fe82d10b941"
integrity sha1-0R+G7usHaINzXJ1Qn1OP6C0QuUE=
integrity sha512-/fnSWlsKW3VxYs+N44uxUrjhD+pOMo+tptVK+Y0BUky6ECI6suCAKKunNGBgo0HAPY2dLO4DEf7YQuIid8izwQ==

[email protected]:
version "0.3.4"
resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.3.4.tgz#4d6d0bd71ffad0da4ba4f6d876d5eeb04e07480b"
integrity sha1-TW0L1x/60NpLpPbYdtXusE4HSAs=
integrity sha512-CM668OmXLjrLKlVPze/bc0BIOZ0qoM5gWwEVurkjXPv6cgkybJ2TSt86nmaud+niwPfWHLOcgbbcRtA5zJgOIQ==
dependencies:
wordwrap "~0.0.2"

optimist@~0.3, optimist@~0.3.5:
version "0.3.7"
resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.3.7.tgz#c90941ad59e4273328923074d2cf2e7cbc6ec0d9"
integrity sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=
integrity sha512-TCx0dXQzVtSCg2OgY/bO9hjM9cV4XYx09TVK+s3+FhkjT6LovsLe+pPMzpWf+6yXK/hUizs2gUoTw3jHM0VaTQ==
dependencies:
wordwrap "~0.0.2"

Expand Down Expand Up @@ -8097,17 +8097,17 @@ optionator@^0.9.1:
os-browserify@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.1.2.tgz#49ca0293e0b19590a5f5de10c7f265a617d8fe54"
integrity sha1-ScoCk+CxlZCl9d4Qx/JlphfY/lQ=
integrity sha512-aZicJZccvxWOZ0Bja2eAch2L8RIJWBuRYmM8Gwl/JjNtRltH0Itcz4eH/ESyuIWfse8cc93ZCf0XrzhXK2HEDA==

os-browserify@~0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27"
integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=
integrity sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==

[email protected]:
version "0.0.3"
resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.0.3.tgz#cd6ad8ddb290915ad9e22765576025d411f29cb6"
integrity sha1-zWrY3bKQkVrZ4idlV2Al1BHynLY=
integrity sha512-VBk1bfdaO4gh3OWO8LBuDY2alp0buL8YzQ6t13xyc8PQPrnUg5AgQvINQx3UkS4dom8UGCL597q4Y2+M4TPvmw==

outpipe@^1.1.0:
version "1.1.1"
Expand Down Expand Up @@ -8962,13 +8962,14 @@ remark-heading-gap@^4.0.0:
resolved "https://registry.yarnpkg.com/remark-heading-gap/-/remark-heading-gap-4.0.0.tgz#cb1a24c20f3f2752b409bbfc5dc8776a59d79c42"
integrity sha512-7kHv4qauAo/bJa73D/S9pU6sdJpLZS/6M75bJ5HYRLs6VRwpFz7XEReBP7tlPQ2CapD//qLd9LVRJ4ShieDbIg==

remark-license@niftylettuce/remark-license:
version "4.0.1"
resolved "https://codeload.github.com/niftylettuce/remark-license/tar.gz/17ecb8f64f8f6082414d14f9267a12764e6ddbfb"
remark-license@5:
version "5.2.0"
resolved "https://registry.yarnpkg.com/remark-license/-/remark-license-5.2.0.tgz#904b89b37e1745e84f48acf7760b2b83b7cda2a3"
integrity sha512-1jrQYFS/xVN4M6LO4WJuWPdUCU/g6PnwCDKlI2RDfQP2EKy+8eEORU8XZ13rAws3q0McFKzYm20QNCdkH9Rbnw==
dependencies:
mdast-util-heading-range "^2.0.0"
parse-author "^2.0.0"
spdx-license-list "^3.0.1"
spdx-license-list "^6.0.0"

remark-lint-blockquote-indentation@^2.0.1:
version "2.0.1"
Expand Down Expand Up @@ -9470,16 +9471,16 @@ remark-parse@^10.0.0:
mdast-util-from-markdown "^1.0.0"
unified "^10.0.0"

remark-preset-github@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/remark-preset-github/-/remark-preset-github-4.0.1.tgz#146dc120d6c6e73116ad8e8fb5dec76a85ad5083"
integrity sha512-2fwgL9484VA6WCc9EL3wNllo3VuP+FT84SZJncj4tAb7QsRUJwaDkh+3c6Htv19zSRfxCJ9PIikzyEuCrS7Gtw==
remark-preset-github@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/remark-preset-github/-/remark-preset-github-4.0.2.tgz#733b5add733ff0c551448d0c21b53c32377a332e"
integrity sha512-3w8hUUgo1iQf5SzxyREw18D/gmx/LP+dCLOaCt0XSGATKQfSyVfKxggIjdEZRHSq1Uh4FCKzqHjYzSqX6k/h/Q==
dependencies:
remark-comment-config "^6.0.0"
remark-contributors "^5.0.1"
remark-gfm "^1.0.0"
remark-heading-gap "^4.0.0"
remark-license niftylettuce/remark-license
remark-license "5"
remark-lint-blockquote-indentation "^2.0.1"
remark-lint-checkbox-character-style "^3.0.0"
remark-lint-checkbox-content-indent "^3.0.0"
Expand Down Expand Up @@ -10295,10 +10296,10 @@ spdx-license-ids@^3.0.0:
resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz#50c0d8c40a14ec1bf449bae69a0ea4685a9d9f95"
integrity sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==

spdx-license-list@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/spdx-license-list/-/spdx-license-list-3.0.1.tgz#163d72123e00f4f8bd6e18125696b009f1248ff5"
integrity sha1-Fj1yEj4A9Pi9bhgSVpawCfEkj/U=
spdx-license-list@^6.0.0:
version "6.5.0"
resolved "https://registry.yarnpkg.com/spdx-license-list/-/spdx-license-list-6.5.0.tgz#1624b9cd6c517ff8d697610e6c22d7f5b7c63d28"
integrity sha512-28O9GgFrMg2Wp8tVML0Zk+fnXaECy7UbB6pxo+93whHay/nqPyEdM07Cx6B4+j2pniUZTYr57OaIOyNTxsTwtw==

split-string@^3.0.1, split-string@^3.0.2:
version "3.1.0"
Expand Down

0 comments on commit a7a14d3

Please sign in to comment.