Skip to content

Commit f0756f3

Browse files
committed
[eslint] enable no-shadow
1 parent e9b75e1 commit f0756f3

File tree

12 files changed

+64
-71
lines changed

12 files changed

+64
-71
lines changed

.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
"named": "never",
2626
}],
2727
"no-extra-semi": "error",
28+
"no-shadow": ["error", {
29+
"builtinGlobals": false,
30+
"hoist": "functions",
31+
"allow": []
32+
}],
2833
"no-undef": "error",
2934
"no-useless-escape": "error",
3035
"object-curly-newline": ["error", {

bin/tape

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ if (typeof opts.ignore === 'string') {
4747
var files = opts._.reduce(function (result, arg) {
4848
// If glob does not match, `files` will be an empty array.
4949
// Note: `glob.sync` may throw an error and crash the node process.
50-
var files = glob.sync(arg);
50+
var globFiles = glob.sync(arg);
5151

52-
if (!Array.isArray(files)) {
52+
if (!Array.isArray(globFiles)) {
5353
throw new TypeError('unknown error: glob.sync("' + arg + '") did not return an array or throw. Please report this.');
5454
}
5555

56-
return result.concat(files);
56+
return result.concat(globFiles);
5757
}, []).filter(function (file) {
5858
return !matcher || !matcher.shouldIgnore(file);
5959
}).map(function (file) {
@@ -75,13 +75,13 @@ function importFiles(hasSupport) {
7575

7676
tape.wait();
7777

78-
var promise = files.reduce(function (promise, file) {
78+
var filesPromise = files.reduce(function (promise, file) {
7979
return promise ? promise.then(function () {
8080
return importOrRequire(file);
8181
}) : importOrRequire(file);
8282
}, null);
8383

84-
return promise ? promise.then(function () { tape.run(); }) : tape.run();
84+
return filesPromise ? filesPromise.then(function () { tape.run(); }) : tape.run();
8585
}
8686

8787
// vim: ft=javascript

lib/test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,19 +423,19 @@ Test.prototype.skip = function skip(msg, extra) {
423423
});
424424
};
425425

426-
function assert(value, msg, extra) {
426+
var testAssert = function assert(value, msg, extra) {
427427
this._assert(value, {
428428
message: defined(msg, 'should be truthy'),
429429
operator: 'ok',
430430
expected: true,
431431
actual: value,
432432
extra: extra
433433
});
434-
}
434+
};
435435
Test.prototype.ok
436436
= Test.prototype['true']
437437
= Test.prototype.assert
438-
= assert;
438+
= testAssert;
439439

440440
function notOK(value, msg, extra) {
441441
this._assert(!value, {

test/async-await/async5.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ test('async5', async function myTest(t) {
3333
port: server.address().port,
3434
path: '/',
3535
method: 'GET'
36-
}, function (res) {
37-
cb(null, res);
36+
}, function (resp) {
37+
cb(null, resp);
3838
});
3939
req.end();
4040
})();

test/child_ordering.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ var test = require('../');
55
var childRan = false;
66

77
test('parent', function (t) {
8-
t.test('child', function (t) {
8+
t.test('child', function (st) {
99
childRan = true;
10-
t.pass('child ran');
11-
t.end();
10+
st.pass('child ran');
11+
st.end();
1212
});
1313
t.end();
1414
});
@@ -24,22 +24,22 @@ var grandChildRan = false;
2424
test('grandparent', function (t) {
2525
t.ok(!grandParentRan, 'grand parent ran twice');
2626
grandParentRan = true;
27-
t.test('parent', function (t) {
28-
t.ok(!parentRan, 'parent ran twice');
27+
t.test('parent', function (st) {
28+
st.ok(!parentRan, 'parent ran twice');
2929
parentRan = true;
30-
t.test('grandchild', function (t) {
31-
t.ok(!grandChildRan, 'grand child ran twice');
30+
st.test('grandchild', function (s2t) {
31+
s2t.ok(!grandChildRan, 'grand child ran twice');
3232
grandChildRan = true;
33-
t.pass('grand child ran');
34-
t.end();
33+
s2t.pass('grand child ran');
34+
s2t.end();
3535
});
36-
t.pass('parent ran');
37-
t.end();
36+
st.pass('parent ran');
37+
st.end();
3838
});
39-
t.test('other parent', function (t) {
40-
t.ok(parentRan, 'first parent runs before second parent');
41-
t.ok(grandChildRan, 'grandchild runs before second parent');
42-
t.end();
39+
t.test('other parent', function (st) {
40+
st.ok(parentRan, 'first parent runs before second parent');
41+
st.ok(grandChildRan, 'grandchild runs before second parent');
42+
st.end();
4343
});
4444
t.pass('grandparent ran');
4545
t.end();

test/nested2.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ var test = require('../');
44

55
test(function (t) {
66
var i = 0;
7-
t.test('setup', function (t) {
7+
t.test('setup', function (st) {
88
process.nextTick(function () {
9-
t.equal(i, 0, 'called once');
9+
st.equal(i, 0, 'called once');
1010
i++;
11-
t.end();
11+
st.end();
1212
});
1313
});
1414

1515

16-
t.test('teardown', function (t) {
17-
t.end();
16+
t.test('teardown', function (st) {
17+
st.end();
1818
});
1919

2020
t.end();

test/objectMode.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ tap.test('object results', function (assert) {
2424

2525
assert.equal(objects.length, 13);
2626

27-
forEach(objects, function (obj) {
28-
if (obj.type === 'assert') {
27+
forEach(objects, function (object) {
28+
if (object.type === 'assert') {
2929
asserts++;
30-
} else if (obj.type === 'test') {
31-
testIds.push(obj.id);
30+
} else if (object.type === 'test') {
31+
testIds.push(object.id);
3232

33-
if (obj.skip) {
33+
if (object.skip) {
3434
skips++;
35-
} else if (obj.todo) {
35+
} else if (object.todo) {
3636
todos++;
3737
}
38-
} else if (obj.type === 'end') {
39-
endIds.push(obj.text);
38+
} else if (object.type === 'end') {
39+
endIds.push(object.text);
4040
// test object should exist
41-
assert.notEqual(testIds.indexOf(obj.test), -1);
41+
assert.notEqual(testIds.indexOf(object.test), -1);
4242
}
4343
});
4444

test/promises/subTests.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ var test = require('../../');
44

55
if (typeof Promise === 'function' && typeof Promise.resolve === 'function') {
66
test('promise', function (t) {
7-
t.test('sub test that should fail', function (t) {
7+
t.test('sub test that should fail', function () {
88
return new Promise(function (resolve, reject) {
99
reject(new Error('rejection message'));
1010
});
1111
});
12-
t.test('sub test that should pass', function (t) {
13-
t.plan(1);
14-
t.ok(true);
12+
t.test('sub test that should pass', function (st) {
13+
st.plan(1);
14+
st.ok(true);
1515
});
1616
});
1717
} else {

test/skip.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ test.skip('skip this too', function (t) {
4444

4545
test('skip subtest', function (t) {
4646
ran++;
47-
t.test('skip this', { skip: true }, function (t) {
48-
t.fail('this should not even run');
49-
t.end();
47+
t.test('skip this', { skip: true }, function (st) {
48+
st.fail('this should not even run');
49+
st.end();
5050
});
5151
t.end();
5252
});

test/subcount.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ var test = require('../');
44

55
test('parent test', function (t) {
66
t.plan(2);
7-
t.test('first child', function (t) {
8-
t.plan(1);
9-
t.pass('pass first child');
7+
t.test('first child', function (st) {
8+
st.plan(1);
9+
st.pass('pass first child');
1010
});
1111

12-
t.test(function (t) {
13-
t.plan(1);
14-
t.pass('pass second child');
12+
t.test(function (st) {
13+
st.plan(1);
14+
st.pass('pass second child');
1515
});
1616
});

0 commit comments

Comments
 (0)