no declare vars with comma, one line only one statement

This commit is contained in:
LouisLam 2021-08-31 22:08:05 +08:00
parent fa549cb80e
commit a41534ca60
2 changed files with 17 additions and 14 deletions

View file

@ -77,6 +77,8 @@ module.exports = {
"no-empty": ["error", { "no-empty": ["error", {
"allowEmptyCatch": true "allowEmptyCatch": true
}], }],
"no-control-regex": "off" "no-control-regex": "off",
"one-var": ["error", "never"],
"max-statements-per-line": ["error", { "max": 1 }]
}, },
} }

View file

@ -1,14 +1,13 @@
// https://github.com/ben-bradley/ping-lite/blob/master/ping-lite.js // https://github.com/ben-bradley/ping-lite/blob/master/ping-lite.js
// Fixed on Windows // Fixed on Windows
const net = require("net"); const net = require("net");
const spawn = require("child_process").spawn, const spawn = require("child_process").spawn;
events = require("events"), const events = require("events");
fs = require("fs"), const fs = require("fs");
WIN = /^win/.test(process.platform), const WIN = /^win/.test(process.platform);
LIN = /^linux/.test(process.platform), const LIN = /^linux/.test(process.platform);
MAC = /^darwin/.test(process.platform); const MAC = /^darwin/.test(process.platform);
FBSD = /^freebsd/.test(process.platform); const FBSD = /^freebsd/.test(process.platform);
const { debug } = require("../src/util");
module.exports = Ping; module.exports = Ping;
@ -88,7 +87,9 @@ Ping.prototype.send = function (callback) {
return self.emit("result", ms); return self.emit("result", ms);
}; };
let _ended, _exited, _errored; let _ended;
let _exited;
let _errored;
this._ping = spawn(this._bin, this._args); // spawn the binary this._ping = spawn(this._bin, this._args); // spawn the binary
@ -120,9 +121,9 @@ Ping.prototype.send = function (callback) {
}); });
function onEnd() { function onEnd() {
let stdout = this.stdout._stdout, let stdout = this.stdout._stdout;
stderr = this.stderr._stderr, let stderr = this.stderr._stderr;
ms; let ms;
if (stderr) { if (stderr) {
return callback(new Error(stderr)); return callback(new Error(stderr));