Skip to content

Commit 5753da1

Browse files
committed
Just deal with comment.params, not comment.tags
1 parent 3052584 commit 5753da1

File tree

5 files changed

+4
-49
lines changed

5 files changed

+4
-49
lines changed

lib/infer/params.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ module.exports = function inferParams(comment) {
2525

2626
path.value.params.forEach(function (param) {
2727
if (existingParams[param.name] === undefined) {
28-
comment.tags.push({
29-
title: 'param',
30-
name: param.name,
31-
lineNumber: param.loc.start.line
32-
});
3328
if (!comment.params) {
3429
comment.params = [];
3530
}
@@ -45,16 +40,11 @@ module.exports = function inferParams(comment) {
4540
// Ensure that if params are specified partially or in
4641
// the wrong order, they'll be output in the order
4742
// they actually appear in code
48-
comment.tags.sort(function (a, b) {
49-
if (a.title === 'param' && b.title === 'param') {
43+
if (comment.params) {
44+
comment.params.sort(function (a, b) {
5045
return paramOrder.indexOf(a.name) - paramOrder.indexOf(b.name);
51-
}
52-
return 0;
53-
});
54-
55-
(comment.params || []).sort(function (a, b) {
56-
return paramOrder.indexOf(a.name) - paramOrder.indexOf(b.name);
57-
});
46+
});
47+
}
5848

5949
this.abort();
6050
}

test/fixture/es6.output.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@
1010
"type": "NameExpression",
1111
"name": "Number"
1212
}
13-
},
14-
{
15-
"title": "param",
16-
"name": "a",
17-
"lineNumber": 5
18-
},
19-
{
20-
"title": "param",
21-
"name": "b",
22-
"lineNumber": 5
2313
}
2414
],
2515
"loc": {

test/fixture/factory.output.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@
6767
"lineNumber": 1,
6868
"type": null,
6969
"name": "area"
70-
},
71-
{
72-
"title": "param",
73-
"name": "selection",
74-
"lineNumber": 10
7570
}
7671
],
7772
"loc": {
@@ -127,11 +122,6 @@
127122
"description": null,
128123
"lineNumber": 2,
129124
"name": null
130-
},
131-
{
132-
"title": "param",
133-
"name": "_",
134-
"lineNumber": 17
135125
}
136126
],
137127
"loc": {

test/fixture/infer-params.output.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
{
33
"description": "This function returns the number one.",
44
"tags": [
5-
{
6-
"title": "param",
7-
"name": "a",
8-
"lineNumber": 7
9-
},
105
{
116
"title": "param",
127
"description": "the second param",
@@ -16,11 +11,6 @@
1611
"name": "number"
1712
},
1813
"name": "b"
19-
},
20-
{
21-
"title": "param",
22-
"name": "c",
23-
"lineNumber": 7
2414
}
2515
],
2616
"loc": {

test/fixture/multisignature.output.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
"type": "NameExpression",
1111
"name": "Date"
1212
}
13-
},
14-
{
15-
"title": "param",
16-
"name": "time",
17-
"lineNumber": 13
1813
}
1914
],
2015
"loc": {

0 commit comments

Comments
 (0)