Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

JSDoc fixes - Modify defaults, param name optional and new type support #419

Merged
merged 12 commits into from
Aug 25, 2016

Conversation

bgriffith
Copy link
Contributor

@bgriffith bgriffith commented Aug 24, 2016

Few fixes in this PR 🎉

Fix 1 - Modify defaults

This PR switches what JSDoc defaults to when deciding how many captures to check for. Currently it defaults to 4 with one requiring an @return or @returns tag to only check for 3.

Having read the docs further, it's become obvious that 3 should be the default for all tags except for when we have a @param or @type which then requires 4.

Fix 2 - Make param name optional

I've also made the param name optional and this change fixes an issue with tags that only have a type specified.

Before:
screen shot 2016-08-24 at 21 29 00

After:
screen shot 2016-08-24 at 21 29 29

Fix 3 - Add support for types with a set of type arguments

Adds support a type with a set of type arguments. I.e. Array<string> an array of strings.

Before:
screen shot 2016-08-24 at 22 54 50

After:
screen shot 2016-08-24 at 22 50 52

Fix 4 - Add support for unknown type

Adds support for the unknown type {?}

Before:
screen shot 2016-08-24 at 22 59 58

After:
screen shot 2016-08-24 at 23 03 12

Fix 5 - Add support for key-value pair types

Adds support for specifying the types of key-value pairs within the parameter.

Before:
screen shot 2016-08-24 at 23 25 46

After:
screen shot 2016-08-24 at 23 25 26

Lastly

🎨 Added whitespace to break up extremely long JSDoc rules and increase readability. (Please let me know if there's a specific style I should follow!)

@bgriffith bgriffith changed the title Modify JSDoc defaults JSDoc fixes - Modify defaults, param name optional and new type support Aug 24, 2016
@winstliu
Copy link
Contributor

winstliu commented Aug 25, 2016

Can you also add some comments for people not familiar with the JSDoc syntax? For example, adding a comment after the \\? to signify that that's the unknown type.

(It'll also help me to review a lot easier :))

({(?:
\\* |
\\? |
(?:\\?|\\!|\\.{3})?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the ! needs to be escaped.

@bgriffith
Copy link
Contributor Author

@50Wliu Hey! Sure will do. Can you give me a heads up on how to comment within an extended match? What's the syntax? I can't seem to find an example.

@Alhadis
Copy link
Contributor

Alhadis commented Aug 25, 2016

(?# This) or # This.

Also, install this.

EDIT: 👇 Yeah, that.

@winstliu
Copy link
Contributor

Just <your regex> # comment in an extended regex. As long as the comment is at the end of the line you're fine.

@bgriffith
Copy link
Contributor Author

@Alhadis @50Wliu Cheers guys 👍

@bgriffith
Copy link
Contributor Author

@50Wliu Something like that ok?

@winstliu
Copy link
Contributor

Yeah - that helps so much!

@winstliu winstliu merged commit bb98796 into atom:master Aug 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants