Skip to content

Commit 386605e

Browse files
committed
Fix lint errors
1 parent 28f351d commit 386605e

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

tools/search/create/lib/extractor.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,30 @@ function getSectionNodes( ast, name ) {
2323
var nodes = [];
2424
var scope = null;
2525
visit( ast, replacer );
26+
2627
/**
2728
* Replaces AST by the nodes of the specified section.
2829
*
2930
* @private
3031
* @param {Node} node - reference node
3132
* @param {number} index - position of `node` in `parent`
32-
* @param {Node} - parent - parent of `node`
33+
* @param {Node} parent - parent of `node`
3334
*/
3435
function replacer( node, index, parent ) {
35-
var type = isSectionTag( node );
36+
var type;
37+
var arr;
38+
39+
type = isSectionTag( node );
3640
if ( scope && parent === scope ) {
3741
if ( type === 'end' ) {
3842
if ( nodes ) {
3943
// Replace scope by nodes belonging to the given section...
40-
nodes = [ { type: 'root', children: nodes } ];
41-
splice.apply( scope.children, [ 0, scope.children.length ].concat( nodes ) );
44+
nodes = [{
45+
'type': 'root',
46+
'children': nodes
47+
}];
48+
arr = [ 0, scope.children.length ].concat( nodes );
49+
splice.apply( scope.children, arr );
4250
}
4351
scope = null;
4452
nodes = [];
@@ -66,7 +74,7 @@ function getSectionNodes( ast, name ) {
6674
) {
6775
return 'start';
6876
}
69-
else if (
77+
if (
7078
node.type === 'html' &&
7179
node.value === '<!-- /.'+name+' -->'
7280
) {
@@ -84,7 +92,7 @@ function getSectionNodes( ast, name ) {
8492
*
8593
* @private
8694
* @param {string} name - section name
87-
* @param {Function} remark attacher function
95+
* @returns {Function} remark attacher function
8896
*/
8997
function extractor( name ) {
9098
/**
@@ -96,17 +104,18 @@ function extractor( name ) {
96104
function transformer( ast ) {
97105
getSectionNodes( ast, name );
98106
}
107+
return attacher;
99108

100109
/**
101110
* Attach a plugin to a remark processor in order to extract the specified section.
102111
*
103112
* @private
104113
* @returns {Function} transformer
105114
*/
106-
return function attacher() {
115+
function attacher() {
107116
return transformer;
108-
}; // end FUNCTION attacher()
109-
};
117+
}
118+
}
110119

111120

112121
// EXPORTS //

tools/test-cov/tape-istanbul/lib/create_require.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,26 @@ function createRequire( id ) {
4545
*
4646
* @private
4747
* @param {string} path - module id
48+
* @returns {void}
4849
*/
4950
function require( path ) {
5051
try {
5152
return module.require( path );
5253
} finally {}
5354
}
5455

56+
require.resolve = resolve;
57+
5558
/**
5659
* Attempts to resolve a module.
5760
*
5861
* @private
5962
* @param {string} name - module
6063
* @returns {string} module filepath
6164
*/
62-
require.resolve = function resolve( name ) {
65+
function resolve( name ) {
6366
return resolveFilename( name, module, false );
64-
}; // end FUNCTION resolve()
67+
}
6568

6669
// Application entry point:
6770
require.main = main;

tools/test-cov/tape-istanbul/lib/runner.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ function runner() {
9696
* @private
9797
* @param {(Error|null)} error - error object
9898
* @param {StringArray} files - absolute filepaths for filenames which matched the glob pattern
99+
* @returns {void}
99100
*/
100101
function onGlob( error, files ) {
101102
if ( error ) {
@@ -123,7 +124,7 @@ function runner() {
123124
count = 0;
124125
cache = {};
125126
for ( i = 0; i < files.length; i++ ) {
126-
cb = onRead( files[ i ], onData );
127+
cb = onReadFactory( files[ i ], onData );
127128
readFile( files[ i ], opts, cb );
128129
}
129130
/**
@@ -148,21 +149,24 @@ function runner() {
148149
* @private
149150
* @param {string} id - file id
150151
* @param {Callback} clbk - callback
152+
* @returns {void}
151153
*/
152-
function onRead( id, clbk ) {
154+
function onReadFactory( id, clbk ) {
155+
return onRead;
153156
/**
154157
* Callback invoked upon reading a file.
155158
*
156159
* @private
157160
* @param {(Error|null)} error - error object
158161
* @param {(Buffer|string)} data - file content
162+
* @returns {void}
159163
*/
160-
return function onRead( error, data ) {
164+
function onRead( error, data ) {
161165
if ( error ) {
162166
return done( error );
163167
}
164168
clbk( id, data.toString() );
165-
}; // end FUNCTION onRead()
169+
}
166170
}
167171

168172
/**
@@ -214,6 +218,7 @@ function runner() {
214218
*
215219
* @private
216220
* @param {Error} [error] - error object
221+
* @returns {void}
217222
*/
218223
function done( error ) {
219224
if ( error ) {

0 commit comments

Comments
 (0)