Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code.context is an empty object #15

Open
tunnckoCore opened this issue Sep 21, 2019 · 4 comments
Open

code.context is an empty object #15

tunnckoCore opened this issue Sep 21, 2019 · 4 comments

Comments

@tunnckoCore
Copy link

tunnckoCore commented Sep 21, 2019

Hey @jonschlinkert :)

The comment's code.context is an empty object when using export default, arrow function.

/**
 * Foobar 1 with default export arrow function and typescript
 * and empty code.context
 *
 * @param  {string} `commit` a commit message
 * @api public
 */

export default (commit: string): Commit => {};

/**
 * Foobar 2 with default export arrow function JS
 * and empty code.context
 *
 * @param  {string} `commit` a commit message
 * @api public
 */

export default (commit) => {};

/**
 * Foobar 3 with default export named function and typescript
 *
 * @param  {string} `commit` a commit message
 * @api public
 */

export default function foobar(commit: string): Commit {}

/**
 * Foobar 4 with default export named function javascript
 *
 * @param  {string} `commit` a commit message
 * @api public
 */

export default function foobar(commit) {}

/**
 * Foobar 5 with default export arrow function and typescript
 *
 * @param  {string} `commit` a commit message
 * @api public
 */

module.exports = (commit: string): Commit => {};

/**
 * Foobar 6 with default export arrow function JS
 *
 * @param  {string} `commit` a commit message
 * @api public
 */

module.exports = (commit) => {};

/**
 * Foobar 7 with default export named function and typescript
 *
 * @param  {string} `commit` a commit message
 * @api public
 */

module.exports = function foobar(commit: string): Commit {};

/**
 * Foobar 8 with default export named function javascript
 *
 * @param  {string} `commit` a commit message
 * @api public
 */

module.exports = function foobar(commit) {};
@jonschlinkert
Copy link
Owner

jonschlinkert commented Sep 21, 2019 via email

@tunnckoCore
Copy link
Author

tunnckoCore commented Sep 21, 2019

It's not. The Foobar 2 example don't have types. But okay, cool :)

So far so good, api docs generation in 50 lines :D Just playing around with PoC to test how the latest parse-commits works. And it's great 🎉

2019-09-21-061926_1280x1024_scrot
2019-09-21-062241_1280x1024_scrot

@jonschlinkert
Copy link
Owner

jonschlinkert commented Sep 22, 2019 via email

@tunnckoCore
Copy link
Author

Another example is object methods

{
  use: () => {},
  use() {},
  use: foo
}

Also, the code.value is an empty string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants