no declare vars with comma, one line only one statement

pull/300/head
LouisLam 3 years ago
parent fa549cb80e
commit a41534ca60

@ -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 }]
}, },
} }

@ -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;
@ -49,7 +48,7 @@ function Ping(host, options) {
this._args = (options.args) ? options.args : [ "-n", "-t", "2", "-c", "1", host ]; this._args = (options.args) ? options.args : [ "-n", "-t", "2", "-c", "1", host ];
this._regmatch = /=([0-9.]+?) ms/; this._regmatch = /=([0-9.]+?) ms/;
} else if (FBSD) { } else if (FBSD) {
this._bin = "/sbin/ping"; this._bin = "/sbin/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));

Loading…
Cancel
Save