This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 424128 - Provide missing JSDoc rule for eslint
Summary: Provide missing JSDoc rule for eslint
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: JS Tools (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 5.0 M2   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 426483
Blocks:
  Show dependency tree
 
Reported: 2013-12-16 09:41 EST by Michael Rennie CLA
Modified: 2014-01-23 13:34 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2013-12-16 09:41:05 EST
We should add a rule for eslint that will tell you if you 'forgot' to add doc to a  function decl / expression.

For example:

function Foo() {
};

would mark 'Foo' and report "Missing documentation for function 'Foo'"

also:

var obj = {
  init: function() {
  }
}

would mark 'init' and report "Missing documentation for function 'init'"
Comment 1 Michael Rennie CLA 2013-12-16 14:34:57 EST
Pushed to Gerrit:

https://git.eclipse.org/r/19875
Comment 2 Michael Rennie CLA 2013-12-16 14:45:10 EST
I almost forgot to mention, this requires a newer version of estraverse, since it makes use of the esraverse.attachComments API.

The new version is being asked for: https://dev.eclipse.org/ipzilla/show_bug.cgi?id=7769
Comment 3 Michael Rennie CLA 2013-12-17 14:15:08 EST
(In reply to Michael Rennie from comment #2)
> I almost forgot to mention, this requires a newer version of estraverse,
> since it makes use of the esraverse.attachComments API.
> 
> The new version is being asked for:
> https://dev.eclipse.org/ipzilla/show_bug.cgi?id=7769

I pushed an updated version that has configurable severity levels for each of the checks - default is 'ignore'
Comment 4 Michael Rennie CLA 2013-12-18 15:22:47 EST
(In reply to Michael Rennie from comment #3)
> (In reply to Michael Rennie from comment #2)
> > I almost forgot to mention, this requires a newer version of estraverse,
> > since it makes use of the esraverse.attachComments API.
> > 
> > The new version is being asked for:
> > https://dev.eclipse.org/ipzilla/show_bug.cgi?id=7769
> 
> I pushed an updated version that has configurable severity levels for each
> of the checks - default is 'ignore'

Created a new change in Gerrit to fix up all the conflicts: https://git.eclipse.org/r/20011
Comment 5 Michael Rennie CLA 2013-12-20 12:04:29 EST
(In reply to Michael Rennie from comment #4)
> Created a new change in Gerrit to fix up all the conflicts:
> https://git.eclipse.org/r/20011

I ammended the last commit with some tests for the new detection.

This lead me to find an edge case. Consider the following snippet:

Foo.bar.func = function() {};

I would expect 'func' (or 'Foo.bar.func') to be marked as a problem since it is being assigned to a function.

An example of this pattern in practice is the ESRefactor lib code where all exports are defined like:

Context.prototype.func1 = function() {}
Context.prototype.func2 = function() {}
...etc...
return Context;
Comment 6 Michael Rennie CLA 2013-12-20 14:56:43 EST
(In reply to Michael Rennie from comment #5)

> This lead me to find an edge case. Consider the following snippet:
> 
> Foo.bar.func = function() {};
> 

Pushed new change to fix this + more tests to gerrit.