@@ -21,6 +21,7 @@ JSDoc linting rules for ESLint.
21
21
* [ ` check-types ` ] ( #eslint-plugin-jsdoc-rules-check-types )
22
22
* [ ` newline-after-description ` ] ( #eslint-plugin-jsdoc-rules-newline-after-description )
23
23
* [ ` no-undefined-types ` ] ( #eslint-plugin-jsdoc-rules-no-undefined-types )
24
+ * [ ` require-description ` ] ( #eslint-plugin-jsdoc-rules-require-description )
24
25
* [ ` require-description-complete-sentence ` ] ( #eslint-plugin-jsdoc-rules-require-description-complete-sentence )
25
26
* [ ` require-example ` ] ( #eslint-plugin-jsdoc-rules-require-example )
26
27
* [ ` require-hyphen-before-param-description ` ] ( #eslint-plugin-jsdoc-rules-require-hyphen-before-param-description )
@@ -44,6 +45,7 @@ This table maps the rules between `eslint-plugin-jsdoc` and `jscs-jsdoc`.
44
45
| [ ` check-tag-names ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-tag-names ) | N/A ~ [ ` checkAnnotations ` ] ( https://github.com/jscs-dev/jscs-jsdoc#checkannotations ) |
45
46
| [ ` check-types ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-types ) | [ ` checkTypes ` ] ( https://github.com/jscs-dev/jscs-jsdoc#checktypes ) |
46
47
| [ ` newline-after-description ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-newline-after-description ) | [ ` requireNewlineAfterDescription ` ] ( https://github.com/jscs-dev/jscs-jsdoc#requirenewlineafterdescription ) and [ ` disallowNewlineAfterDescription ` ] ( https://github.com/jscs-dev/jscs-jsdoc#disallownewlineafterdescription ) |
48
+ | [ ` require-description ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-description ) | N/A |
47
49
| [ ` require-description-complete-sentence ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-description-complete-sentence ) | [ ` requireDescriptionCompleteSentence ` ] ( https://github.com/jscs-dev/jscs-jsdoc#requiredescriptioncompletesentence ) |
48
50
| [ ` require-example ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-example ) | N/A |
49
51
| [ ` require-hyphen-before-param-description ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-hyphen-before-param-description ) | [ ` requireHyphenBeforeDescription ` ] ( https://github.com/jscs-dev/jscs-jsdoc#requirehyphenbeforedescription ) |
@@ -100,6 +102,7 @@ Finally, enable all of the rules that you would like to use.
100
102
"jsdoc/check-types" : 1 ,
101
103
"jsdoc/newline-after-description" : 1 ,
102
104
"jsdoc/no-undefined-types" : 1 ,
105
+ "jsdoc/require-description" : 1 ,
103
106
"jsdoc/require-description-complete-sentence" : 1 ,
104
107
"jsdoc/require-example" : 1 ,
105
108
"jsdoc/require-hyphen-before-param-description" : 1 ,
@@ -873,6 +876,71 @@ function quux(foo) {
873
876
```
874
877
875
878
879
+ <a name =" eslint-plugin-jsdoc-rules-require-description " ></a >
880
+ ### <code >require-description</code >
881
+
882
+ Requires that all functions have a description.
883
+
884
+ * All functions must have a ` @description ` tag.
885
+ * Every description tag must have a non-empty description that explains the purpose of the method.
886
+
887
+ |||
888
+ | ---| ---|
889
+ | Context| ` ArrowFunctionExpression ` , ` FunctionDeclaration ` , ` FunctionExpression ` |
890
+ | Tags| ` class ` , ` example ` |
891
+
892
+ The following patterns are considered problems:
893
+
894
+ ``` js
895
+ /**
896
+ *
897
+ */
898
+ function quux () {
899
+
900
+ }
901
+ // Message: Missing JSDoc @description declaration.
902
+
903
+ /**
904
+ * @description
905
+ */
906
+ function quux () {
907
+
908
+ }
909
+ // Message: Missing JSDoc @description description.
910
+ ```
911
+
912
+ The following patterns are not considered problems:
913
+
914
+ ``` js
915
+ /**
916
+ * @description
917
+ * // arbitrary description content
918
+ */
919
+ function quux () {
920
+
921
+ }
922
+
923
+ /**
924
+ * @description
925
+ * quux(); // does something useful
926
+ */
927
+ function quux () {
928
+
929
+ }
930
+
931
+ /**
932
+ * @description <caption>Valid usage</caption>
933
+ * quux(); // does something useful
934
+ *
935
+ * @description <caption>Invalid usage</caption>
936
+ * quux('random unwanted arg'); // results in an error
937
+ */
938
+ function quux () {
939
+
940
+ }
941
+ ```
942
+
943
+
876
944
<a name =" eslint-plugin-jsdoc-rules-require-description-complete-sentence " ></a >
877
945
### <code >require-description-complete-sentence</code >
878
946
0 commit comments