How best to document React in IntelliJ IDEA?

What's the best way to document React code in IntelliJ IDEA?

If I have:

 

/**

 * Some documentation

 */

class Foo extends React.Component {

  static propTypes = {

    something: PropTypes.string,

  }

}

What's the best way to document Foo and it's propTypes so then when I write:

 

import Foo from 'foo';

...

render = () => (<Foo />);

...

 

I can now hit my Quick Documentation hotkey and actually see the documentation for Foo and what it's propTypes are?

I'm used to jsdoc, but AFAIK there's no way to get IDEA to do what I want.  I'm perfectly happy adopting a different standard, even an IDEA-specific standard if that achieves my goals.

0
3 comments

Not sure i follow you... IDEA doesn't have its own documentation standards. We are trying to support mix of tags from different standards, so users won't be forced to rewrite their documentation code to work well with IDEA. Google Closure (https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler) is supported the most completely, including type syntax. JSDoc3 is partially supported for now. 

As far as I have checked, comments attached to React component class are available on hitting Ctrl+Q on component usage...

0
Avatar
Permanently deleted user

 

> Not sure i follow you... IDEA doesn't have its own documentation standards. 

Yes.  But given it's support for Google Closure and JSDoc3, how can I accomplish what I want?

How do I document a React class that uses PropTypes such that I can pull up that documentation with Ctrl+Q?

In my example above, when my cursor is in <Foo /> and I hit Ctrl-Q, I get "No documentation found."

0

Works for me:

what IDEA version do you use? Can you provide a sample project that shows up the issue?

0

Please sign in to leave a comment.