291 Commits

Author SHA1 Message Date
Tom MacWright
3a92ab9621 build(package): Remove extend, debounce, and resolve dependencies (#713)
extend and debounce are swapped for lodash versions, and resolve was no longer used

Fixes #712
2017-04-10 16:33:31 -04:00
greenkeeper[bot]
cf2ef2bc50 Update dependencies to enable Greenkeeper 🌴 (#711)
* chore(package): update dependencies

https://greenkeeper.io/

* docs(readme): add Greenkeeper badge 

https://greenkeeper.io/

* chore(greenkeeper): Exclude remote-origin-url and yargs from Greenkeeper for now
2017-04-10 16:19:11 -04:00
Tom MacWright
25152edeb9 style(prettier): Use prettier for code formatting (#710)
* style(prettier): Use prettier for code formatting

This saves us style issues. Also adds husky and lint-staged for pre-commit testing

Refs https://github.com/documentationjs/documentation/issues/709
2017-04-10 14:25:45 -04:00
Tom MacWright
e2915dc19c feat(core): Support Flow interface declarations
* Add support for interface declarations

* Support exported interfaces/type aliases

* Update test fixtures

* Add interface type, fix test

* Fix comment style and typo
2017-04-10 13:14:04 -04:00
Tom MacWright
f07285a920 feat(markdown): Add @see tag output in Markdown (#682)
Refs https://github.com/documentationjs/documentation/issues/673
2017-02-24 16:33:12 -05:00
Tom MacWright
84c9215811 fix(inference): Refactor membership inference
- Tags with `@lends` are now filtered out early on, so they never
  generate documentation. Lends tags are structural hints only.
- Uses built-in type checks instead of babel-types where appropriate.
- More internal documentation
- Now reuses code for parsing lends between different forms

Previously broken syntax, now working:

```js
/** parent */
export default function() {
  /** child */
  this.a = 1;
}
```
2017-02-24 15:36:55 -05:00
Tom MacWright
802dc4cf2c fix(inference): Robust parsing for shorthand object methods
This extends findTarget and the membership interference steps, treating ObjectProperty within var-assigned objects the same as we did for ObjectMethods. It also adds tests that specifically test findTarget directly.

Fixes https://github.com/documentationjs/documentation/issues/649 and fixes https://github.com/documentationjs/documentation/issues/678
2017-02-24 11:56:00 -05:00
Erik Arvidsson
2c2087d22e Fix(flow): Allow unnamed parameters (#674)
This allows `type T = number => string`. Previously we were only
handling `type T = (x: number) => string` correctly.

Followup to #672 that:
 - Adds a test fixture
 - Fixes lint errors
2017-02-19 14:02:09 -08:00
Andrew Gallant
5bd42d6815 Fix bug parsing anonymous closure types from Flow. (#672)
If no parameter name exists in a function type, then set it to empty. Also,
fix the formatter so that `{param}: {ty}` is formatted as `{ty}` when
`{param}` is empty.

Fixes #671
2017-02-19 13:26:24 -08:00
Tom MacWright
cd65dc39cf Support deprecated tag (#666) 2017-01-29 19:10:04 -05:00
Tom MacWright
8cc34b661f fix(scopes): Support inner scope (#665)
* fix(scopes): Support inner scope

The purpose and usage of inner is still unclear, unfortunately, so this is an interim fix at best.

Fixes https://github.com/documentationjs/documentation/issues/652

* Improve comment typedef while we're at it
2017-01-29 18:35:19 -05:00
Tom MacWright
8295363bed console.errors when in html serving mode 2017-01-29 17:04:19 -05:00
Tom MacWright
631c6925d4 feat(core): Switch to Promises everywhere. Adopt Node v4 ES6 (#648)
* feat(core): Switch to Promises everywhere. Adopt Node v4 ES6

Big changes:

* Uses template strings where appropriate
* Config and argument parsing is unified and there is no such thing
  as formatterOptions anymore. All user-passed options go through
  mergeConfig.
* The node API surface changed (again): `buildSync` is removed,
  building operations return Promises.
* Now using Flow for internal type annotations.

More changes:

* Remove buildSync command
* feat(inference): Partially implement object shorthand support
* Refs #649
* Use Flow annotations to  enforce types
* Keep flow but switch to comment syntax
* Clarify types
* More flow improvements
* Turn server into class
* LinkerStack becomes class too
* Fix comment description type
* Run flow on lint
* Many more flow fixes
* More intense flow refactoring
* Simplify inference steps
* Update inference tests, flow errors down to 1
* Continue refining types
* Fix more flow issues
* Use 'use strict' everywhere
* Make 'ast' property configurable
* Fix many tests
* Fix more tests
* Fix more tests
* Fix augments
* Test Markdown meta support
* Improve test coverage
* Switch back from for of to for for speed
2017-01-27 16:14:19 -05:00
Tom MacWright
88c8f9a668 fix(cli): Fix error reporting in the CLI 2016-12-28 22:25:45 -05:00
Tom MacWright
dd9c03a19e refactor(args): Improve the way we use yargs to simplify the markdown-toc option 2016-12-28 22:25:45 -05:00
Tom MacWright
5bfc660a98 test(coverage): Improve test coverage of document exported 2016-12-28 22:25:45 -05:00
Tom MacWright
4c66fb14c7 feat(markdown): Add table of contents support for Markdown mode (#645)
Adds a new option, `--no-markdown-toc`, to turn off Table of Contents generation. Table of contents are now generated by default with markdown output, including through the `readme` command.

Fixes https://github.com/documentationjs/documentation/issues/220
2016-12-28 21:12:33 -05:00
Tom MacWright
2ae5d8f304 fix(markdown): Start headings in Markdown at h2 (#644)
Fixes https://github.com/documentationjs/documentation/issues/641
2016-12-28 20:12:17 -05:00
Tom MacWright
813dfbbc29 docs(nodeapi): Fix node API documentation: formatters call (err, res) (#643)
Fixes https://github.com/documentationjs/documentation/issues/642
2016-12-28 18:16:08 -05:00
Tom MacWright
cb8fdfa74f feat(bin): Support globs on windows and use smarter recursion (#629)
This brings logic from eslint over to documentation: instead of readdirSync, we're using the glob
module. This also, I hope, will let us support globs on Windows without changing OSX/Linux behavior.
Fixes #607
2016-12-26 10:24:30 -05:00
Friedel Ziegelmayer
f1e0267e7c fix(hierarchy): collect events from static and instance members (#628)
Fixes #486
2016-12-08 11:59:26 -05:00
Friedel Ziegelmayer
89fb67f907 feat(build): load passed in config option (#625)
* feat(build): load passed in config option

Fixes #https://github.com/documentationjs/gulp-documentation/issues/27

* refactor(build): streamline loadConfig path
2016-12-05 15:00:10 -05:00
Erik Arvidsson
363a108fe4 fix(extractors): Document export default value (#623)
With `--document-exported` we used to only support

```js
export default Declaration
```

and

```js
export default IdentifierExpression
```

With this change we generate a comment for all default exports.

Fixes #543
2016-12-03 09:30:24 -08:00
Tom MacWright
846ab94772 fix(parser): Avoid error about deoptimization on very large files (#621)
This sets compact: false for babelify, so that Babel doesn't complain about not being able to

compact'ify very large files

* https://github.com/documentationjs/gulp-documentation/issues/14
2016-11-26 18:57:09 -05:00
Tom MacWright
f9ddb9cd29 Output typedef content in Markdown and HTML. Fixes #359 (#619) 2016-11-25 18:31:21 -05:00
Tom MacWright
a1eb45d21e Infer class augments tag with MemberExpression superClass. Fixes #458 (#616) 2016-11-23 13:52:52 -05:00
Friedel Ziegelmayer
d96aa47673 feat(config): add file property for notes (#614)
* feat(config): add file property for notes

Fixes #609

* feat(config): resolve files against the config file location
2016-11-23 08:31:10 -05:00
Tom MacWright
7f400da151 Highlight all Markdown, not just examples. Fixes #610 (#613)
* Highlight all Markdown, not just examples. Fixes #610

* Fix html output fixture

* Remove unrelated change
2016-11-21 17:47:00 -05:00
Friedel Ziegelmayer
70c081fbe9 fix(config): only strip comments on json files (#611)
* fix(config): only strip comments on json files

Fixes #608

* refactor(config): use path.extname instead of custom logic
2016-11-21 13:27:05 -05:00
Tom MacWright
98beb6dbd8 Check length before assigning to a return tag (#606) 2016-11-18 20:20:46 -05:00
Tom MacWright
29cd58bb31 Merge inferred return type like we do for params. Refs #359 (#604) 2016-11-18 11:59:15 -05:00
Tom MacWright
4dc8cb0ca9 Support system.import with nice handy babel plugin (#603)
* Support system.import with nice handy babel plugin

* Use a smaller import

* Use smaller imports here too
2016-11-18 10:51:03 -05:00
Tom MacWright
2ac4d04a8d Format optional types with ? instead of [] (#538)
* Format optional types with ? instead of []

Fixes #509

* ? as postfix not prefix

* Update test fixtures
2016-11-18 09:48:25 -05:00
Tom MacWright
1c48a4f80d Fix membership assignment for old-fashioned prototype members (#599)
Fixes #598

This _changes behavior_: previously in the case of

```js
/** base */
var Foo = function Bar() {
  {
    /** */
    this.baz = 0;
  }
};
```

We assigned baz to Bar. Now we will assign Baz to Foo. I believe this is
right, since in JavaScript Bar is not actually bound in this code.
2016-11-16 11:32:59 -05:00
Tom MacWright
375e8007b2 Update Node API to include only exposed API surface 2016-11-11 11:22:07 -05:00
Tom MacWright
ab62619af8 Fix linker stack null reference (#590) 2016-11-10 15:26:27 -05:00
Matthew Vlietstra
78ac0b093b * Fixed windows serve, see #336. (#581) 2016-10-31 20:52:33 -07:00
Erik Arvidsson
0fa38736cd Update Doctrine
Update Doctrine to 1.5 to pick up BooleanLiteralType.

Make sure we can output html/md for BooleanLiteralType.

Towards #512
2016-10-24 12:23:48 -04:00
Erik Arvidsson
efa76ef7b5 Pick up comments on VariableDeclarations (#571)
When we find the binding for an export we get the VariableDeclarator.
It is common for people to write their JSDoc comment on the parent
VariableDeclaration so we check that in case there is no comment on the
declarator.

Fixes #570
2016-10-21 13:08:36 -07:00
Patrick Gotthardt
9e6bcefacc Resolve imports without extension (#569)
For `--document-exported` we now use Node.js's `require.resolve`
method to resolve the path for modules referenced by other modules.

This fixes issues where we failed to load imported modules which lead to
a null comment being attached which caused an exception.
2016-10-16 11:10:05 -07:00
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