251 Commits

Author SHA1 Message Date
Tom MacWright
7ccf89d83c Fix linkerStack resolution order (#564) 2016-10-11 18:08:13 -04:00
Erik Arvidsson
384ccbcf5e Fix inferring return type of var function (#545)
I accidentally broke the detection of the return type in:

```js
var f = function(x: number): boolean {}
```
2016-10-10 17:18:07 -04:00
Tom MacWright
df8efa4d3d Update dependencies (#560)
* also deprecated --private option in favor of --access
2016-10-10 17:16:31 -04:00
Christoph Kettelhoit
473a7a2dce Membership inference improvements (#558)
* Add test for memberof normalization: @memberof Foo#, @memberof Foo.prototype

* Add memberof normalization for @memberof Foo#, @memberof Foo.prototype

* Add test to infer membership of properties defined inside constructor

* Added inference of membership for properties defined inside constructor

* Fix Membership spelling, switch let for var to keep node compat broad

* Change memberof normalization to use RegExp
2016-10-05 15:22:13 -04:00
Tom MacWright
58c6892c22 Fix parameter sorting: avoid nesting errors and keep params together 2016-09-21 11:47:07 -04:00
Erik Arvidsson
16da8bb225 Infer optional record fields in object types (#547)
This is done with Doctrine's OptionalType, which Doctrine is only
using for parameter types as of now.

Towards #512
2016-09-19 12:54:56 -04:00
Erik Arvidsson
71922c7c8a Handle assignments in document exported (#544)
This improves detection of cases where we have:

```js
export const f = function () {};
export const o = { ... };
```

and similarly indirection using default/named.

```js
const f = function () {};
export {f};
```

Fixes #543
2016-09-19 12:53:18 -04:00
Erik Arvidsson
8ea9e834e5 Expose formatParameter as a formatter (#546)
This allows custom themes to override it
2016-09-14 17:06:14 -07:00
Erik Arvidsson
2eff668edf Infer type for variable declarations and class properties (#540)
This infers the type from Flow type annotations for variable
declarations and class properties.

This also moves the logic for setting the `type` for typedefs
to the same type inferrer.

Also infer the type for statements like:

```js
const x = 42;
```

same as:

```js
const x: number = 42;
```
2016-09-13 12:40:24 -07:00
Erik Arvidsson
a71bb03681 Fix sort order alpha (#542)
The old code didn't work correctly with regards to making the sort
aware of memberof.
2016-09-12 16:41:28 -07:00
Erik Arvidsson
e11c1ab3b5 Change document-exported to traverse the code (#533)
* Change document-exported to traverse the code

Instead of traversing over all input files this changes
documentExported to traverse from the exports in the input files,
loading, parsing and traversing the module specifier as needed.

Fixes #515

* Move parseToAst to its own module

* Skip non export declarations for speed
2016-09-09 11:07:26 -04:00
Erik Arvidsson
a5ac4a798c Add a --sort-order option (#535)
Valid values for the `--sort-order` flag are `"source"` (default) and
`"alpha"`. When set to `"alpa"` the order of the entries in the docs
are sorted alphabetically.

Fixes #534
2016-09-08 18:26:02 -04:00
Erik Arvidsson
85ff818714 Fix issue with watch and shallow (#532)
When doing `--shallow --watch` we called `generator` (which
synchronously called `updateWatcher`/`addNewFiles`) but the watcher has
not been created yet. Instead create the watcher first before
`generator` is called.

Fixes #531
2016-09-08 18:14:13 -04:00
Erik Arvidsson
895775df7b Cleanup literal types (#522)
This updates Doctrine to 1.3 to pick up its support for literal types
(doctrine still does not support boolean literals types).

Towards #373
2016-09-04 16:43:28 -04:00
ikokostya
28d51fcaf8 Fix github link generation for Node.js 6 (#524)
In Node.js 6 additional assertions was added in path module:
https://github.com/nodejs/node/pull/5348
2016-09-04 16:41:06 -04:00
Tom MacWright
0a97e0eccc Continue to close the gap with flow (#520)
* Adds test support for flow difference
* New support for FunctionTypeAnnotation
* New support for ObjectTypeAnnotation
* New support for MixedTypeAnnotation
2016-09-01 16:32:47 -04:00
Erik Arvidsson
d2b93aee94 Add support for null and void types (#519)
This adds support for `void` and `null` in type annotations:

```js
function f(): void {}
function g(): null {
  return null;
}
```

Towards #512
2016-09-01 15:18:42 -04:00
Erik Arvidsson
6b981e0780 Add the type property to typedef comments (#517)
* Add the type property to typedef comments

When using Flow type aliases we didn't add the `type` property
to the JSDoc comment for the inferred `typedef`.

Fixes #516

* Rename files and update test expectations
2016-09-01 10:12:30 -04:00
Erik Arvidsson
b469bb7079 Fix the name of infer membership for non named export default (#508)
When inferring the membership of a class that is an unnamed default
export we hit a null pointer exception.

```js
export default class {
  /** */
  member() {}
}
```

Inferring the name for the class above fails

Fixes #506
2016-08-25 11:09:49 -04:00
Erik Arvidsson
dc846b4219 Handle flow tuple syntax (#511)
This fixes issues with Flow tuples `[T, V]` and
Flow array types `T[]`.

Fixes #510
2016-08-25 11:08:32 -04:00
Erik Arvidsson
2e9376cf46 Fix issue where exported declarations did not set the kind (#503)
* Fix issue where exported declarations did not set the kind

For cases like:

```js
/** */ export class C {}
/** */ export function f {}
/** */ export const k = 42;
```

the kind did not get set properly.

Towards #484

* Infer kind for export default too

Towards #484
2016-08-24 11:03:06 -04:00
Erik Arvidsson
f53e1e72b7 Use provided name for export default (#505)
If a binding name is provided we should use that in the documentation.

For example:

```js
// test.js
/** */
export default function find() {}
```

Should use the name `find` and not `test`.

Fixes #504
2016-08-24 11:01:31 -04:00
Tom MacWright
49347c82e7 Arv document exported (#502)
* Add a flag to document all exported bindings

This adds a boolean flag called `document-exported` (defaults to false)
that effectively adds an empty comment to all exported bindings that do
not already have a JSDoc comment. It also does the same for the
members of exported classes and objects.

```js
export class C {
  method() {}
}
```

Both `C` and `C#method` are now part of the generated documentation.

Related to #424

* Fix lint error

* Rebase and use options pragma in test file

* Create extractor type as a generalized comment/export getter

* Document exported extractor
2016-08-24 10:58:15 -04:00
Tom MacWright
06412eaad8 Turbo v1 (#497) 2016-08-19 12:22:54 -04:00
Tom MacWright
f0af5b86ae Add generator comment to Markdown output (#496) 2016-08-19 10:08:06 -04:00
Anand Thakker
51fa35c2bf Infer name for string-literal property keys (#487) 2016-08-18 16:59:56 -04:00
Tom MacWright
bec5d7b4b8 Refs #451. Any -> any (#491) 2016-08-18 08:01:12 -04:00
Tom MacWright
b506893cb0 Run lint in our own tests. Fixes #240 (#480) 2016-07-19 15:43:42 -04:00
Tom MacWright
9e47ec103b Lint all type-containing tags. Fixes #380 (#477) 2016-07-16 20:26:45 -04:00
Tom MacWright
f00c7bd153 Robertleeplummerjr master (#476)
* Expose imports between templates

Exposes `renderSectionList`, and `renderSection` & `renderNote` for consistency. Fixes #462

* Fixes #440

Resolve typo

* Resolve variable name conflict

* Change formatters to master
2016-07-16 20:10:15 -04:00
Tom MacWright
b83bc2eff6 Merge branch 'master' of https://github.com/documentationjs/documentation 2016-07-16 19:52:44 -04:00
Tom MacWright
b89afcf9e3 Improve linkerstack internal documentation 2016-07-16 19:52:00 -04:00
Tom MacWright
c7726bbb19 Report bad TOC entries. Fixes #442 (#475) 2016-07-16 19:40:17 -04:00
Tom MacWright
211a26027c Allow the user to specify port. (#474)
Fixes #464
2016-07-14 13:51:43 -04:00
Anand Thakker
b4fe8edf92 Fixes TOC entries missing description in serve (#470)
* Fixes TOC entries missing description in `serve`

* Remove console statements
2016-07-11 15:03:41 -04:00
Anand Thakker
5b78f57e1f Fix short signatures for inferred params (#471) 2016-07-11 15:02:36 -04:00
Tom MacWright
cc2e5e20d3 Pass paths to binary 2016-07-06 13:30:09 -04:00
Tom MacWright
937ac48154 Forgiving links to 404s 2016-07-06 12:43:36 -04:00
Tom MacWright
6cbf4bd1d8 Improve internal documentation, add examples 2016-06-17 16:29:57 -04:00
Tom MacWright
8287ab0539 Fix names of methods for generated documentation 2016-06-17 16:18:07 -04:00
Tom MacWright
7696e965ca Reorganize server code into lib/serve 2016-06-17 16:07:49 -04:00
Tom MacWright
3f08c19533 Move documentation-theme-utils into core
Also:

* Fixes many issues in the default theme
* Moves the default theme from default-theme to default_theme
* Creates a new, robust linker infrastructure that will support
  bare links
* Replaces slugg with github-slugger
* Outputs unknown types as Any. Fixes #451
2016-06-08 12:40:05 -04:00
Tom MacWright
9bda56842f Merge pull request #453 from arv/class-property
Infer class properties
2016-06-07 20:49:09 -04:00
Erik Arvidsson
e13e5d7db3 Infer class properties
Flow/TypeScript has a special syntax for class properties. These
should be grouped under the class that they belong to.
2016-06-07 17:20:55 -07:00
Erik Arvidsson
8c14481260 Treat flow nullable types as nullable
Previously they were treated as optional params which is not the
same thing.
2016-06-07 15:10:39 -07:00
Julien Vanier
6ae89c675d No context for narrative sections
When using `--config configuration.yml` with narrative sections, `documentation build` crashes with `TypeError: Cannot read property 'github' of undefined` (regardless if `--github` is passed or not). Verify that the `comment.context` object exists before reading its properties.
2016-06-06 16:45:57 -04:00
Tom MacWright
caa1637880 Fix ability to require() JSON and other files without extension.
Fixes #402
2016-06-03 13:47:42 -04:00
Tom MacWright
dead5bb9f7 Finish internal documentation 2016-06-02 15:00:12 -04:00
Tom MacWright
aadb8addc6 Even more documentation 2016-06-02 14:53:58 -04:00
Tom MacWright
09a4faa672 Cover lib/parse 2016-06-02 14:32:04 -04:00