Skip to content

Commit b506893

Browse files
authored
Run lint in our own tests. Fixes #240 (#480)
1 parent 14cfdb5 commit b506893

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function buildSync(indexes, options) {
208208
* @returns {undefined} calls callback
209209
* @public
210210
*/
211-
module.exports.lint = function lint(indexes, options, callback) {
211+
function lint(indexes, options, callback) {
212212
options = options || {};
213213

214214
if (typeof indexes === 'string') {
@@ -241,11 +241,7 @@ module.exports.lint = function lint(indexes, options, callback) {
241241
nest))
242242
.filter(Boolean))));
243243
});
244-
};
245-
246-
module.exports.expandInputs = expandInputs;
247-
module.exports.buildSync = buildSync;
248-
module.exports.build = build;
244+
}
249245

250246
/**
251247
* Documentation's formats are modular methods that take comments
@@ -254,7 +250,7 @@ module.exports.build = build;
254250
* output.
255251
* @public
256252
*/
257-
module.exports.formats = {
253+
var formats = {
258254
html: require('./lib/output/html'),
259255
md: require('./lib/output/markdown'),
260256
remark: function (comments, options, callback) {
@@ -265,6 +261,12 @@ module.exports.formats = {
265261
json: require('./lib/output/json')
266262
};
267263

264+
module.exports.lint = lint;
265+
module.exports.expandInputs = expandInputs;
266+
module.exports.buildSync = buildSync;
267+
module.exports.build = build;
268+
module.exports.formats = formats;
269+
268270
module.exports.util = {
269271
createFormatters: require('./lib/output/util/formatters'),
270272
createLinkerStack: require('./lib/output/util/linker_stack')

lib/filter_js.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var path = require('path');
1010
* expect as argument a file as an objectg with the 'file' property
1111
*
1212
* @private
13-
* @param {String|Array} extension to be filtered
13+
* @param {string|Array} extension to be filtered
1414
* @param {boolean} allowAll ignore the entire extension check and always
1515
* pass through files. This is used by the polglot mode.
1616
* @return {Function} a filter function, this function returns true if the input filename extension

lib/module_filters.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ var internalModuleRegexp = process.platform === 'win32' ?
88
/^(\.|\w:)/ :
99
/^[\/.]/;
1010

11+
/**
12+
* Module filters
13+
* @private
14+
*/
1115
module.exports = {
1216
internalOnly: internalModuleRegexp.test.bind(internalModuleRegexp),
1317

lib/output/util/format_type.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function t(text) {
1515
* Helper used to automatically link items to global JS documentation or to internal
1616
* documentation.
1717
*
18-
* @param {String} text - text to potentially link
18+
* @param {string} text - text to potentially link
1919
* @param {function} [getHref] - a function that tries
2020
* to find a URL to point a named link to
2121
* @param {string} description text that will be shown to the user, if this

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"scripts": {
8383
"lint": "eslint bin lib index.js test",
8484
"doc": "documentation index.js -f md --access=public > docs/NODE_API.md",
85-
"test": "npm run lint && tap -t 120 --coverage test/*.js test/lib test/streams"
85+
"self-lint": "node ./bin/documentation.js lint",
86+
"test": "npm run lint && npm run self-lint && tap -t 120 --coverage test/*.js test/lib test/streams"
8687
}
8788
}

0 commit comments

Comments
 (0)