Skip to content

Commit

Permalink
[eslint] fix some inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 2, 2021
1 parent e8255cf commit 7ca56eb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .eslintrc
Expand Up @@ -20,6 +20,11 @@
}],
"no-undef": "error",
"no-useless-escape": "error",
"operator-linebreak": ["error", "before"],
"space-unary-ops": ["error", {
"words": false,
"nonwords": false,
}],
"strict": "error",
},
"overrides": [
Expand Down
6 changes: 3 additions & 3 deletions lib/results.js
Expand Up @@ -119,11 +119,11 @@ Results.prototype._watch = function (t) {
return;
}
write(encodeResult(res, self.count + 1));
self.count ++;
self.count++;

if (res.ok || res.todo) self.pass ++;
if (res.ok || res.todo) self.pass++;
else {
self.fail ++;
self.fail++;
self.emit('fail');
}
});
Expand Down
11 changes: 5 additions & 6 deletions lib/test.js
Expand Up @@ -47,7 +47,7 @@ var getTestArgs = function (name_, opts_, cb_) {
};

function Test(name_, opts_, cb_) {
if (! (this instanceof Test)) {
if (!(this instanceof Test)) {
return new Test(name_, opts_, cb_);
}

Expand Down Expand Up @@ -101,9 +101,9 @@ Test.prototype.run = function () {
var callbackReturn = this._cb(this);

if (
typeof Promise === 'function' &&
callbackReturn &&
typeof callbackReturn.then === 'function'
typeof Promise === 'function'
&& callbackReturn
&& typeof callbackReturn.then === 'function'
) {
var self = this;
Promise.resolve(callbackReturn).then(function onResolve() {
Expand Down Expand Up @@ -205,8 +205,7 @@ Test.prototype._end = function (err) {
};

Test.prototype._exit = function () {
if (this._plan !== undefined &&
!this._planError && this.assertCount !== this._plan) {
if (this._plan !== undefined && !this._planError && this.assertCount !== this._plan) {
this._planError = true;
this.fail('plan != count', {
expected: this._plan,
Expand Down
16 changes: 8 additions & 8 deletions test/async-await.js
Expand Up @@ -37,7 +37,7 @@ tap.test('async2', function (t) {
var stdout = r.stdout.toString('utf8');
var lines = stdout.split('\n');
lines = lines.filter(function (line) {
return ! /^(\s+)at(\s+)<anonymous>$/.test(line);
return !/^(\s+)at(\s+)<anonymous>$/.test(line);
});
stdout = lines.join('\n');

Expand Down Expand Up @@ -180,9 +180,9 @@ tap.test('sync-error', function (t) {
var stderr = r.stderr.toString('utf8');
var lines = stderr.split('\n');
lines = lines.filter(function (line) {
return ! /\(timers.js:/.test(line) &&
! /\(internal\/timers.js:/.test(line) &&
! /Immediate\.next/.test(line);
return !/\(timers.js:/.test(line)
&& !/\(internal\/timers.js:/.test(line)
&& !/Immediate\.next/.test(line);
});
stderr = lines.join('\n');

Expand All @@ -207,7 +207,7 @@ tap.test('async-error', function (t) {
var stdout = r.stdout.toString('utf8');
var lines = stdout.split('\n');
lines = lines.filter(function (line) {
return ! /^(\s+)at(\s+)<anonymous>$/.test(line);
return !/^(\s+)at(\s+)<anonymous>$/.test(line);
});
stdout = lines.join('\n');

Expand Down Expand Up @@ -235,9 +235,9 @@ tap.test('async-error', function (t) {
var stderr = r.stderr.toString('utf8');
var lines = stderr.split('\n');
lines = lines.filter(function (line) {
return ! /\(timers.js:/.test(line) &&
! /\(internal\/timers.js:/.test(line) &&
! /Immediate\.next/.test(line);
return !/\(timers.js:/.test(line)
&& !/\(internal\/timers.js:/.test(line)
&& !/Immediate\.next/.test(line);
});
stderr = lines.join('\n');

Expand Down
2 changes: 1 addition & 1 deletion test/max_listeners/source.js
Expand Up @@ -2,6 +2,6 @@

var test = require('../../');

for (var i = 0; i < 11; i ++) {
for (var i = 0; i < 11; i++) {
test(function (t) { t.ok(true, 'true is truthy'); t.end(); });
}

0 comments on commit 7ca56eb

Please sign in to comment.