eslint-plugin-jsdoc 50.6.5 → 50.6.6
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/dist/rules/emptyTags.cjs
CHANGED
|
@@ -30,9 +30,11 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
30
30
|
return tag === tagName;
|
|
31
31
|
}) || settings.mode === 'closure' && emptyIfClosure.has(tagName) || settings.mode !== 'closure' && emptyIfNotClosure.has(tagName);
|
|
32
32
|
});
|
|
33
|
-
for (const tag of emptyTags) {
|
|
33
|
+
for (const [key, tag] of emptyTags.entries()) {
|
|
34
34
|
const content = tag.name || tag.description || tag.type;
|
|
35
|
-
if (content.trim()
|
|
35
|
+
if (content.trim() && (
|
|
36
|
+
// Allow for JSDoc-block final asterisks
|
|
37
|
+
key !== emptyTags.length - 1 || !/^\s*\*+$/u.test(content))) {
|
|
36
38
|
const fix = () => {
|
|
37
39
|
// By time of call in fixer, `tag` will have `line` added
|
|
38
40
|
utils.setTag(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emptyTags.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","defaultEmptyTags","Set","emptyIfNotClosure","emptyIfClosure","_default","exports","iterateJsdoc","settings","jsdoc","utils","emptyTags","filterTags","tag","tagName","has","hasOptionTag","tags","some","mode","content","name","description","type","trim","fix","setTag","reportJSDoc","checkInternal","checkPrivate","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/emptyTags.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst defaultEmptyTags = new Set([\n 'abstract', 'async', 'generator', 'global', 'hideconstructor',\n 'ignore', 'inner', 'instance', 'override', 'readonly',\n\n // jsdoc doesn't use this form in its docs, but allow for compatibility with\n // TypeScript which allows and Closure which requires\n 'inheritDoc',\n\n // jsdoc doesn't use but allow for TypeScript\n 'internal',\n 'overload',\n]);\n\nconst emptyIfNotClosure = new Set([\n 'package', 'private', 'protected', 'public', 'static',\n\n // Closure doesn't allow with this casing\n 'inheritdoc',\n]);\n\nconst emptyIfClosure = new Set([\n 'interface',\n]);\n\nexport default iterateJsdoc(({\n settings,\n jsdoc,\n utils,\n}) => {\n const emptyTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return defaultEmptyTags.has(tagName) ||\n utils.hasOptionTag(tagName) && jsdoc.tags.some(({\n tag,\n }) => {\n return tag === tagName;\n }) ||\n settings.mode === 'closure' && emptyIfClosure.has(tagName) ||\n settings.mode !== 'closure' && emptyIfNotClosure.has(tagName);\n });\n\n for (const tag of emptyTags) {\n const content = tag.name || tag.description || tag.type;\n if (content.trim()) {\n const fix = () => {\n // By time of call in fixer, `tag` will have `line` added\n utils.setTag(\n /**\n * @type {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer\n * }}\n */ (tag),\n );\n };\n\n utils.reportJSDoc(`@${tag.tag} should be empty.`, tag, fix, true);\n }\n }\n}, {\n checkInternal: true,\n checkPrivate: true,\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Expects specific tags to be empty of any content.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/empty-tags.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n tags: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C,MAAMG,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,EAC7D,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;AAErD;AACA;AACA,YAAY;AAEZ;AACA,UAAU,EACV,UAAU,CACX,CAAC;AAEF,MAAMC,iBAAiB,GAAG,IAAID,GAAG,CAAC,CAChC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ;AAErD;AACA,YAAY,CACb,CAAC;AAEF,MAAME,cAAc,GAAG,IAAIF,GAAG,CAAC,CAC7B,WAAW,CACZ,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEY,IAAAO,qBAAY,EAAC,CAAC;EAC3BC,QAAQ;EACRC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAMC,SAAS,GAAGD,KAAK,CAACE,UAAU,CAAC,CAAC;IAClCC,GAAG,EAAEC;EACP,CAAC,KAAK;IACJ,OAAOb,gBAAgB,CAACc,GAAG,CAACD,OAAO,CAAC,IAClCJ,KAAK,CAACM,YAAY,CAACF,OAAO,CAAC,IAAIL,KAAK,CAACQ,IAAI,CAACC,IAAI,CAAC,CAAC;MAC9CL;IACF,CAAC,KAAK;MACJ,OAAOA,GAAG,KAAKC,OAAO;IACxB,CAAC,CAAC,IACFN,QAAQ,CAACW,IAAI,KAAK,SAAS,IAAIf,cAAc,CAACW,GAAG,CAACD,OAAO,CAAC,IAC1DN,QAAQ,CAACW,IAAI,KAAK,SAAS,IAAIhB,iBAAiB,CAACY,GAAG,CAACD,OAAO,CAAC;EACjE,CAAC,CAAC;EAEF,KAAK,
|
|
1
|
+
{"version":3,"file":"emptyTags.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","defaultEmptyTags","Set","emptyIfNotClosure","emptyIfClosure","_default","exports","iterateJsdoc","settings","jsdoc","utils","emptyTags","filterTags","tag","tagName","has","hasOptionTag","tags","some","mode","key","entries","content","name","description","type","trim","length","test","fix","setTag","reportJSDoc","checkInternal","checkPrivate","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/emptyTags.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst defaultEmptyTags = new Set([\n 'abstract', 'async', 'generator', 'global', 'hideconstructor',\n 'ignore', 'inner', 'instance', 'override', 'readonly',\n\n // jsdoc doesn't use this form in its docs, but allow for compatibility with\n // TypeScript which allows and Closure which requires\n 'inheritDoc',\n\n // jsdoc doesn't use but allow for TypeScript\n 'internal',\n 'overload',\n]);\n\nconst emptyIfNotClosure = new Set([\n 'package', 'private', 'protected', 'public', 'static',\n\n // Closure doesn't allow with this casing\n 'inheritdoc',\n]);\n\nconst emptyIfClosure = new Set([\n 'interface',\n]);\n\nexport default iterateJsdoc(({\n settings,\n jsdoc,\n utils,\n}) => {\n const emptyTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return defaultEmptyTags.has(tagName) ||\n utils.hasOptionTag(tagName) && jsdoc.tags.some(({\n tag,\n }) => {\n return tag === tagName;\n }) ||\n settings.mode === 'closure' && emptyIfClosure.has(tagName) ||\n settings.mode !== 'closure' && emptyIfNotClosure.has(tagName);\n });\n\n for (const [key, tag] of emptyTags.entries()) {\n const content = tag.name || tag.description || tag.type;\n if (content.trim() && (\n // Allow for JSDoc-block final asterisks\n key !== emptyTags.length - 1 || !(/^\\s*\\*+$/u).test(content)\n )) {\n const fix = () => {\n // By time of call in fixer, `tag` will have `line` added\n utils.setTag(\n /**\n * @type {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer\n * }}\n */ (tag),\n );\n };\n\n utils.reportJSDoc(`@${tag.tag} should be empty.`, tag, fix, true);\n }\n }\n}, {\n checkInternal: true,\n checkPrivate: true,\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Expects specific tags to be empty of any content.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/empty-tags.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n tags: {\n items: {\n type: 'string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HANGED
|
@@ -42,9 +42,12 @@ export default iterateJsdoc(({
|
|
|
42
42
|
settings.mode !== 'closure' && emptyIfNotClosure.has(tagName);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
for (const tag of emptyTags) {
|
|
45
|
+
for (const [key, tag] of emptyTags.entries()) {
|
|
46
46
|
const content = tag.name || tag.description || tag.type;
|
|
47
|
-
if (content.trim()
|
|
47
|
+
if (content.trim() && (
|
|
48
|
+
// Allow for JSDoc-block final asterisks
|
|
49
|
+
key !== emptyTags.length - 1 || !(/^\s*\*+$/u).test(content)
|
|
50
|
+
)) {
|
|
48
51
|
const fix = () => {
|
|
49
52
|
// By time of call in fixer, `tag` will have `line` added
|
|
50
53
|
utils.setTag(
|