documenting an angularjs/browserify project

Given the following AngularJS/Browserify app structure:
/app/main.js
angular.module('myApp', [
     'myApp.services.SomeSubModule'
]).config(require('config.js'));

/app/config.js
module.exports=['SomeSubModule', function (SomeSubModule) {
     // do stuff with SomeSubModule
}];

/services/index.js
angular.module('myApp.services', [])
     .factory('SomeSubModule', require('SomeSubModule.js'));

/services/SomeSubModule.js
module.exports=function () {
     return {
          someMethod: function () {
               // do cool stuff
          }
     }
};

How would you go about documenting it, so that WebStorm can do proper code completion, i.e. when I type SomeSubModule in the main config.js function, it knows that there is a method named "someMethod" available?

1 comment
Comment actions Permalink

WebStorm doesn't yet support documentingAMD/commonJS stuff (https://youtrack.jetbrains.com/issue/WEB-11493)
For now the suggested approach is using @class tag to annotate exported objects/functions, and then use inline JSDoc for parameter type - see https://gist.github.com/ulitink/9757354

0

Please sign in to leave a comment.