Skip to content

Commit b3c990d

Browse files
committed
Simpler and stricter eslint
1 parent d7f06fa commit b3c990d

File tree

6 files changed

+26
-19
lines changed

6 files changed

+26
-19
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"no-shadow": 0,
3434
"no-undef": 2
3535
},
36+
"extends": "eslint:recommended",
3637
"env": {
3738
"node": true,
3839
"es6": true,

bin/documentation.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env node
22

3+
/* eslint no-console: 0 */
4+
35
'use strict';
46

57
var documentation = require('../'),

lib/infer/params.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,29 @@ var types = require('ast-types'),
1313
*/
1414
module.exports = function inferParams(comment) {
1515

16-
function paramToDoc(param) {
17-
// ES6 default
18-
if (param.type === 'AssignmentPattern') {
19-
var newParam = paramToDoc(param.left);
20-
var optionalParam = {
21-
title: 'param',
22-
name: newParam.name,
23-
'default': comment.context.code.substring(
24-
param.right.start, param.right.end)
16+
function paramWithDefaultToDoc(param) {
17+
var newParam = paramToDoc(param.left);
18+
var optionalParam = {
19+
title: 'param',
20+
name: newParam.name,
21+
'default': comment.context.code.substring(
22+
param.right.start, param.right.end)
23+
};
24+
25+
if (newParam.type) {
26+
optionalParam.type = {
27+
type: 'OptionalType',
28+
expression: newParam.type
2529
};
30+
}
2631

27-
if (newParam.type) {
28-
optionalParam.type = {
29-
type: 'OptionalType',
30-
expression: newParam.type
31-
};
32-
}
32+
return optionalParam;
33+
}
3334

34-
return optionalParam;
35+
function paramToDoc(param) {
36+
// ES6 default
37+
if (param.type === 'AssignmentPattern') {
38+
return paramWithDefaultToDoc(param);
3539
}
3640

3741
var newParam = {

lib/output/markdown_ast.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function commentsToAST(comments, opts, callback) {
8585
!!comment.members.instance.length &&
8686
u('root', comment.members.instance.map(generate.bind(null, depth + 1))),
8787
!!comment.members.static.length &&
88-
u('root', comment.members.static.map(generate.bind(null, depth + 1))),
88+
u('root', comment.members.static.map(generate.bind(null, depth + 1)))
8989
].filter(identity));
9090
}
9191

test/bin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ test('accepts config file', function (t) {
5858
function (err, data) {
5959
t.error(err);
6060
if (process.env.UPDATE) {
61-
var expected = fs.writeFileSync(
61+
fs.writeFileSync(
6262
path.resolve(__dirname,
6363
'fixture',
6464
'sorting/output.json'), JSON.stringify(normalize(data), null, 2), 'utf8');

test/lib/git/mock_repo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ module.exports = {
1616
'index.js': 'module.exports = 42;'
1717
}
1818
}
19-
},
19+
}
2020
};

0 commit comments

Comments
 (0)