Skip to content

Commit 0aa42d2

Browse files
committed
Enable and fix no-unused-vars rule
1 parent 5e75972 commit 0aa42d2

File tree

12 files changed

+14
-25
lines changed

12 files changed

+14
-25
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"no-throw-literal": 2,
2525
"no-self-compare": 2,
2626
"no-void": 2,
27+
"no-unused-vars": 2,
2728
"wrap-iife": 2,
2829
"no-eq-null": 2,
2930
"quotes": [2, "single"],

bin/documentation.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,16 @@
33
'use strict';
44

55
var documentation = require('../'),
6-
76
streamArray = require('stream-array'),
87
fs = require('fs'),
98
vfs = require('vinyl-fs'),
109
formatError = require('../lib/error'),
1110
args = require('../lib/args.js');
1211

13-
var parsedArgs = args(process.argv.slice(2));
14-
var inputs = parsedArgs.inputs,
15-
options = parsedArgs.options,
12+
var parsedArgs = args(process.argv.slice(2)),
1613
formatterOptions = parsedArgs.formatterOptions,
17-
outputLocation = parsedArgs.output;
18-
19-
var formatter = documentation.formats[parsedArgs.formatter];
14+
outputLocation = parsedArgs.output,
15+
formatter = documentation.formats[parsedArgs.formatter];
2016

2117
documentation(parsedArgs.inputs, parsedArgs.options, function (err, result) {
2218
if (err) {

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var sort = require('./lib/sort'),
66
filterJS = require('./lib/filter_js'),
77
dependency = require('./lib/input/dependency'),
88
shallow = require('./lib/input/shallow'),
9-
parse = require('./lib/parsers/javascript'),
9+
parseJavaScript = require('./lib/parsers/javascript'),
1010
polyglot = require('./lib/parsers/polyglot'),
1111
github = require('./lib/github'),
1212
hierarchy = require('./lib/hierarchy'),
@@ -48,6 +48,7 @@ module.exports = function (indexes, options, callback) {
4848
}
4949

5050
var inputFn = (options.polyglot || options.shallow) ? shallow : dependency;
51+
var parseFn = (options.polyglot) ? polyglot : parseJavaScript;
5152

5253
return inputFn(indexes, options, function (error, inputs) {
5354
if (error) {
@@ -57,7 +58,7 @@ module.exports = function (indexes, options, callback) {
5758
var flat = inputs
5859
.filter(filterJS)
5960
.reduce(function (memo, file) {
60-
return memo.concat(parse(file));
61+
return memo.concat(parseFn(file));
6162
}, [])
6263
.map(function (comment) {
6364
// compose nesting & membership to avoid intermediate arrays

lib/args.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ module.exports = function (args) {
9595
throw new Error('The HTML output mode requires a destination directory set with -o');
9696
}
9797

98-
var formatterOptions = {
99-
};
100-
10198
var config = {};
10299

103100
if (argv.config) {

lib/github.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
var path = require('path');
4-
var fs = require('fs');
54
var findGit = require('../lib/git/find_git');
65
var getGithubURLPrefix = require('../lib/git/url_prefix');
76

lib/lint.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ var CANONICAL = {
1818
* @returns {Array<Object>} array of errors
1919
*/
2020
module.exports = function (comment) {
21-
var errors = [];
2221
comment.tags.forEach(function (tag) {
2322
function nameInvariant(name) {
2423
if (CANONICAL[name]) {

lib/parse.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
var doctrine = require('doctrine'),
4-
error = require('./error'),
54
flatten = require('./flatten'),
65
normalize = require('./normalize');
76

test/bin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ test('--shallow option', function (t) {
8484
});
8585

8686
test('bad -f option', function (t) {
87-
documentation(['-f DOES-NOT-EXIST fixture/internal.input.js'], function (err, data) {
87+
documentation(['-f DOES-NOT-EXIST fixture/internal.input.js'], function (err) {
8888
t.ok(err, 'returns error');
8989
t.end();
9090
});
9191
});
9292

9393
test('html with no destination', function (t) {
94-
documentation(['-f html fixture/internal.input.js'], function (err, data) {
94+
documentation(['-f html fixture/internal.input.js'], function (err) {
9595
t.ok(err.toString()
9696
.match(/The HTML output mode requires a destination directory set with -o/),
9797
'needs dest for html');
@@ -100,7 +100,7 @@ test('html with no destination', function (t) {
100100
});
101101

102102
test('given no files', function (t) {
103-
documentation([''], function (err, data) {
103+
documentation([''], function (err) {
104104
t.ok(err.toString()
105105
.match(/documentation was given no files and was not run in a module directory/),
106106
'no files given');
@@ -137,7 +137,7 @@ test('write to html', function (t) {
137137
test('fatal error', function (t) {
138138

139139
documentation(['--shallow fixture/bad/syntax.input.js'], {},
140-
function (err, data) {
140+
function (err) {
141141
t.ok(err.toString().match(/Unexpected token/), 'reports syntax error');
142142
t.end();
143143
}, false);

test/lib/error.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ var test = require('tap').test,
55
error = require('../../lib/error');
66

77
test('error', function (t) {
8-
var tag = {
9-
lineNumber: 2
10-
};
11-
128
var comment = {
139
context: {
1410
file: path.join(process.cwd(), 'file.js')

test/lib/git/find_git.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
var test = require('tap').test,
4-
path = require('path'),
54
mock = require('mock-fs'),
65
mockRepo = require('./mock_repo'),
76
findGit = require('../../../lib/git/find_git');

0 commit comments

Comments
 (0)