Skip to content

Commit e160326

Browse files
committed
Address review comments
1 parent 7156122 commit e160326

File tree

4 files changed

+52
-22
lines changed

4 files changed

+52
-22
lines changed

declarations/comment.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
declare type DocumentationConfig = {
1+
type DocumentationConfig = {
22
polyglot?: boolean,
33
inferPrivate?: boolean,
44
noPackage?: boolean,
@@ -12,25 +12,25 @@ declare type DocumentationConfig = {
1212
parseExtension: Array<string>
1313
};
1414

15-
declare type InputsConfig = {
15+
type InputsConfig = {
1616
inputs: Array<SourceFile>,
1717
config: DocumentationConfig
1818
};
1919

20-
declare type CommentError = {
20+
type CommentError = {
2121
message: string,
2222
commentLineNumber?: number
2323
};
2424

25-
declare type DoctrineType = {
25+
type DoctrineType = {
2626
elements?: Array<DoctrineType>,
2727
expression?: DoctrineType,
2828
applications?: Array<DoctrineType>,
2929
type: string,
3030
name?: string
3131
};
3232

33-
declare type CommentLoc = {
33+
type CommentLoc = {
3434
start: {
3535
line: number
3636
},
@@ -39,12 +39,12 @@ declare type CommentLoc = {
3939
}
4040
};
4141

42-
declare type SourceFile = {
42+
type SourceFile = {
4343
source?: string,
4444
file: string
4545
};
4646

47-
declare type CommentContext = {
47+
type CommentContext = {
4848
sortKey: string,
4949
file: string,
5050
ast: Object,
@@ -53,16 +53,16 @@ declare type CommentContext = {
5353
github?: CommentContextGitHub
5454
};
5555

56-
declare type CommentContextGitHub = {
56+
type CommentContextGitHub = {
5757
path: string,
5858
url: string
5959
};
6060

61-
declare type CommentTagBase = {
61+
type CommentTagBase = {
6262
title: string
6363
};
6464

65-
declare type CommentTag = CommentTagBase & {
65+
type CommentTag = CommentTagBase & {
6666
name?: string,
6767
title: string,
6868
description?: Object,
@@ -72,7 +72,7 @@ declare type CommentTag = CommentTagBase & {
7272
properties?: Array<CommentTag>
7373
};
7474

75-
declare type CommentTagNamed = CommentTag & {
75+
type CommentTagNamed = CommentTag & {
7676
name?: string,
7777
title: string,
7878
description?: Object,
@@ -82,27 +82,27 @@ declare type CommentTagNamed = CommentTag & {
8282
properties?: Array<CommentTag>
8383
};
8484

85-
declare type CommentMembers = {
85+
type CommentMembers = {
8686
static: Array<Comment>,
8787
instance: Array<Comment>,
8888
events: Array<Comment>,
8989
global: Array<Comment>,
9090
inner: Array<Comment>
9191
};
9292

93-
declare type CommentExample = {
93+
type CommentExample = {
9494
caption?: string,
9595
description?: Object
9696
};
9797

98-
declare type Remark = {
98+
type Remark = {
9999
type: string,
100100
children: Array<Object>
101101
};
102102

103-
declare type Access = 'private' | 'public' | 'protected';
104-
declare type Scope = 'instance' | 'static' | 'inner' | 'global';
105-
declare type Kind =
103+
type Access = 'private' | 'public' | 'protected';
104+
type Scope = 'instance' | 'static' | 'inner' | 'global';
105+
type Kind =
106106
| 'class'
107107
| 'constant'
108108
| 'event'
@@ -116,7 +116,7 @@ declare type Kind =
116116
| 'typedef'
117117
| 'interface';
118118

119-
declare type Comment = {
119+
type Comment = {
120120
errors: Array<CommentError>,
121121
tags: Array<CommentTag>,
122122

@@ -163,7 +163,7 @@ declare type Comment = {
163163
}>
164164
};
165165

166-
declare type ReducedComment = {
166+
type ReducedComment = {
167167
name: string,
168168
kind: ?Kind,
169169
scope?: ?Scope

lib/infer/params.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const flowDoctrine = require('../flow_doctrine');
99
const util = require('util');
1010
const debuglog = util.debuglog('infer');
1111

12-
// TODO: use a constant
1312
const PATH_SPLIT_CAPTURING = /(\[])?(\.)/g;
1413

1514
function addPrefix(doc /*: CommentTagNamed */, prefix) {

lib/nest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var _ = require('lodash');
55

66
const PATH_SPLIT = /(?:\[])?\./g;
77

8-
function rejectUnnamedTags(
8+
function removeUnnamedTags(
99
tags /*: Array<CommentTag> */
1010
) /*: Array<CommentTagNamed> */ {
1111
return tags.filter(tag => typeof tag.name === 'string');
@@ -42,7 +42,7 @@ var nestTag = (
4242
// Use lodash here both for brevity and also because, unlike JavaScript's
4343
// sort, it's stable.
4444
) =>
45-
_.sortBy(rejectUnnamedTags(tags), tagDepth).reduce(
45+
_.sortBy(removeUnnamedTags(tags), tagDepth).reduce(
4646
(memo, tag) => {
4747
function insertTag(node, parts) {
4848
// The 'done' case: we're at parts.length === 1,

test/lib/infer/params.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,37 @@ test('inferParams', function(t) {
130130
[{ lineNumber: 3, name: 'x', title: 'param' }]
131131
);
132132

133+
t.deepEqual(
134+
evaluate(`/** Test */function f({ x, ...xs }) {};`).params,
135+
[
136+
{
137+
title: 'param',
138+
name: '$0',
139+
anonymous: true,
140+
type: {
141+
type: 'NameExpression',
142+
name: 'Object'
143+
},
144+
properties: [
145+
{
146+
title: 'param',
147+
name: '$0.x',
148+
lineNumber: 1
149+
},
150+
{
151+
title: 'param',
152+
name: '$0.xs',
153+
lineNumber: 1,
154+
type: {
155+
type: 'RestType'
156+
}
157+
}
158+
]
159+
}
160+
],
161+
'object spread property'
162+
);
163+
133164
t.deepEqual(
134165
evaluate(function() {
135166
/**

0 commit comments

Comments
 (0)