Skip to content

Commit 7ca56eb

Browse files
committed
[eslint] fix some inconsistencies
1 parent e8255cf commit 7ca56eb

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
}],
2121
"no-undef": "error",
2222
"no-useless-escape": "error",
23+
"operator-linebreak": ["error", "before"],
24+
"space-unary-ops": ["error", {
25+
"words": false,
26+
"nonwords": false,
27+
}],
2328
"strict": "error",
2429
},
2530
"overrides": [

lib/results.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ Results.prototype._watch = function (t) {
119119
return;
120120
}
121121
write(encodeResult(res, self.count + 1));
122-
self.count ++;
122+
self.count++;
123123

124-
if (res.ok || res.todo) self.pass ++;
124+
if (res.ok || res.todo) self.pass++;
125125
else {
126-
self.fail ++;
126+
self.fail++;
127127
self.emit('fail');
128128
}
129129
});

lib/test.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var getTestArgs = function (name_, opts_, cb_) {
4747
};
4848

4949
function Test(name_, opts_, cb_) {
50-
if (! (this instanceof Test)) {
50+
if (!(this instanceof Test)) {
5151
return new Test(name_, opts_, cb_);
5252
}
5353

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

103103
if (
104-
typeof Promise === 'function' &&
105-
callbackReturn &&
106-
typeof callbackReturn.then === 'function'
104+
typeof Promise === 'function'
105+
&& callbackReturn
106+
&& typeof callbackReturn.then === 'function'
107107
) {
108108
var self = this;
109109
Promise.resolve(callbackReturn).then(function onResolve() {
@@ -205,8 +205,7 @@ Test.prototype._end = function (err) {
205205
};
206206

207207
Test.prototype._exit = function () {
208-
if (this._plan !== undefined &&
209-
!this._planError && this.assertCount !== this._plan) {
208+
if (this._plan !== undefined && !this._planError && this.assertCount !== this._plan) {
210209
this._planError = true;
211210
this.fail('plan != count', {
212211
expected: this._plan,

test/async-await.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tap.test('async2', function (t) {
3737
var stdout = r.stdout.toString('utf8');
3838
var lines = stdout.split('\n');
3939
lines = lines.filter(function (line) {
40-
return ! /^(\s+)at(\s+)<anonymous>$/.test(line);
40+
return !/^(\s+)at(\s+)<anonymous>$/.test(line);
4141
});
4242
stdout = lines.join('\n');
4343

@@ -180,9 +180,9 @@ tap.test('sync-error', function (t) {
180180
var stderr = r.stderr.toString('utf8');
181181
var lines = stderr.split('\n');
182182
lines = lines.filter(function (line) {
183-
return ! /\(timers.js:/.test(line) &&
184-
! /\(internal\/timers.js:/.test(line) &&
185-
! /Immediate\.next/.test(line);
183+
return !/\(timers.js:/.test(line)
184+
&& !/\(internal\/timers.js:/.test(line)
185+
&& !/Immediate\.next/.test(line);
186186
});
187187
stderr = lines.join('\n');
188188

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

@@ -235,9 +235,9 @@ tap.test('async-error', function (t) {
235235
var stderr = r.stderr.toString('utf8');
236236
var lines = stderr.split('\n');
237237
lines = lines.filter(function (line) {
238-
return ! /\(timers.js:/.test(line) &&
239-
! /\(internal\/timers.js:/.test(line) &&
240-
! /Immediate\.next/.test(line);
238+
return !/\(timers.js:/.test(line)
239+
&& !/\(internal\/timers.js:/.test(line)
240+
&& !/Immediate\.next/.test(line);
241241
});
242242
stderr = lines.join('\n');
243243

test/max_listeners/source.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

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

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

0 commit comments

Comments
 (0)