Skip to content

Commit 07212ab

Browse files
authored
Merge pull request #154 from teppeis/update-readme
docs: generate docs
2 parents ffcace9 + 3d3c1b3 commit 07212ab

File tree

1 file changed

+48
-241
lines changed

1 file changed

+48
-241
lines changed

README.md

Lines changed: 48 additions & 241 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ JSDoc linting rules for ESLint.
3333
* [`require-param`](#eslint-plugin-jsdoc-rules-require-param)
3434
* [`require-returns-description`](#eslint-plugin-jsdoc-rules-require-returns-description)
3535
* [`require-returns-type`](#eslint-plugin-jsdoc-rules-require-returns-type)
36+
* [`require-returns-check`](#eslint-plugin-jsdoc-rules-require-returns-check)
3637
* [`require-returns`](#eslint-plugin-jsdoc-rules-require-returns)
3738
* [`valid-types`](#eslint-plugin-jsdoc-rules-valid-types)
3839

@@ -58,6 +59,7 @@ This table maps the rules between `eslint-plugin-jsdoc` and `jscs-jsdoc`.
5859
| [`require-param-name`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-param-name) | N/A |
5960
| [`require-param-type`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-param-type) | [`requireParamTypes`](https://github.com/jscs-dev/jscs-jsdoc#requireparamtypes) |
6061
| [`require-returns`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns) | [`requireReturn`](https://github.com/jscs-dev/jscs-jsdoc#requirereturn) |
62+
| [`require-returns-check`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns-check) | [`requireReturn`](https://github.com/jscs-dev/jscs-jsdoc#requirereturncheck) |
6163
| [`require-returns-description`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns-description) | [`requireReturnDescription`](https://github.com/jscs-dev/jscs-jsdoc#requirereturndescription) |
6264
| [`require-returns-type`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns-type) | [`requireReturnTypes`](https://github.com/jscs-dev/jscs-jsdoc#requirereturntypes) |
6365
| [`valid-types`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-valid-types) | N/A |
@@ -117,6 +119,7 @@ Finally, enable all of the rules that you would like to use.
117119
"jsdoc/require-param-name": 1,
118120
"jsdoc/require-param-type": 1,
119121
"jsdoc/require-returns": 1,
122+
"jsdoc/require-returns-check": 1,
120123
"jsdoc/require-returns-description": 1,
121124
"jsdoc/require-returns-type": 1,
122125
"jsdoc/valid-types": 1
@@ -376,7 +379,7 @@ function quux () {
376379

377380
}
378381
// Settings: {"jsdoc":{"baseConfig":{"rules":{"no-undef":["error"]}},"eslintrcForExamples":false,"noDefaultExampleRules":true}}
379-
// Message: @example error (semi): Extra semicolon.
382+
// Message: @example error (no-undef): 'quux' is not defined.
380383

381384
/**
382385
* @example <caption>Valid usage</caption>
@@ -2197,10 +2200,10 @@ function quux () {
21972200
````
21982201

21992202

2200-
<a name="eslint-plugin-jsdoc-rules-require-returns"></a>
2201-
### <code>require-returns</code>
2203+
<a name="eslint-plugin-jsdoc-rules-require-returns-check"></a>
2204+
### <code>require-returns-check</code>
22022205

2203-
Requires returns are documented.
2206+
Checks if the return expression exists in function body and in the comment.
22042207

22052208
|||
22062209
|---|---|
@@ -2211,302 +2214,106 @@ The following patterns are considered problems:
22112214

22122215
````js
22132216
/**
2214-
*
2215-
*/
2216-
function quux (foo) {
2217-
2218-
}
2219-
// Message: Missing JSDoc @param "foo" declaration.
2220-
2221-
/**
2222-
*
2223-
*/
2224-
function quux (foo) {
2225-
2226-
}
2227-
// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
2228-
// Message: Missing JSDoc @arg "foo" declaration.
2229-
2230-
/**
2231-
* @param foo
2232-
*/
2233-
function quux (foo, bar) {
2234-
2235-
}
2236-
// Message: Missing JSDoc @param "bar" declaration.
2237-
2238-
/**
2239-
* @override
2240-
*/
2241-
function quux (foo) {
2242-
2243-
}
2244-
// Message: Missing JSDoc @param "foo" declaration.
2245-
2246-
/**
2247-
* @implements
2248-
*/
2249-
function quux (foo) {
2250-
2251-
}
2252-
// Message: Missing JSDoc @param "foo" declaration.
2253-
2254-
/**
2255-
* @augments
2217+
* @returns
22562218
*/
22572219
function quux (foo) {
22582220

22592221
}
2260-
// Message: Missing JSDoc @param "foo" declaration.
2222+
// Message: Present JSDoc @returns declaration but not available return expression in function.
22612223

22622224
/**
2263-
* @extends
2225+
* @return
22642226
*/
22652227
function quux (foo) {
22662228

22672229
}
2268-
// Message: Missing JSDoc @param "foo" declaration.
2269-
2270-
/**
2271-
* @override
2272-
*/
2273-
class A {
2274-
/**
2275-
*
2276-
*/
2277-
quux (foo) {
2278-
2279-
}
2280-
}
2281-
// Message: Missing JSDoc @param "foo" declaration.
2282-
2283-
/**
2284-
* @implements
2285-
*/
2286-
class A {
2287-
/**
2288-
*
2289-
*/
2290-
quux (foo) {
2291-
2292-
}
2293-
}
2294-
// Message: Missing JSDoc @param "foo" declaration.
2295-
2296-
/**
2297-
* @augments
2298-
*/
2299-
class A {
2300-
/**
2301-
*
2302-
*/
2303-
quux (foo) {
2304-
2305-
}
2306-
}
2307-
// Message: Missing JSDoc @param "foo" declaration.
2308-
2309-
/**
2310-
* @extends
2311-
*/
2312-
class A {
2313-
/**
2314-
*
2315-
*/
2316-
quux (foo) {
2317-
2318-
}
2319-
}
2320-
// Message: Missing JSDoc @param "foo" declaration.
2230+
// Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
2231+
// Message: Present JSDoc @return declaration but not available return expression in function.
23212232
````
23222233

23232234
The following patterns are not considered problems:
23242235

23252236
````js
23262237
/**
2327-
* @param foo
2328-
*/
2329-
function quux (foo) {
2330-
2331-
}
2332-
2333-
/**
2334-
* @inheritdoc
2335-
*/
2336-
function quux (foo) {
2337-
2338-
}
2339-
2340-
/**
2341-
* @arg foo
2238+
* @returns Foo.
23422239
*/
2343-
function quux (foo) {
2240+
function quux () {
23442241

2242+
return foo;
23452243
}
2346-
// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
23472244

23482245
/**
2349-
* @override
2350-
* @param foo
2246+
* @returns {void} Foo.
23512247
*/
2352-
function quux (foo) {
2248+
function quux () {
23532249

2250+
return foo;
23542251
}
23552252

23562253
/**
2357-
* @override
2254+
* @returns {undefined} Foo.
23582255
*/
2359-
function quux (foo) {
2256+
function quux () {
23602257

2258+
return foo;
23612259
}
2362-
// Settings: {"jsdoc":{"allowOverrideWithoutParam":true}}
23632260

23642261
/**
2365-
* @implements
2262+
*
23662263
*/
2367-
function quux (foo) {
2368-
2264+
function quux () {
23692265
}
2370-
// Settings: {"jsdoc":{"allowImplementsWithoutParam":true}}
2266+
````
23712267

2372-
/**
2373-
* @implements
2374-
* @param foo
2375-
*/
2376-
function quux (foo) {
23772268

2378-
}
2379-
2380-
/**
2381-
* @augments
2382-
*/
2383-
function quux (foo) {
2269+
<a name="eslint-plugin-jsdoc-rules-require-returns"></a>
2270+
### <code>require-returns</code>
23842271

2385-
}
2386-
// Settings: {"jsdoc":{"allowAugmentsExtendsWithoutParam":true}}
2272+
Requires returns are documented.
23872273

2388-
/**
2389-
* @augments
2390-
* @param foo
2391-
*/
2392-
function quux (foo) {
2274+
|||
2275+
|---|---|
2276+
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
2277+
|Tags|`returns`|
23932278

2394-
}
2279+
The following patterns are considered problems:
23952280

2281+
````js
23962282
/**
2397-
* @extends
2283+
*
23982284
*/
23992285
function quux (foo) {
24002286

2287+
return foo;
24012288
}
2402-
// Settings: {"jsdoc":{"allowAugmentsExtendsWithoutParam":true}}
2289+
// Message: Missing JSDoc @returns declaration.
24032290

24042291
/**
2405-
* @extends
2406-
* @param foo
2292+
*
24072293
*/
24082294
function quux (foo) {
24092295

2296+
return foo;
24102297
}
2298+
// Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
2299+
// Message: Missing JSDoc @return declaration.
2300+
````
24112301

2412-
/**
2413-
* @override
2414-
*/
2415-
class A {
2416-
/**
2417-
* @param foo
2418-
*/
2419-
quux (foo) {
2420-
2421-
}
2422-
}
2423-
2424-
/**
2425-
* @override
2426-
*/
2427-
class A {
2428-
/**
2429-
*
2430-
*/
2431-
quux (foo) {
2432-
2433-
}
2434-
}
2435-
// Settings: {"jsdoc":{"allowOverrideWithoutParam":true}}
2436-
2437-
/**
2438-
* @implements
2439-
*/
2440-
class A {
2441-
/**
2442-
*
2443-
*/
2444-
quux (foo) {
2445-
2446-
}
2447-
}
2448-
// Settings: {"jsdoc":{"allowImplementsWithoutParam":true}}
2449-
2450-
/**
2451-
* @implements
2452-
*/
2453-
class A {
2454-
/**
2455-
* @param foo
2456-
*/
2457-
quux (foo) {
2458-
2459-
}
2460-
}
2461-
2462-
/**
2463-
* @augments
2464-
*/
2465-
class A {
2466-
/**
2467-
*
2468-
*/
2469-
quux (foo) {
2470-
2471-
}
2472-
}
2473-
// Settings: {"jsdoc":{"allowAugmentsExtendsWithoutParam":true}}
2474-
2475-
/**
2476-
* @augments
2477-
*/
2478-
class A {
2479-
/**
2480-
* @param foo
2481-
*/
2482-
quux (foo) {
2483-
2484-
}
2485-
}
2302+
The following patterns are not considered problems:
24862303

2304+
````js
24872305
/**
2488-
* @extends
2306+
* @returns Foo.
24892307
*/
2490-
class A {
2491-
/**
2492-
*
2493-
*/
2494-
quux (foo) {
2308+
function quux () {
24952309

2496-
}
2310+
return foo;
24972311
}
2498-
// Settings: {"jsdoc":{"allowAugmentsExtendsWithoutParam":true}}
24992312

25002313
/**
2501-
* @extends
2314+
*
25022315
*/
2503-
class A {
2504-
/**
2505-
* @param foo
2506-
*/
2507-
quux (foo) {
2508-
2509-
}
2316+
function quux () {
25102317
}
25112318
````
25122319

0 commit comments

Comments
 (0)