eslint-plugin-jsdoc 37.9.7 → 38.0.0
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
|
@@ -6608,7 +6608,7 @@ The default is this basic expression to match English sentences (Support
|
|
|
6608
6608
|
for Unicode upper case may be added in a future version when it can be handled
|
|
6609
6609
|
by our supported Node versions):
|
|
6610
6610
|
|
|
6611
|
-
``^([A-Z]|[`\\d_])[\\s\\S]*[.?!`]
|
|
6611
|
+
``^([A-Z]|[`\\d_])[\\s\\S]*[.?!`]\\s*$``
|
|
6612
6612
|
|
|
6613
6613
|
Applies to the jsdoc block description and `@description` (or `@desc`)
|
|
6614
6614
|
by default but the `tags` option (see below) may be used to match other tags.
|
|
@@ -6960,7 +6960,7 @@ function quux (foo) {
|
|
|
6960
6960
|
function quux (foo) {
|
|
6961
6961
|
|
|
6962
6962
|
}
|
|
6963
|
-
// "jsdoc/match-description": ["error"|"warn", {"mainDescription":"^[a-zA-Z]*$","tags":{"param":true}}]
|
|
6963
|
+
// "jsdoc/match-description": ["error"|"warn", {"mainDescription":"^[a-zA-Z]*\\s*$","tags":{"param":true}}]
|
|
6964
6964
|
// Message: JSDoc description does not satisfy the regex pattern.
|
|
6965
6965
|
|
|
6966
6966
|
/**
|
|
@@ -6971,7 +6971,7 @@ function quux (foo) {
|
|
|
6971
6971
|
function quux (foo) {
|
|
6972
6972
|
|
|
6973
6973
|
}
|
|
6974
|
-
// "jsdoc/match-description": ["error"|"warn", {"mainDescription":{"match":"^[a-zA-Z]*$","message":"Letters only"},"tags":{"param":{"match":true,"message":"Needs to begin with a capital letter and end with a period."}}}]
|
|
6974
|
+
// "jsdoc/match-description": ["error"|"warn", {"mainDescription":{"match":"^[a-zA-Z]*\\s*$","message":"Letters only"},"tags":{"param":{"match":true,"message":"Needs to begin with a capital letter and end with a period."}}}]
|
|
6975
6975
|
// Message: Needs to begin with a capital letter and end with a period.
|
|
6976
6976
|
|
|
6977
6977
|
/**
|
|
@@ -7151,6 +7151,16 @@ function quux (foo) {
|
|
|
7151
7151
|
}
|
|
7152
7152
|
// Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
|
|
7153
7153
|
// Message: JSDoc description does not satisfy the regex pattern.
|
|
7154
|
+
|
|
7155
|
+
/**
|
|
7156
|
+
* Description with extra new line
|
|
7157
|
+
*
|
|
7158
|
+
*/
|
|
7159
|
+
function quux () {
|
|
7160
|
+
|
|
7161
|
+
}
|
|
7162
|
+
// "jsdoc/match-description": ["error"|"warn", {"matchDescription":"[\\s\\S]*\\S$"}]
|
|
7163
|
+
// Message: JSDoc description does not satisfy the regex pattern.
|
|
7154
7164
|
````
|
|
7155
7165
|
|
|
7156
7166
|
The following patterns are not considered problems:
|
|
@@ -20695,7 +20705,7 @@ The first option is a single string set to "always", "never", or "any"
|
|
|
20695
20705
|
(defaults to "never").
|
|
20696
20706
|
|
|
20697
20707
|
"any" is only useful with `tags` (allowing non-enforcement of lines except
|
|
20698
|
-
for particular tags)
|
|
20708
|
+
for particular tags) or with `dropEndLines`.
|
|
20699
20709
|
|
|
20700
20710
|
The second option is an object with the following optional properties.
|
|
20701
20711
|
|
|
@@ -20712,6 +20722,12 @@ Use with "always" to indicate the number of lines to require be present.
|
|
|
20712
20722
|
Use with "always" to indicate the normal lines to be added after tags should
|
|
20713
20723
|
not be added after the final tag.
|
|
20714
20724
|
|
|
20725
|
+
<a name="user-content-eslint-plugin-jsdoc-rules-tag-lines-options-41-dropendlines-defaults-to-false"></a>
|
|
20726
|
+
<a name="eslint-plugin-jsdoc-rules-tag-lines-options-41-dropendlines-defaults-to-false"></a>
|
|
20727
|
+
##### <code>dropEndLines</code> (defaults to <code>false</code>)
|
|
20728
|
+
|
|
20729
|
+
If defined, will drop end lines for the final tag only.
|
|
20730
|
+
|
|
20715
20731
|
<a name="user-content-eslint-plugin-jsdoc-rules-tag-lines-options-41-tags-default-to-empty-object"></a>
|
|
20716
20732
|
<a name="eslint-plugin-jsdoc-rules-tag-lines-options-41-tags-default-to-empty-object"></a>
|
|
20717
20733
|
##### <code>tags</code> (default to empty object)
|
|
@@ -20869,6 +20885,20 @@ The following patterns are considered problems:
|
|
|
20869
20885
|
*/
|
|
20870
20886
|
// "jsdoc/tag-lines": ["error"|"warn", "always"]
|
|
20871
20887
|
// Message: Expected 1 line between tags but found 0
|
|
20888
|
+
|
|
20889
|
+
/**
|
|
20890
|
+
* Some description
|
|
20891
|
+
* @param {string} a
|
|
20892
|
+
* @param {string} b
|
|
20893
|
+
*
|
|
20894
|
+
* @returns {SomeType} An extended
|
|
20895
|
+
* description.
|
|
20896
|
+
*
|
|
20897
|
+
* This is still part of `@returns`.
|
|
20898
|
+
*
|
|
20899
|
+
*/
|
|
20900
|
+
// "jsdoc/tag-lines": ["error"|"warn", "any",{"dropEndLines":true}]
|
|
20901
|
+
// Message: Expected no trailing lines
|
|
20872
20902
|
````
|
|
20873
20903
|
|
|
20874
20904
|
The following patterns are not considered problems:
|
|
@@ -21026,6 +21056,18 @@ The following patterns are not considered problems:
|
|
|
21026
21056
|
*
|
|
21027
21057
|
*/
|
|
21028
21058
|
// "jsdoc/tag-lines": ["error"|"warn", "always"]
|
|
21059
|
+
|
|
21060
|
+
/**
|
|
21061
|
+
* Some description
|
|
21062
|
+
* @param {string} a
|
|
21063
|
+
* @param {string} b
|
|
21064
|
+
*
|
|
21065
|
+
* @returns {SomeType} An extended
|
|
21066
|
+
* description.
|
|
21067
|
+
*
|
|
21068
|
+
* This is still part of `@returns`.
|
|
21069
|
+
*/
|
|
21070
|
+
// "jsdoc/tag-lines": ["error"|"warn", "any",{"dropEndLines":true}]
|
|
21029
21071
|
````
|
|
21030
21072
|
|
|
21031
21073
|
|
|
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
11
11
|
|
|
12
12
|
// If supporting Node >= 10, we could loosen the default to this for the
|
|
13
13
|
// initial letter: \\p{Upper}
|
|
14
|
-
const matchDescriptionDefault = '^[A-Z`\\d_][\\s\\S]*[.?!`]
|
|
14
|
+
const matchDescriptionDefault = '^[A-Z`\\d_][\\s\\S]*[.?!`]\\s*$';
|
|
15
15
|
|
|
16
16
|
const stringOrDefault = (value, userDefault) => {
|
|
17
17
|
return typeof value === 'string' ? value : userDefault || matchDescriptionDefault;
|
|
@@ -70,7 +70,7 @@ var _default = (0, _iterateJsdoc.default)(({
|
|
|
70
70
|
const {
|
|
71
71
|
description
|
|
72
72
|
} = utils.getDescription();
|
|
73
|
-
validateDescription(description
|
|
73
|
+
validateDescription(description);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
if (!tags || !Object.keys(tags).length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/rules/matchDescription.js"],"names":["matchDescriptionDefault","stringOrDefault","value","userDefault","jsdoc","report","context","utils","mainDescription","matchDescription","message","tags","options","validateDescription","description","tag","mainDescriptionMatch","errorMessage","match","Object","prototype","hasOwnProperty","call","tagValue","tagName","regex","getRegexFromString","test","line","source","number","getDescription","replace","keys","length","hasOptionTag","Boolean","forEachPreferredTag","matchingJsdocTag","targetTagName","name","getTagDescription","trim","whitelistedTags","filterTags","tagsWithNames","tagsWithoutNames","getTagsByType","some","contextDefaults","meta","docs","url","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","oneOf","format","patternProperties","enum"],"mappings":";;;;;;;AAAA;;;;AAEA;AACA;AACA,MAAMA,uBAAuB,GAAG,6BAAhC;;AAEA,MAAMC,eAAe,GAAG,CAACC,KAAD,EAAQC,WAAR,KAAwB;AAC9C,SAAO,OAAOD,KAAP,KAAiB,QAAjB,GACLA,KADK,GAELC,WAAW,IAAIH,uBAFjB;AAGD,CAJD;;eAMe,2BAAa,CAAC;AAC3BI,EAAAA,KAD2B;AAE3BC,EAAAA,MAF2B;AAG3BC,EAAAA,OAH2B;AAI3BC,EAAAA;AAJ2B,CAAD,KAKtB;AACJ,QAAM;AACJC,IAAAA,eADI;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qBEA,gBAAAA,IAAI,EAAE;AArBR,eAXK;AADH;AADW,WADf;AAwCJA,UAAAA,IAAI,EAAE;AAxCF;AA7DI,OAFd;AA0GEA,MAAAA,IAAI,EAAE;AA1GR,KADM,CALJ;AAmHJA,IAAAA,IAAI,EAAE;AAnHF;AAFL,CApGY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\n// If supporting Node >= 10, we could loosen the default to this for the\n// initial letter: \\\\p{Upper}\nconst matchDescriptionDefault = '^[A-Z`\\\\d_][\\\\s\\\\S]*[.?!`]$';\n\nconst stringOrDefault = (value, userDefault) => {\n return typeof value === 'string' ?\n value :\n userDefault || matchDescriptionDefault;\n};\n\nexport default iterateJsdoc(({\n jsdoc,\n report,\n context,\n utils,\n}) => {\n const {\n mainDescription,\n matchDescription,\n message,\n tags,\n } = context.options[0] || {};\n\n const validateDescription = (description, tag) => {\n let mainDescriptionMatch = mainDescription;\n let errorMessage = message;\n if (typeof mainDescription === 'object') {\n mainDescriptionMatch = mainDescription.match;\n errorMessage = mainDescription.message;\n }\n\n if (mainDescriptionMatch === false && (\n !tag || !Object.prototype.hasOwnProperty.call(tags, tag.tag))\n ) {\n return;\n }\n\n let tagValue = mainDescriptionMatch;\n if (tag) {\n const tagName = tag.tag;\n if (typeof tags[tagName] === 'object') {\n tagValue = tags[tagName].match;\n errorMessage = tags[tagName].message;\n } else {\n tagValue = tags[tagName];\n }\n }\n\n const regex = utils.getRegexFromString(\n stringOrDefault(tagValue, matchDescription),\n );\n\n if (!regex.test(description)) {\n report(\n errorMessage || 'JSDoc description does not satisfy the regex pattern.',\n null,\n tag || {\n // Add one as description would typically be into block\n line: jsdoc.source[0].number + 1,\n },\n );\n }\n };\n\n if (jsdoc.description) {\n const {\n description,\n } = utils.getDescription();\n validateDescription(\n description.replace(/\\s+$/u, ''),\n );\n }\n\n if (!tags || !Object.keys(tags).length) {\n return;\n }\n\n const hasOptionTag = (tagName) => {\n return Boolean(tags[tagName]);\n };\n\n utils.forEachPreferredTag('description', (matchingJsdocTag, targetTagName) => {\n const description = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n if (hasOptionTag(targetTagName)) {\n validateDescription(description, matchingJsdocTag);\n }\n }, true);\n\n const whitelistedTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return hasOptionTag(tagName);\n });\n const {\n tagsWithNames,\n tagsWithoutNames,\n } = utils.getTagsByType(whitelistedTags);\n\n tagsWithNames.some((tag) => {\n const description = utils.getTagDescription(tag).replace(/^[- ]*/u, '')\n .trim();\n\n return validateDescription(description, tag);\n });\n\n tagsWithoutNames.some((tag) => {\n const description = (tag.name + ' ' + utils.getTagDescription(tag)).trim();\n\n return validateDescription(description, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Enforces a regular expression pattern on descriptions.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-match-description',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\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 mainDescription: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n matchDescription: {\n format: 'regex',\n type: 'string',\n },\n message: {\n type: 'string',\n },\n tags: {\n patternProperties: {\n '.*': {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"matchDescription.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/rules/matchDescription.js"],"names":["matchDescriptionDefault","stringOrDefault","value","userDefault","jsdoc","report","context","utils","mainDescription","matchDescription","message","tags","options","validateDescription","description","tag","mainDescriptionMatch","errorMessage","match","Object","prototype","hasOwnProperty","call","tagValue","tagName","regex","getRegexFromString","test","line","source","number","getDescription","keys","length","hasOptionTag","Boolean","forEachPreferredTag","matchingJsdocTag","targetTagName","name","getTagDescription","trim","whitelistedTags","filterTags","tagsWithNames","tagsWithoutNames","getTagsByType","some","replace","contextDefaults","meta","docs","url","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","oneOf","format","patternProperties","enum"],"mappings":";;;;;;;AAAA;;;;AAEA;AACA;AACA,MAAMA,uBAAuB,GAAG,iCAAhC;;AAEA,MAAMC,eAAe,GAAG,CAACC,KAAD,EAAQC,WAAR,KAAwB;AAC9C,SAAO,OAAOD,KAAP,KAAiB,QAAjB,GACLA,KADK,GAELC,WAAW,IAAIH,uBAFjB;AAGD,CAJD;;eAMe,2BAAa,CAAC;AAC3BI,EAAAA,KAD2B;AAE3BC,EAAAA,MAF2B;AAG3BC,EAAAA,OAH2B;AAI3BC,EAAAA;AAJ2B,CAAD,KAKtB;AACJ,QAAM;AACJC,IAAAA,eADI;AAEJC,IAAAA,gBAFI;AAGJC,IAAAA,OAHI;AAIJC,IAAAA;AAJI,MAKFL,OAAO,CAACM,OAAR,CAAgB,CAAhB,KAAsB,EAL1B;;AAOA,QAAMC,mBAAmB,GAAG,CAACC,WAAD,EAAcC,GAAd,KAAsB;AAChD,QAAIC,oBAAoB,GAAGR,eAA3B;AACA,QAAIS,YAAY,GAAGP,OAAnB;;AACA,QAAI,OAAOF,eAAP,KAA2B,QAA/B,EAAyC;AACvCQ,MAAAA,oBAAoB,GAAG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AAkBEA,YAAAA,IAAI,EAAE;AAlBR,WARK;AADQ,SAvBP;AAsDVlD,QAAAA,gBAAgB,EAAE;AAChBqD,UAAAA,MAAM,EAAE,OADQ;AAEhBH,UAAAA,IAAI,EAAE;AAFU,SAtDR;AA0DVjD,QAAAA,OAAO,EAAE;AACPiD,UAAAA,IAAI,EAAE;AADC,SA1DC;AA6DVhD,QAAAA,IAAI,EAAE;AACJoD,UAAAA,iBAAiB,EAAE;AACjB,kBAAM;AACJF,cAAAA,KAAK,EAAE,CACL;AACEC,gBAAAA,MAAM,EAAE,OADV;AAEEH,gBAAAA,IAAI,EAAE;AAFR,eADK,EAKL;AACEK,gBAAAA,IAAI,EAAE,CACJ,IADI,CADR;AAIEL,gBAAAA,IAAI,EAAE;AAJR,eALK,EAWL;AACEL,gBAAAA,oBAAoB,EAAE,KADxB;AAEEC,gBAAAA,UAAU,EAAE;AACVrC,kBAAAA,KAAK,EAAE;AACL2C,oBAAAA,KAAK,EAAE,CACL;AACEC,sBAAAA,MAAM,EAAE,OADV;AAEEH,sBAAAA,IAAI,EAAE;AAFR,qBADK,EAKL;AACEK,sBAAAA,IAAI,EAAE,CACJ,IADI,CADR;AAIEL,sBAAAA,IAAI,EAAE;AAJR,qBALK;AADF,mBADG;AAeVjD,kBAAAA,OAAO,EAAE;AACPiD,oBAAAA,IAAI,EAAE;AADC;AAfC,iBAFd;AAqBEA,gBAAAA,IAAI,EAAE;AArBR,eAXK;AADH;AADW,WADf;AAwCJA,UAAAA,IAAI,EAAE;AAxCF;AA7DI,OAFd;AA0GEA,MAAAA,IAAI,EAAE;AA1GR,KADM,CALJ;AAmHJA,IAAAA,IAAI,EAAE;AAnHF;AAFL,CAlGY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\n// If supporting Node >= 10, we could loosen the default to this for the\n// initial letter: \\\\p{Upper}\nconst matchDescriptionDefault = '^[A-Z`\\\\d_][\\\\s\\\\S]*[.?!`]\\\\s*$';\n\nconst stringOrDefault = (value, userDefault) => {\n return typeof value === 'string' ?\n value :\n userDefault || matchDescriptionDefault;\n};\n\nexport default iterateJsdoc(({\n jsdoc,\n report,\n context,\n utils,\n}) => {\n const {\n mainDescription,\n matchDescription,\n message,\n tags,\n } = context.options[0] || {};\n\n const validateDescription = (description, tag) => {\n let mainDescriptionMatch = mainDescription;\n let errorMessage = message;\n if (typeof mainDescription === 'object') {\n mainDescriptionMatch = mainDescription.match;\n errorMessage = mainDescription.message;\n }\n\n if (mainDescriptionMatch === false && (\n !tag || !Object.prototype.hasOwnProperty.call(tags, tag.tag))\n ) {\n return;\n }\n\n let tagValue = mainDescriptionMatch;\n if (tag) {\n const tagName = tag.tag;\n if (typeof tags[tagName] === 'object') {\n tagValue = tags[tagName].match;\n errorMessage = tags[tagName].message;\n } else {\n tagValue = tags[tagName];\n }\n }\n\n const regex = utils.getRegexFromString(\n stringOrDefault(tagValue, matchDescription),\n );\n\n if (!regex.test(description)) {\n report(\n errorMessage || 'JSDoc description does not satisfy the regex pattern.',\n null,\n tag || {\n // Add one as description would typically be into block\n line: jsdoc.source[0].number + 1,\n },\n );\n }\n };\n\n if (jsdoc.description) {\n const {\n description,\n } = utils.getDescription();\n validateDescription(description);\n }\n\n if (!tags || !Object.keys(tags).length) {\n return;\n }\n\n const hasOptionTag = (tagName) => {\n return Boolean(tags[tagName]);\n };\n\n utils.forEachPreferredTag('description', (matchingJsdocTag, targetTagName) => {\n const description = (matchingJsdocTag.name + ' ' + utils.getTagDescription(matchingJsdocTag)).trim();\n if (hasOptionTag(targetTagName)) {\n validateDescription(description, matchingJsdocTag);\n }\n }, true);\n\n const whitelistedTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return hasOptionTag(tagName);\n });\n const {\n tagsWithNames,\n tagsWithoutNames,\n } = utils.getTagsByType(whitelistedTags);\n\n tagsWithNames.some((tag) => {\n const description = utils.getTagDescription(tag).replace(/^[- ]*/u, '')\n .trim();\n\n return validateDescription(description, tag);\n });\n\n tagsWithoutNames.some((tag) => {\n const description = (tag.name + ' ' + utils.getTagDescription(tag)).trim();\n\n return validateDescription(description, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Enforces a regular expression pattern on descriptions.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-match-description',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\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 mainDescription: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n matchDescription: {\n format: 'regex',\n type: 'string',\n },\n message: {\n type: 'string',\n },\n tags: {\n patternProperties: {\n '.*': {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n {\n additionalProperties: false,\n properties: {\n match: {\n oneOf: [\n {\n format: 'regex',\n type: 'string',\n },\n {\n enum: [\n true,\n ],\n type: 'boolean',\n },\n ],\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"matchDescription.js"}
|
package/dist/rules/tagLines.js
CHANGED
|
@@ -16,11 +16,13 @@ var _default = (0, _iterateJsdoc.default)(({
|
|
|
16
16
|
}) => {
|
|
17
17
|
const [alwaysNever = 'never', {
|
|
18
18
|
count = 1,
|
|
19
|
+
dropEndLines = false,
|
|
19
20
|
noEndLines = false,
|
|
20
21
|
tags = {}
|
|
21
22
|
} = {}] = context.options;
|
|
22
23
|
jsdoc.tags.some((tg, tagIdx) => {
|
|
23
24
|
let lastTag;
|
|
25
|
+
let lastEmpty = null;
|
|
24
26
|
let reportIndex = null;
|
|
25
27
|
|
|
26
28
|
for (const [idx, {
|
|
@@ -43,14 +45,31 @@ var _default = (0, _iterateJsdoc.default)(({
|
|
|
43
45
|
continue;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
const empty = !tag && !name && !type && !description;
|
|
49
|
+
|
|
50
|
+
if (empty && !end && (alwaysNever === 'never' || lastTag && ((_tags$lastTag$slice2 = tags[lastTag.slice(1)]) === null || _tags$lastTag$slice2 === void 0 ? void 0 : _tags$lastTag$slice2.lines) === 'never')) {
|
|
47
51
|
reportIndex = idx;
|
|
48
52
|
continue;
|
|
49
53
|
}
|
|
50
54
|
|
|
55
|
+
if (!end) {
|
|
56
|
+
lastEmpty = empty ? idx : null;
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
lastTag = tag;
|
|
52
60
|
}
|
|
53
61
|
|
|
62
|
+
if (dropEndLines && lastEmpty !== null && tagIdx === jsdoc.tags.length - 1) {
|
|
63
|
+
const fixer = () => {
|
|
64
|
+
utils.removeTagItem(tagIdx, lastEmpty);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
utils.reportJSDoc('Expected no trailing lines', {
|
|
68
|
+
line: tg.source[lastEmpty].number
|
|
69
|
+
}, fixer);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
54
73
|
if (reportIndex !== null) {
|
|
55
74
|
const fixer = () => {
|
|
56
75
|
utils.removeTagItem(tagIdx, reportIndex);
|
|
@@ -142,6 +161,9 @@ var _default = (0, _iterateJsdoc.default)(({
|
|
|
142
161
|
count: {
|
|
143
162
|
type: 'integer'
|
|
144
163
|
},
|
|
164
|
+
dropEndLines: {
|
|
165
|
+
type: 'boolean'
|
|
166
|
+
},
|
|
145
167
|
noEndLines: {
|
|
146
168
|
type: 'boolean'
|
|
147
169
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/rules/tagLines.js"],"names":["context","jsdoc","utils","alwaysNever","count","noEndLines","tags","options","some","tg","tagIdx","lastTag","reportIndex","idx","tokens","tag","name","type","description","end","source","entries","includes","slice","lines","fixer","removeTagItem","reportJSDoc","line","number","currentTag","tagSourceIdx","splice","length","push","currentTg","tagCount","defaultAlways","overrideAlways","fixCount","addLines","iterateAllJsdocs","meta","docs","url","fixable","schema","enum","additionalProperies","properties","patternProperties","additionalProperties"],"mappings":";;;;;;;AAAA;;;;eAEe,2BAAa,CAAC;AAC3BA,EAAAA,OAD2B;AAE3BC,EAAAA,KAF2B;AAG3BC,EAAAA;AAH2B,CAAD,KAItB;AACJ,QAAM,CACJC,WAAW,GAAG,OADV,EAEJ;AACEC,IAAAA,KAAK,GAAG,CADV;AAEEC,IAAAA,UAAU,GAAG,KAFf;AAGEC,IAAAA,IAAI,GAAG;AAHT,MAII,EANA,IAOFN,OAAO,CAACO,OAPZ;AASAN,EAAAA,KAAK,CAACK,IAAN,CAAWE,IAAX,CAAgB,CAACC,EAAD,EAAKC,MAAL,KAAgB;AAC9B,QAAIC,OAAJ;AAEA,QAAIC,WAAW,GAAG,IAAlB;;AACA,SAAK,MAAM,CACTC,GADS,EAET;AACEC,MAAAA,MAAM,EAAE;AACNC,QAAAA,GADM;AAENC,QAAAA,IAFM;AAGNC,QAAAA,IAHM;AAINC,QAAAA,WAJM;AAKNC,QAAAA;AALM;AADV,KAFS,CAAX,IAWKV,EAAE,CAACW,MAAH,CAAUC,OAAV,EAXL,EAW0B;AAAA;;AACxB;AACA,UAAIH,WAAJ,EAAiB;AACfN,QAAAA,WAAW,GAAG,IAAd;AACD;;AAED,UAAID,OAAO,IAAI,CACb,KADa,EACN,QADM,EAEbW,QAFa,wBAEJhB,IAAI,CAACK,OAAO,CAACY,KAAR,CAAc,CAAd,CAAD,CAFA,wDAEJ,oBAAwBC,KAFpB,CAAf,EAE2C;AACzC;AACD;;AAED,UACE,CAACT,GA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AAU,EAAE;AACV7C,gBAAAA,KAAK,EAAE;AACLa,kBAAAA,IAAI,EAAE;AADD,iBADG;AAIVO,gBAAAA,KAAK,EAAE;AACLuB,kBAAAA,IAAI,EAAE,CACJ,QADI,EACM,OADN,EACe,KADf,CADD;AAIL9B,kBAAAA,IAAI,EAAE;AAJD;AAJG;AAFR;AADW,WADf;AAiBJA,UAAAA,IAAI,EAAE;AAjBF;AAPI,OAFd;AA6BEA,MAAAA,IAAI,EAAE;AA7BR,KAPM,CANJ;AA6CJA,IAAAA,IAAI,EAAE;AA7CF;AAFL,CA9IY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const [\n alwaysNever = 'never',\n {\n count = 1,\n noEndLines = false,\n tags = {},\n } = {},\n ] = context.options;\n\n jsdoc.tags.some((tg, tagIdx) => {\n let lastTag;\n\n let reportIndex = null;\n for (const [\n idx,\n {\n tokens: {\n tag,\n name,\n type,\n description,\n end,\n },\n },\n ] of tg.source.entries()) {\n // May be text after a line break within a tag description\n if (description) {\n reportIndex = null;\n }\n\n if (lastTag && [\n 'any', 'always',\n ].includes(tags[lastTag.slice(1)]?.lines)) {\n continue;\n }\n\n if (\n !tag && !name && !type && !description && !end &&\n (alwaysNever === 'never' ||\n lastTag && tags[lastTag.slice(1)]?.lines === 'never'\n )\n ) {\n reportIndex = idx;\n\n continue;\n }\n\n lastTag = tag;\n }\n\n if (reportIndex !== null) {\n const fixer = () => {\n utils.removeTagItem(tagIdx, reportIndex);\n };\n\n utils.reportJSDoc(\n 'Expected no lines between tags',\n {\n line: tg.source[0].number + 1,\n },\n fixer,\n );\n\n return true;\n }\n\n return false;\n });\n\n (noEndLines ? jsdoc.tags.slice(0, -1) : jsdoc.tags).some((tg, tagIdx) => {\n const lines = [];\n\n let currentTag;\n let tagSourceIdx = 0;\n for (const [\n idx,\n {\n number,\n tokens: {\n tag,\n name,\n type,\n description,\n end,\n },\n },\n ] of tg.source.entries()) {\n if (description) {\n lines.splice(0, lines.length);\n tagSourceIdx = idx;\n }\n\n if (tag) {\n currentTag = tag;\n }\n\n if (!tag && !name && !type && !description && !end) {\n lines.push({\n idx,\n number,\n });\n }\n }\n\n const currentTg = currentTag && tags[currentTag.slice(1)];\n const tagCount = currentTg?.count;\n\n const defaultAlways = alwaysNever === 'always' && currentTg?.lines !== 'never' &&\n currentTg?.lines !== 'any' && lines.length < count;\n\n let overrideAlways;\n let fixCount = count;\n if (!defaultAlways) {\n fixCount = typeof tagCount === 'number' ? tagCount : count;\n overrideAlways = currentTg?.lines === 'always' &&\n lines.length < fixCount;\n }\n\n if (defaultAlways || overrideAlways) {\n const fixer = () => {\n utils.addLines(tagIdx, lines[lines.length - 1]?.idx || tagSourceIdx + 1, fixCount - lines.length);\n };\n\n const line = lines[lines.length - 1]?.number || tg.source[tagSourceIdx].number;\n utils.reportJSDoc(\n `Expected ${fixCount} line${fixCount === 1 ? '' : 's'} between tags but found ${lines.length}`,\n {\n line,\n },\n fixer,\n );\n\n return true;\n }\n\n return false;\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Enforces lines (or no lines) between tags.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-tag-lines',\n },\n fixable: 'code',\n schema: [\n {\n enum: [\n 'always', 'any', 'never',\n ],\n type: 'string',\n },\n {\n additionalProperies: false,\n properties: {\n count: {\n type: 'integer',\n },\n noEndLines: {\n type: 'boolean',\n },\n tags: {\n patternProperties: {\n '.*': {\n additionalProperties: false,\n properties: {\n count: {\n type: 'integer',\n },\n lines: {\n enum: [\n 'always', 'never', 'any',\n ],\n type: 'string',\n },\n },\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"tagLines.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/rules/tagLines.js"],"names":["context","jsdoc","utils","alwaysNever","count","dropEndLines","noEndLines","tags","options","some","tg","tagIdx","lastTag","lastEmpty","reportIndex","idx","tokens","tag","name","type","description","end","source","entries","includes","slice","lines","empty","length","fixer","removeTagItem","reportJSDoc","line","number","currentTag","tagSourceIdx","splice","push","currentTg","tagCount","defaultAlways","overrideAlways","fixCount","addLines","iterateAllJsdocs","meta","docs","url","fixable","schema","enum","additionalProperies","properties","patternProperties","additionalProperties"],"mappings":";;;;;;;AAAA;;;;eAEe,2BAAa,CAAC;AAC3BA,EAAAA,OAD2B;AAE3BC,EAAAA,KAF2B;AAG3BC,EAAAA;AAH2B,CAAD,KAItB;AACJ,QAAM,CACJC,WAAW,GAAG,OADV,EAEJ;AACEC,IAAAA,KAAK,GAAG,CADV;AAEEC,IAAAA,YAAY,GAAG,KAFjB;AAGEC,IAAAA,UAAU,GAAG,KAHf;AAIEC,IAAAA,IAAI,GAAG;AAJT,MAKI,EAPA,IAQFP,OAAO,CAACQ,OARZ;AAUAP,EAAAA,KAAK,CAACM,IAAN,CAAWE,IAAX,CAAgB,CAACC,EAAD,EAAKC,MAAL,KAAgB;AAC9B,QAAIC,OAAJ;AACA,QAAIC,SAAS,GAAG,IAAhB;AAEA,QAAIC,WAAW,GAAG,IAAlB;;AACA,SAAK,MAAM,CACTC,GADS,EAET;AACEC,MAAAA,MAAM,EAAE;AACNC,QAAAA,GADM;AAENC,QAAAA,IAFM;AAGNC,QAAAA,IAHM;AAINC,QAAAA,WAJM;AAKNC,QAAAA;AALM;AADV,KAFS,CAAX,IAWKX,EAAE,CAACY,MAAH,CAAUC,OAAV,EAXL,EAW0B;AAAA;;AACxB;AACA,UAAIH,WAAJ,EAAiB;AACfN,QAAAA,WAAW,GAAG,IAAd;AACD;;AAED,UAAIF,OAAO,IAAI,CACb,KADa,EACN,QADM,EAEbY,QAFa,wBAEJjB,IAAI,CAACK,OAAO,CAACa,KAAR,CAAc,CAAd,CAAD,CAFA,wDAEJ,oBAAwBC,KAFpB,CAAf,EAE2C;AACzC;AACD;;AAED,YAAMC,KAAK,G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AA,WAAW,EAAE,4CADT;AAEJ2B,MAAAA,GAAG,EAAE;AAFD,KADF;AAKJC,IAAAA,OAAO,EAAE,MALL;AAMJC,IAAAA,MAAM,EAAE,CACN;AACEC,MAAAA,IAAI,EAAE,CACJ,QADI,EACM,KADN,EACa,OADb,CADR;AAIE/B,MAAAA,IAAI,EAAE;AAJR,KADM,EAON;AACEgC,MAAAA,mBAAmB,EAAE,KADvB;AAEEC,MAAAA,UAAU,EAAE;AACVhD,QAAAA,KAAK,EAAE;AACLe,UAAAA,IAAI,EAAE;AADD,SADG;AAIVd,QAAAA,YAAY,EAAE;AACZc,UAAAA,IAAI,EAAE;AADM,SAJJ;AAOVb,QAAAA,UAAU,EAAE;AACVa,UAAAA,IAAI,EAAE;AADI,SAPF;AAUVZ,QAAAA,IAAI,EAAE;AACJ8C,UAAAA,iBAAiB,EAAE;AACjB,kBAAM;AACJC,cAAAA,oBAAoB,EAAE,KADlB;AAEJF,cAAAA,UAAU,EAAE;AACVhD,gBAAAA,KAAK,EAAE;AACLe,kBAAAA,IAAI,EAAE;AADD,iBADG;AAIVO,gBAAAA,KAAK,EAAE;AACLwB,kBAAAA,IAAI,EAAE,CACJ,QADI,EACM,OADN,EACe,KADf,CADD;AAIL/B,kBAAAA,IAAI,EAAE;AAJD;AAJG;AAFR;AADW,WADf;AAiBJA,UAAAA,IAAI,EAAE;AAjBF;AAVI,OAFd;AAgCEA,MAAAA,IAAI,EAAE;AAhCR,KAPM,CANJ;AAgDJA,IAAAA,IAAI,EAAE;AAhDF;AAFL,CArKY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const [\n alwaysNever = 'never',\n {\n count = 1,\n dropEndLines = false,\n noEndLines = false,\n tags = {},\n } = {},\n ] = context.options;\n\n jsdoc.tags.some((tg, tagIdx) => {\n let lastTag;\n let lastEmpty = null;\n\n let reportIndex = null;\n for (const [\n idx,\n {\n tokens: {\n tag,\n name,\n type,\n description,\n end,\n },\n },\n ] of tg.source.entries()) {\n // May be text after a line break within a tag description\n if (description) {\n reportIndex = null;\n }\n\n if (lastTag && [\n 'any', 'always',\n ].includes(tags[lastTag.slice(1)]?.lines)) {\n continue;\n }\n\n const empty = !tag && !name && !type && !description;\n if (\n empty && !end &&\n (alwaysNever === 'never' ||\n lastTag && tags[lastTag.slice(1)]?.lines === 'never'\n )\n ) {\n reportIndex = idx;\n\n continue;\n }\n\n if (!end) {\n lastEmpty = empty ? idx : null;\n }\n\n lastTag = tag;\n }\n\n if (dropEndLines && lastEmpty !== null && tagIdx === jsdoc.tags.length - 1) {\n const fixer = () => {\n utils.removeTagItem(tagIdx, lastEmpty);\n };\n\n utils.reportJSDoc(\n 'Expected no trailing lines',\n {\n line: tg.source[lastEmpty].number,\n },\n fixer,\n );\n\n return true;\n }\n\n if (reportIndex !== null) {\n const fixer = () => {\n utils.removeTagItem(tagIdx, reportIndex);\n };\n\n utils.reportJSDoc(\n 'Expected no lines between tags',\n {\n line: tg.source[0].number + 1,\n },\n fixer,\n );\n\n return true;\n }\n\n return false;\n });\n\n (noEndLines ? jsdoc.tags.slice(0, -1) : jsdoc.tags).some((tg, tagIdx) => {\n const lines = [];\n\n let currentTag;\n let tagSourceIdx = 0;\n for (const [\n idx,\n {\n number,\n tokens: {\n tag,\n name,\n type,\n description,\n end,\n },\n },\n ] of tg.source.entries()) {\n if (description) {\n lines.splice(0, lines.length);\n tagSourceIdx = idx;\n }\n\n if (tag) {\n currentTag = tag;\n }\n\n if (!tag && !name && !type && !description && !end) {\n lines.push({\n idx,\n number,\n });\n }\n }\n\n const currentTg = currentTag && tags[currentTag.slice(1)];\n const tagCount = currentTg?.count;\n\n const defaultAlways = alwaysNever === 'always' && currentTg?.lines !== 'never' &&\n currentTg?.lines !== 'any' && lines.length < count;\n\n let overrideAlways;\n let fixCount = count;\n if (!defaultAlways) {\n fixCount = typeof tagCount === 'number' ? tagCount : count;\n overrideAlways = currentTg?.lines === 'always' &&\n lines.length < fixCount;\n }\n\n if (defaultAlways || overrideAlways) {\n const fixer = () => {\n utils.addLines(tagIdx, lines[lines.length - 1]?.idx || tagSourceIdx + 1, fixCount - lines.length);\n };\n\n const line = lines[lines.length - 1]?.number || tg.source[tagSourceIdx].number;\n utils.reportJSDoc(\n `Expected ${fixCount} line${fixCount === 1 ? '' : 's'} between tags but found ${lines.length}`,\n {\n line,\n },\n fixer,\n );\n\n return true;\n }\n\n return false;\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Enforces lines (or no lines) between tags.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-tag-lines',\n },\n fixable: 'code',\n schema: [\n {\n enum: [\n 'always', 'any', 'never',\n ],\n type: 'string',\n },\n {\n additionalProperies: false,\n properties: {\n count: {\n type: 'integer',\n },\n dropEndLines: {\n type: 'boolean',\n },\n noEndLines: {\n type: 'boolean',\n },\n tags: {\n patternProperties: {\n '.*': {\n additionalProperties: false,\n properties: {\n count: {\n type: 'integer',\n },\n lines: {\n enum: [\n 'always', 'never', 'any',\n ],\n type: 'string',\n },\n },\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"tagLines.js"}
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@babel/preset-env": "^7.16.11",
|
|
26
26
|
"@babel/register": "^7.17.0",
|
|
27
27
|
"@hkdobrev/run-if-changed": "^0.3.1",
|
|
28
|
-
"@typescript-eslint/parser": "^5.
|
|
28
|
+
"@typescript-eslint/parser": "^5.14.0",
|
|
29
29
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
30
30
|
"babel-plugin-istanbul": "^6.1.1",
|
|
31
31
|
"camelcase": "^6.3.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"gitdown": "^3.1.5",
|
|
38
38
|
"glob": "^7.2.0",
|
|
39
39
|
"husky": "^7.0.4",
|
|
40
|
-
"lint-staged": "^12.3.
|
|
40
|
+
"lint-staged": "^12.3.5",
|
|
41
41
|
"lodash.defaultsdeep": "^4.6.1",
|
|
42
42
|
"mocha": "^9.2.1",
|
|
43
43
|
"nyc": "^15.1.0",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"test-cov": "cross-env TIMING=1 nyc --reporter text npm run test-no-cov",
|
|
117
117
|
"test-index": "npm run test-no-cov -- test/rules/index.js"
|
|
118
118
|
},
|
|
119
|
-
"version": "
|
|
119
|
+
"version": "38.0.0"
|
|
120
120
|
}
|