eslint-plugin-jsdoc 41.1.0 → 41.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -130,10 +130,12 @@ Finally, enable all of the rules that you would like to use.
|
|
|
130
130
|
"jsdoc/check-values": 1, // Recommended
|
|
131
131
|
"jsdoc/empty-tags": 1, // Recommended
|
|
132
132
|
"jsdoc/implements-on-classes": 1, // Recommended
|
|
133
|
+
"jsdoc/informative-docs": 1,
|
|
133
134
|
"jsdoc/match-description": 1,
|
|
134
135
|
"jsdoc/multiline-blocks": 1, // Recommended
|
|
135
136
|
"jsdoc/newline-after-description": 1, // Recommended
|
|
136
137
|
"jsdoc/no-bad-blocks": 1,
|
|
138
|
+
"jsdoc/no-blank-block-descriptions": 1,
|
|
137
139
|
"jsdoc/no-defaults": 1,
|
|
138
140
|
"jsdoc/no-missing-syntax": 1,
|
|
139
141
|
"jsdoc/no-multi-asterisks": 1, // Recommended
|
|
@@ -20444,6 +20446,22 @@ export function readFixture(path: string): void;
|
|
|
20444
20446
|
export function readFixture(path: string);
|
|
20445
20447
|
// "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
|
|
20446
20448
|
// Message: Missing JSDoc @returns declaration.
|
|
20449
|
+
|
|
20450
|
+
/**
|
|
20451
|
+
* @param {array} a
|
|
20452
|
+
*/
|
|
20453
|
+
async function foo(a) {
|
|
20454
|
+
return Promise.all(a);
|
|
20455
|
+
}
|
|
20456
|
+
// Message: Missing JSDoc @returns declaration.
|
|
20457
|
+
|
|
20458
|
+
/**
|
|
20459
|
+
* Description.
|
|
20460
|
+
*/
|
|
20461
|
+
export default async function demo() {
|
|
20462
|
+
return true;
|
|
20463
|
+
}
|
|
20464
|
+
// Message: Missing JSDoc @returns declaration.
|
|
20447
20465
|
````
|
|
20448
20466
|
|
|
20449
20467
|
The following patterns are not considered problems:
|
|
@@ -20928,13 +20946,6 @@ async function foo() {
|
|
|
20928
20946
|
return new Promise(resolve => resolve());
|
|
20929
20947
|
}
|
|
20930
20948
|
|
|
20931
|
-
/**
|
|
20932
|
-
* @param {array} a
|
|
20933
|
-
*/
|
|
20934
|
-
async function foo(a) {
|
|
20935
|
-
return Promise.all(a);
|
|
20936
|
-
}
|
|
20937
|
-
|
|
20938
20949
|
/**
|
|
20939
20950
|
* @param ms time in millis
|
|
20940
20951
|
*/
|
|
@@ -74,7 +74,7 @@ var _default = (0, _iterateJsdoc.default)(({
|
|
|
74
74
|
if (forceReturnsWithAsync && isAsync) {
|
|
75
75
|
return true;
|
|
76
76
|
}
|
|
77
|
-
return
|
|
77
|
+
return iteratingFunction && utils.hasValueOrExecutorHasNonEmptyResolveValue(forceReturnsWithAsync);
|
|
78
78
|
};
|
|
79
79
|
if (shouldReport()) {
|
|
80
80
|
report(`Missing JSDoc @${tagName} declaration.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireReturns.js","names":["_iterateJsdoc","_interopRequireDefault","require","obj","__esModule","default","canSkip","utils","hasATag","avoidDocs","_default","iterateJsdoc","report","context","forceRequireReturn","forceReturnsWithAsync","options","tagName","getPreferredTagName","tags","getTags","length","iteratingFunction","isIteratingFunction","tag","missingReturnTag","shouldReport","isVirtualFunction","isAsync","hasTag","hasValueOrExecutorHasNonEmptyResolveValue","contextDefaults","meta","docs","description","url","schema","additionalProperties","properties","checkConstructors","type","checkGetters","contexts","items","anyOf","comment","exemptedBy","exports","module"],"sources":["../../src/rules/requireReturns.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\n/**\n * We can skip checking for a return value, in case the documentation is inherited\n * or the method is either a constructor or an abstract method.\n *\n * In either of these cases the return value is optional or not defined.\n *\n * @param {*} utils\n * a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean}\n * true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not an error if it declares a return value but does not implement it.\n 'abstract',\n 'virtual',\n\n // Constructors do not have a return value by definition (https://jsdoc.app/tags-class.html)\n // So we can bail out here, too.\n 'class',\n 'constructor',\n\n // Return type is specified by type in @type\n 'type',\n\n // This seems to imply a class as well\n 'interface',\n ]) ||\n utils.avoidDocs();\n};\n\nexport default iterateJsdoc(({\n report,\n utils,\n context,\n}) => {\n const {\n forceRequireReturn = false,\n forceReturnsWithAsync = false,\n } = context.options[0] || {};\n\n // A preflight check. We do not need to run a deep check\n // in case the @returns comment is optional or undefined.\n if (canSkip(utils)) {\n return;\n }\n\n const tagName = utils.getPreferredTagName({\n tagName: 'returns',\n });\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n }\n\n const iteratingFunction = utils.isIteratingFunction();\n\n // In case the code returns something, we expect a return value in JSDoc.\n const [\n tag,\n ] = tags;\n const missingReturnTag = typeof tag === 'undefined' || tag === null;\n\n const shouldReport = () => {\n if (!missingReturnTag) {\n return false;\n }\n\n if (forceRequireReturn && (\n iteratingFunction || utils.isVirtualFunction()\n )) {\n return true;\n }\n\n const isAsync = !iteratingFunction && utils.hasTag('async') ||\n iteratingFunction && utils.isAsync();\n\n if (forceReturnsWithAsync && isAsync) {\n return true;\n }\n\n return
|
|
1
|
+
{"version":3,"file":"requireReturns.js","names":["_iterateJsdoc","_interopRequireDefault","require","obj","__esModule","default","canSkip","utils","hasATag","avoidDocs","_default","iterateJsdoc","report","context","forceRequireReturn","forceReturnsWithAsync","options","tagName","getPreferredTagName","tags","getTags","length","iteratingFunction","isIteratingFunction","tag","missingReturnTag","shouldReport","isVirtualFunction","isAsync","hasTag","hasValueOrExecutorHasNonEmptyResolveValue","contextDefaults","meta","docs","description","url","schema","additionalProperties","properties","checkConstructors","type","checkGetters","contexts","items","anyOf","comment","exemptedBy","exports","module"],"sources":["../../src/rules/requireReturns.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\n/**\n * We can skip checking for a return value, in case the documentation is inherited\n * or the method is either a constructor or an abstract method.\n *\n * In either of these cases the return value is optional or not defined.\n *\n * @param {*} utils\n * a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean}\n * true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not an error if it declares a return value but does not implement it.\n 'abstract',\n 'virtual',\n\n // Constructors do not have a return value by definition (https://jsdoc.app/tags-class.html)\n // So we can bail out here, too.\n 'class',\n 'constructor',\n\n // Return type is specified by type in @type\n 'type',\n\n // This seems to imply a class as well\n 'interface',\n ]) ||\n utils.avoidDocs();\n};\n\nexport default iterateJsdoc(({\n report,\n utils,\n context,\n}) => {\n const {\n forceRequireReturn = false,\n forceReturnsWithAsync = false,\n } = context.options[0] || {};\n\n // A preflight check. We do not need to run a deep check\n // in case the @returns comment is optional or undefined.\n if (canSkip(utils)) {\n return;\n }\n\n const tagName = utils.getPreferredTagName({\n tagName: 'returns',\n });\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n }\n\n const iteratingFunction = utils.isIteratingFunction();\n\n // In case the code returns something, we expect a return value in JSDoc.\n const [\n tag,\n ] = tags;\n const missingReturnTag = typeof tag === 'undefined' || tag === null;\n\n const shouldReport = () => {\n if (!missingReturnTag) {\n return false;\n }\n\n if (forceRequireReturn && (\n iteratingFunction || utils.isVirtualFunction()\n )) {\n return true;\n }\n\n const isAsync = !iteratingFunction && utils.hasTag('async') ||\n iteratingFunction && utils.isAsync();\n\n if (forceReturnsWithAsync && isAsync) {\n return true;\n }\n\n return iteratingFunction && utils.hasValueOrExecutorHasNonEmptyResolveValue(\n forceReturnsWithAsync,\n );\n };\n\n if (shouldReport()) {\n report(`Missing JSDoc @${tagName} declaration.`);\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that returns are documented.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkConstructors: {\n default: false,\n type: 'boolean',\n },\n checkGetters: {\n default: true,\n type: 'boolean',\n },\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n exemptedBy: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n forceRequireReturn: {\n default: false,\n type: 'boolean',\n },\n forceReturnsWithAsync: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAIC,KAAK,IAAK;EACzB,OAAOA,KAAK,CAACC,OAAO,CAAC;EACnB;EACA;EACA;EACA;EACA;EACA,UAAU,EACV,SAAS;EAET;EACA;EACA,OAAO,EACP,aAAa;EAEb;EACA,MAAM;EAEN;EACA,WAAW,CACZ,CAAC,IACAD,KAAK,CAACE,SAAS,EAAE;AACrB,CAAC;AAAC,IAAAC,QAAA,GAEa,IAAAC,qBAAY,EAAC,CAAC;EAC3BC,MAAM;EACNL,KAAK;EACLM;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,kBAAkB,GAAG,KAAK;IAC1BC,qBAAqB,GAAG;EAC1B,CAAC,GAAG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,IAAI,EAAE;MACJC,WAAW,EAAE,uCAAuC;MACpDC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,iBAAiB,EAAE;UACjBlC,OAAO,EAAE,KAAK;UACdmC,IAAI,EAAE;QACR,CAAC;QACDC,YAAY,EAAE;UACZpC,OAAO,EAAE,IAAI;UACbmC,IAAI,EAAE;QACR,CAAC;QACDE,QAAQ,EAAE;UACRC,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEJ,IAAI,EAAE;YACR,CAAC,EACD;cACEH,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVO,OAAO,EAAE;kBACPL,IAAI,EAAE;gBACR,CAAC;gBACD3B,OAAO,EAAE;kBACP2B,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDM,UAAU,EAAE;UACVH,KAAK,EAAE;YACLH,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACD1B,kBAAkB,EAAE;UAClBT,OAAO,EAAE,KAAK;UACdmC,IAAI,EAAE;QACR,CAAC;QACDzB,qBAAqB,EAAE;UACrBV,OAAO,EAAE,KAAK;UACdmC,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAO,OAAA,CAAA1C,OAAA,GAAAK,QAAA;AAAAsC,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAA1C,OAAA"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@es-joy/jsdoccomment": "~0.37.0",
|
|
9
|
-
"are-docs-informative": "^0.0.
|
|
9
|
+
"are-docs-informative": "^0.0.2",
|
|
10
10
|
"comment-parser": "1.3.1",
|
|
11
11
|
"debug": "^4.3.4",
|
|
12
12
|
"escape-string-regexp": "^4.0.0",
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
"test-cov": "cross-env TIMING=1 nyc --reporter text npm run test-no-cov",
|
|
122
122
|
"test-index": "npm run test-no-cov -- test/rules/index.js"
|
|
123
123
|
},
|
|
124
|
-
"version": "41.1.
|
|
124
|
+
"version": "41.1.2"
|
|
125
125
|
}
|