Repository: eslint/doctrine (js)

Issue:
Allow omission of type in returns tag
Currently doctrine permits syntax like

```js
/**
 * @param foo - this is a param
 */
```

But not the same for return values

```js
/**
 * @returns foo - this is a return value
 */
```

Having both tags with optional type annotations would be great since the type annotations can often inferred by Flow/TS.

Pull request description:
Fix: permit return tag without type (fixes #136)

Patch:
diff --git a/lib/doctrine.js b/lib/doctrine.js
index c38830a..cbfadae 100644
--- a/lib/doctrine.js
+++ b/lib/doctrine.js
@@ -70,6 +70,10 @@
         return title === 'param' || title === 'argument' || title === 'arg';
     }
 
+    function isReturnTitle(title) {
+        return title === 'return' || title === 'returns';
+    }
+
     function isProperty(title) {
         return title === 'property' || title === 'prop';
     }
@@ -88,10 +92,10 @@
     }
 
     function isTypeParameterRequired(title) {
-        return isParamTitle(title) || title === 'define' || title === 'enum' ||
-            title === 'implements' || title === 'return' ||
-            title === 'this' || title === 'type' || title === 'typedef' ||
-            title === 'returns' || isProperty(title);
+        return isParamTitle(title) || isReturnTitle(title) ||
+            title === 'define' || title === 'enum' ||
+            title === 'implements' || title === 'this' ||
+            title === 'type' || title === 'typedef' || isProperty(title);
     }
 
     // Consider deprecation instead using 'isTypeParameterRequired' and 'Rules' declaration to pick when a type is optional/required
@@ -421,7 +425,7 @@
                 try {
                     this._tag.type = parseType(this._title, this._last);
                     if (!this._tag.type) {
-                        if (!isParamTitle(this._title)) {
+                        if (!isParamTitle(this._title) && !isReturnTitle(this._title)) {
                             if (!this.addError('Missing or invalid tag type')) {
                                 return false;
                             }


Test patch:
diff --git a/test/parse.js b/test/parse.js
index 7220af1..4ecbf8c 100644
--- a/test/parse.js
+++ b/test/parse.js
@@ -2054,6 +2054,19 @@ describe('recovery tests', function() {
          res.tags[1].should.have.property('name', 'f2');
 	});
 
+	it ('return no type', function() {
+		var res = doctrine.parse(
+            [
+                "@return a value"
+            ].join('\n'));
+
+         // return tag should exist
+         res.tags.should.have.length(1);
+         res.tags[0].should.have.property('title', 'return');
+         res.tags[0].should.have.property('type', null);
+         res.tags[0].should.have.property('description', 'a value');
+	});
+
 	it ('extra @ 1', function() {
 		var res = doctrine.parse(
             [