Skip to content

Commit 6153f6d

Browse files
authored
chore: eslint upgrade (#325)
1 parent 96aad0e commit 6153f6d

9 files changed

+1229
-1624
lines changed

package-lock.json

+814-1,209
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
}
3939
},
4040
"devDependencies": {
41-
"@cordova/eslint-config": "^3.0.0"
41+
"@cordova/eslint-config": "^4.0.0"
4242
}
4343
}

src/windows/FileTransferProxy.js

+85-85
Large diffs are not rendered by default.

tests/hooks/after_prepare.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
*
2222
*/
2323

24-
var path = require('path');
25-
var fs = require('fs');
24+
const path = require('path');
25+
const fs = require('fs');
2626

2727
module.exports = function (context) {
2828
function main () {
2929
// get the file transfer server address from the specified variables
30-
var fileTransferServerAddress = getFileTransferServerAddress(context) || getDefaultFileTransferServerAddress(context);
30+
const fileTransferServerAddress = getFileTransferServerAddress(context) || getDefaultFileTransferServerAddress(context);
3131
console.log('Tests will use the following file transfer server address: ' + fileTransferServerAddress);
3232
console.log(
3333
'If you\'re using [email protected] and the above address is wrong at "platform add", don\'t worry, it\'ll fix itself on "cordova run" or "cordova prepare".'
@@ -38,10 +38,10 @@ module.exports = function (context) {
3838
}
3939

4040
function getDefaultFileTransferServerAddress (context) {
41-
var address = null;
42-
var configNodes = context.opts.plugin.pluginInfo._et._root._children;
41+
let address = null;
42+
const configNodes = context.opts.plugin.pluginInfo._et._root._children;
4343

44-
for (var node in configNodes) {
44+
for (const node in configNodes) {
4545
if (configNodes[node].attrib.name === 'FILETRANSFER_SERVER_ADDRESS') {
4646
address = configNodes[node].attrib.default;
4747
}
@@ -51,13 +51,13 @@ module.exports = function (context) {
5151
}
5252

5353
function getFileTransferServerAddress (context) {
54-
var platformJsonFile = path.join(
54+
const platformJsonFile = path.join(
5555
context.opts.projectRoot,
5656
'platforms',
5757
context.opts.platforms[0],
5858
context.opts.platforms[0] + '.json'
5959
);
60-
var platformJson = JSON.parse(fs.readFileSync(platformJsonFile, 'utf8'));
60+
const platformJson = JSON.parse(fs.readFileSync(platformJsonFile, 'utf8'));
6161

6262
if (
6363
platformJson &&
@@ -72,12 +72,12 @@ module.exports = function (context) {
7272
}
7373

7474
function writeFileTransferOptions (address, context) {
75-
for (var p in context.opts.paths) {
76-
var ftOpts = {
75+
for (const p in context.opts.paths) {
76+
const ftOpts = {
7777
serverAddress: address
7878
};
79-
var ftOptsString = JSON.stringify(ftOpts);
80-
var ftOptsFile = path.join(context.opts.paths[p], 'fileTransferOpts.json');
79+
const ftOptsString = JSON.stringify(ftOpts);
80+
const ftOptsFile = path.join(context.opts.paths[p], 'fileTransferOpts.json');
8181
fs.writeFileSync(ftOptsFile, ftOptsString, 'utf8');
8282
}
8383
}

tests/server/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const http = require('http');
22
const stringify = require('json-stringify-safe');
33
const Busboy = require('busboy');
4-
var { Iconv } = require('iconv');
4+
const { Iconv } = require('iconv');
55

66
const port = process.env.PORT || 5000;
77
const DIRECT_UPLOAD_LIMIT = 85; // bytes
@@ -18,7 +18,7 @@ function parseMultipartForm (req, res, finishCb) {
1818
const busboy = new Busboy({ headers: req.headers });
1919

2020
busboy.on('file', function (fieldname, file, filename, encoding, mimetype) {
21-
var currentFile = { size: 0 };
21+
const currentFile = { size: 0 };
2222

2323
file.on('data', function (data) {
2424
currentFile.name = filename;
@@ -62,7 +62,7 @@ function respondWithParsedForm (req, res, parseResultObj) {
6262

6363
function respondWithParsedFormNonUTF (req, res, parseResultObj) {
6464
parseResultObj.latin1Symbols = LATIN1_SYMBOLS;
65-
var buffer = iconv.convert(stringify(parseResultObj));
65+
const buffer = iconv.convert(stringify(parseResultObj));
6666
res.writeHead(200, { 'Content-Type': 'application/json' });
6767
res.write(buffer);
6868
res.end('\n');
@@ -111,7 +111,7 @@ http.createServer(function (req, res) {
111111
parseMultipartForm(req, res, respondWithParsedForm);
112112
} else {
113113
console.log('direct upload');
114-
var body = '';
114+
let body = '';
115115
req.on('data', function (chunk) {
116116
body += chunk;
117117
if (body.length > DIRECT_UPLOAD_LIMIT) {

0 commit comments

Comments
 (0)