JSDoc plugin pre-process typical MobX tags to make them parsable
Currently - parsing MobX tags results in errors such as
ERROR: Unable to parse ../SomeMobXComponent.js: Unexpected character '@'
This simple plugin for JSDoc aims to fix that.
Currently supports common MobX tags, such as
@observer
@observable
@computed
The jsdoc-mobx-tags
plugin can be installed using NPM.
npm install --save-dev jsdoc-mobx-tags
To use plugin you should include the plugin module in the plugins
array of
JSDoc's configuration file.
{
"plugins": ["node_modules/jsdoc-mobx-tags/jsdoc-mobx-tags"]
}
Assumes layout to be in the form -
@observer
/**
* Some documentation
* Some more js documentation
*/
class SomeComponent extends React.Component {
<Your Component code here>
}
Output :
/**
* MobX @observer
* Some documentation
* Some more js documentation
*/
class SomeComponent extends React.Component {
<Your Component code here>
}
Assumes layout to be in the form similar to @observer
-
@computed
/**
* Some description
*
* @return {type} Some type
*/
get someValue() {
return this.value;
}
Output :
/**
* MobX @computed
* Some description
*
* @return {type} Some type
*/
get someValue() {
return this.value;
}
Assumes layout to be in the form -
/* JSDOC: MARK START OBSERVABLE */
@observable someVariable = 0
@observable someString = ''
/* JSDOC: MARK END OBSERVABLE */
Output :
mobxObservables() {
/**
* MobX @observable
*/
someVariable = 0
/**
* MobX @observable
*/
someString = ''
}
Feel free to open issues/PRs. This is implemented as a quick hack for my own usage, but I realised that some others may find it useful too :)