eslint-plugin-jsdoc 39.9.1 → 40.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
@@ -2031,10 +2031,10 @@ for example.
2031
2031
  This rule allows one optional string argument. If it is `"always"` then a
2032
2032
  problem is raised when the lines are not aligned. If it is `"never"` then
2033
2033
  a problem should be raised when there is more than one space between each
2034
- line's parts. Defaults to `"never"`.
2034
+ line's parts. If it is `"any"`, no alignment is made. Defaults to `"never"`.
2035
2035
 
2036
- Note that in addition to alignment, both options will ensure at least one
2037
- space is present after the asterisk delimiter.
2036
+ Note that in addition to alignment, the "never" and "always" options will both
2037
+ ensure that at least one space is present after the asterisk delimiter.
2038
2038
 
2039
2039
  After the string, an options object is allowed with the following properties.
2040
2040
 
@@ -2042,8 +2042,7 @@ After the string, an options object is allowed with the following properties.
2042
2042
  <a name="eslint-plugin-jsdoc-rules-check-line-alignment-options-3-tags"></a>
2043
2043
  ##### <code>tags</code>
2044
2044
 
2045
- Use this to change the tags which are sought for alignment changes. *Currently*
2046
- *only works with the "never" option.* Defaults to an array of
2045
+ Use this to change the tags which are sought for alignment changes. Defaults to an array of
2047
2046
  `['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return']`.
2048
2047
 
2049
2048
  <a name="user-content-eslint-plugin-jsdoc-rules-check-line-alignment-options-3-customspacings"></a>
@@ -2060,10 +2059,24 @@ An object with any of the following keys set to an integer. Affects spacing:
2060
2059
 
2061
2060
  If a spacing is not defined, it defaults to one.
2062
2061
 
2062
+ <a name="user-content-eslint-plugin-jsdoc-rules-check-line-alignment-options-3-preservemaindescriptionpostdelimiter"></a>
2063
+ <a name="eslint-plugin-jsdoc-rules-check-line-alignment-options-3-preservemaindescriptionpostdelimiter"></a>
2064
+ ##### <code>preserveMainDescriptionPostDelimiter</code>
2065
+
2066
+ A boolean to determine whether to preserve the post-delimiter spacing of the
2067
+ main description. If `false` or unset, will be set to a single space.
2068
+
2069
+ <a name="user-content-eslint-plugin-jsdoc-rules-check-line-alignment-options-3-wrapindent"></a>
2070
+ <a name="eslint-plugin-jsdoc-rules-check-line-alignment-options-3-wrapindent"></a>
2071
+ ##### <code>wrapIndent</code>
2072
+
2073
+ The indent that will be applied for tag text after the first line.
2074
+ Default to the empty string (no indent).
2075
+
2063
2076
  |||
2064
2077
  |---|---|
2065
2078
  |Context|everywhere|
2066
- |Options|(a string matching `"always" or "never"` and optional object with `tags` and `customSpacings`)|
2079
+ |Options|(a string matching `"always"`, `"never"`, or `"any"` and optional object with `tags`, `customSpacings`, `preserveMainDescriptionPostDelimiter`, and `wrapIndent`)|
2067
2080
  |Tags|`param`, `property`, `returns` and others added by `tags`|
2068
2081
  |Aliases|`arg`, `argument`, `prop`, `return`|
2069
2082
  |Recommended|false|
@@ -2508,6 +2521,53 @@ const fn = ( lorem, sit ) => {}
2508
2521
  const fn = ( lorem, sit ) => {}
2509
2522
  // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"customSpacings":{"postHyphen":2}}]
2510
2523
  // Message: Expected JSDoc block lines to not be aligned.
2524
+
2525
+ /**
2526
+ * @param {string} lorem Description
2527
+ * with multiple lines.
2528
+ */
2529
+ function quux () {
2530
+ }
2531
+ // "jsdoc/check-line-alignment": ["error"|"warn", "any",{"wrapIndent":" "}]
2532
+ // Message: Expected wrap indent
2533
+
2534
+ /**
2535
+ * Function description.
2536
+ *
2537
+ * @param {string} lorem Description.
2538
+ * @param {int} sit Description multi
2539
+ * line with asterisks.
2540
+ */
2541
+ const fn = ( lorem, sit ) => {}
2542
+ // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"wrapIndent":" "}]
2543
+ // Message: Expected JSDoc block lines to be aligned.
2544
+
2545
+ /**
2546
+ * My function.
2547
+ *
2548
+ * @param {string} lorem Description.
2549
+ * @param {int} sit Description multiple
2550
+ * lines.
2551
+ */
2552
+ const fn = ( lorem, sit ) => {}
2553
+ // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"wrapIndent":" "}]
2554
+ // Message: Expected JSDoc block lines to not be aligned.
2555
+
2556
+ /**
2557
+ * @property {boolean} tls_verify_client_certificate - Whether our API should
2558
+ * enable TLS client authentication
2559
+ */
2560
+ function quux () {}
2561
+ // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"wrapIndent":" "}]
2562
+ // Message: Expected wrap indent
2563
+
2564
+ /**
2565
+ * @property {boolean} tls_verify_client_certificate - Whether our API should
2566
+ * enable TLS client authentication
2567
+ */
2568
+ function quux () {}
2569
+ // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"wrapIndent":""}]
2570
+ // Message: Expected wrap indent
2511
2571
  ````
2512
2572
 
2513
2573
  The following patterns are not considered problems:
@@ -2865,11 +2925,59 @@ const fn = ( lorem, sit ) => {};
2865
2925
  const fn = ( a, b ) => {};
2866
2926
  // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
2867
2927
 
2928
+ /**
2929
+ * @param {string} lorem Description
2930
+ * with multiple lines.
2931
+ */
2932
+ function quux () {
2933
+ }
2934
+ // "jsdoc/check-line-alignment": ["error"|"warn", "any",{"wrapIndent":" "}]
2935
+
2936
+ /**
2937
+ * @param {string} lorem Description
2938
+ * with multiple lines.
2939
+ */
2940
+ function quux () {
2941
+ }
2942
+ // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"wrapIndent":" "}]
2943
+
2944
+ /**
2945
+ * Function description.
2946
+ *
2947
+ * @param {string} lorem Description.
2948
+ * @param {int} sit Description multi
2949
+ * line with asterisks.
2950
+ */
2951
+ const fn = ( lorem, sit ) => {}
2952
+ // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"wrapIndent":" "}]
2953
+
2954
+ /**
2955
+ * Function description.
2956
+ *
2957
+ * @param {string} lorem Description.
2958
+ * @param {int} sit Description multi
2959
+ * line with
2960
+ * asterisks.
2961
+ */
2962
+ const fn = ( lorem, sit ) => {}
2963
+ // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"wrapIndent":" "}]
2964
+
2965
+ /**
2966
+ * @param {
2967
+ * string | number
2968
+ * } lorem Description
2969
+ * with multiple lines.
2970
+ */
2971
+ function quux () {
2972
+ }
2973
+ // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"wrapIndent":" "}]
2974
+
2868
2975
  /**
2869
2976
  * @param {string|string[]|TemplateResult|TemplateResult[]} event.detail.description -
2870
2977
  * Notification description
2871
2978
  */
2872
2979
  function quux () {}
2980
+ // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"wrapIndent":" "}]
2873
2981
  ````
2874
2982
 
2875
2983
 
@@ -90,7 +90,8 @@ const alignTransform = ({
90
90
  customSpacings,
91
91
  tags,
92
92
  indent,
93
- preserveMainDescriptionPostDelimiter
93
+ preserveMainDescriptionPostDelimiter,
94
+ wrapIndent
94
95
  }) => {
95
96
  let intoTags = false;
96
97
  let width;
@@ -154,7 +155,7 @@ const alignTransform = ({
154
155
  }
155
156
  return tokens;
156
157
  };
157
- const update = (line, index, source, typelessInfo) => {
158
+ const update = (line, index, source, typelessInfo, indentTag) => {
158
159
  const tokens = {
159
160
  ...line.tokens
160
161
  };
@@ -171,8 +172,6 @@ const alignTransform = ({
171
172
  tokens
172
173
  };
173
174
  }
174
-
175
- /* eslint-disable indent */
176
175
  switch (tokens.delimiter) {
177
176
  case _commentParser.Markers.start:
178
177
  tokens.start = indent;
@@ -186,8 +185,6 @@ const alignTransform = ({
186
185
  // compensate delimiter
187
186
  tokens.start = indent + ' ';
188
187
  }
189
- /* eslint-enable */
190
-
191
188
  if (!intoTags) {
192
189
  if (tokens.description === '') {
193
190
  tokens.postDelimiter = '';
@@ -204,15 +201,15 @@ const alignTransform = ({
204
201
  tokens.description = tokens.description.replace(hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '));
205
202
 
206
203
  // Not align.
207
- if (!shouldAlign(tags, index, source)) {
208
- return {
209
- ...line,
210
- tokens
211
- };
204
+ if (shouldAlign(tags, index, source)) {
205
+ alignTokens(tokens, typelessInfo);
206
+ if (indentTag) {
207
+ tokens.postDelimiter += wrapIndent;
208
+ }
212
209
  }
213
210
  return {
214
211
  ...line,
215
- tokens: alignTokens(tokens, typelessInfo)
212
+ tokens
216
213
  };
217
214
  };
218
215
  return ({
@@ -223,10 +220,16 @@ const alignTransform = ({
223
220
  ...zeroWidth
224
221
  });
225
222
  const typelessInfo = getTypelessInfo(fields);
223
+ let tagIndentMode = false;
226
224
  return rewireSource({
227
225
  ...fields,
228
226
  source: source.map((line, index) => {
229
- return update(line, index, source, typelessInfo);
227
+ const indentTag = tagIndentMode && !line.tokens.tag && line.tokens.description;
228
+ const ret = update(line, index, source, typelessInfo, indentTag);
229
+ if (line.tokens.tag) {
230
+ tagIndentMode = true;
231
+ }
232
+ return ret;
230
233
  })
231
234
  });
232
235
  };
@@ -1 +1 @@
1
- {"version":3,"file":"alignTransform.js","names":["rewireSource","util","zeroWidth","name","start","tag","type","shouldAlign","tags","index","source","tokens","replace","includesTag","includes","iterator","previousTag","getWidth","width","Math","max","length","delimiter","Markers","getTypelessInfo","fields","hasNoTypes","every","maxNamedTagLength","map","filter","maxUnnamedTagLength","space","len","padStart","alignTransform","customSpacings","indent","preserveMainDescriptionPostDelimiter","intoTags","alignTokens","typelessInfo","nothingAfter","delim","description","postName","postType","postTag","untypedNameAdjustment","untypedTypeAdjustment","spacings","postDelimiter","update","line","isEmpty","end","postHyphenSpacing","postHyphen","hyphenSpacing","reduce"],"sources":["../src/alignTransform.js"],"sourcesContent":["/**\n * Transform based on https://github.com/syavorsky/comment-parser/blob/master/src/transforms/align.ts\n *\n * It contains some customizations to align based on the tags, and some custom options.\n */\n\nimport {\n\n // `comment-parser/primitives` export\n Markers,\n util,\n} from 'comment-parser';\n\nconst {\n rewireSource,\n} = util;\n\nconst zeroWidth = {\n name: 0,\n start: 0,\n tag: 0,\n type: 0,\n};\n\nconst shouldAlign = (tags, index, source) => {\n const tag = source[index].tokens.tag.replace('@', '');\n const includesTag = tags.includes(tag);\n\n if (includesTag) {\n return true;\n }\n\n if (tag !== '') {\n return false;\n }\n\n for (let iterator = index; iterator >= 0; iterator--) {\n const previousTag = source[iterator].tokens.tag.replace('@', '');\n\n if (previousTag !== '') {\n if (tags.includes(previousTag)) {\n return true;\n }\n\n return false;\n }\n }\n\n return true;\n};\n\nconst getWidth = (tags) => {\n return (width, {\n tokens,\n }, index, source) => {\n if (!shouldAlign(tags, index, source)) {\n return width;\n }\n\n return {\n name: Math.max(width.name, tokens.name.length),\n start: tokens.delimiter === Markers.start ? tokens.start.length : width.start,\n tag: Math.max(width.tag, tokens.tag.length),\n type: Math.max(width.type, tokens.type.length),\n };\n };\n};\n\nconst getTypelessInfo = (fields) => {\n const hasNoTypes = fields.tags.every(({\n type,\n }) => {\n return !type;\n });\n const maxNamedTagLength = Math.max(...fields.tags.map(({\n tag,\n name,\n }) => {\n return name.length === 0 ? -1 : tag.length;\n }).filter((length) => {\n return length !== -1;\n })) + 1;\n const maxUnnamedTagLength = Math.max(...fields.tags.map(({\n tag,\n name,\n }) => {\n return name.length === 0 ? tag.length : -1;\n }).filter((length) => {\n return length !== -1;\n })) + 1;\n return {\n hasNoTypes,\n maxNamedTagLength,\n maxUnnamedTagLength,\n };\n};\n\nconst space = (len) => {\n return ''.padStart(len, ' ');\n};\n\nconst alignTransform = ({\n customSpacings,\n tags,\n indent,\n preserveMainDescriptionPostDelimiter,\n}) => {\n let intoTags = false;\n let width;\n\n const alignTokens = (tokens, typelessInfo) => {\n const nothingAfter = {\n delim: false,\n name: false,\n tag: false,\n type: false,\n };\n\n if (tokens.description === '') {\n nothingAfter.name = true;\n tokens.postName = '';\n\n if (tokens.name === '') {\n nothingAfter.type = true;\n tokens.postType = '';\n\n if (tokens.type === '') {\n nothingAfter.tag = true;\n tokens.postTag = '';\n\n /* istanbul ignore next: Never happens because the !intoTags return. But it's here for consistency with the original align transform */\n if (tokens.tag === '') {\n nothingAfter.delim = true;\n }\n }\n }\n }\n\n let untypedNameAdjustment = 0;\n let untypedTypeAdjustment = 0;\n if (typelessInfo.hasNoTypes) {\n nothingAfter.tag = true;\n tokens.postTag = '';\n if (tokens.name === '') {\n untypedNameAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;\n } else {\n untypedNameAdjustment = typelessInfo.maxNamedTagLength > typelessInfo.maxUnnamedTagLength ? 0 :\n Math.max(0, typelessInfo.maxUnnamedTagLength - (tokens.tag.length + tokens.name.length + 1));\n untypedTypeAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;\n }\n }\n\n // Todo: Avoid fixing alignment of blocks with multiline wrapping of type\n if (tokens.tag === '' && tokens.type) {\n return tokens;\n }\n\n const spacings = {\n postDelimiter: customSpacings?.postDelimiter || 1,\n postName: customSpacings?.postName || 1,\n postTag: customSpacings?.postTag || 1,\n postType: customSpacings?.postType || 1,\n };\n\n tokens.postDelimiter = nothingAfter.delim ? '' : space(spacings.postDelimiter);\n\n if (!nothingAfter.tag) {\n tokens.postTag = space(width.tag - tokens.tag.length + spacings.postTag);\n }\n\n if (!nothingAfter.type) {\n tokens.postType = space(width.type - tokens.type.length + spacings.postType + untypedTypeAdjustment);\n }\n\n if (!nothingAfter.name) {\n // If post name is empty for all lines (name width 0), don't add post name spacing.\n tokens.postName = width.name === 0 ? '' : space(width.name - tokens.name.length + spacings.postName + untypedNameAdjustment);\n }\n\n return tokens;\n };\n\n const update = (line, index, source, typelessInfo) => {\n const tokens = {\n ...line.tokens,\n };\n if (tokens.tag !== '') {\n intoTags = true;\n }\n\n const isEmpty =\n tokens.tag === '' &&\n tokens.name === '' &&\n tokens.type === '' &&\n tokens.description === '';\n\n // dangling '*/'\n if (tokens.end === Markers.end && isEmpty) {\n tokens.start = indent + ' ';\n\n return {\n ...line,\n tokens,\n };\n }\n\n /* eslint-disable indent */\n switch (tokens.delimiter) {\n case Markers.start:\n tokens.start = indent;\n break;\n case Markers.delim:\n tokens.start = indent + ' ';\n break;\n default:\n tokens.delimiter = '';\n\n // compensate delimiter\n tokens.start = indent + ' ';\n }\n /* eslint-enable */\n\n if (!intoTags) {\n if (tokens.description === '') {\n tokens.postDelimiter = '';\n } else if (!preserveMainDescriptionPostDelimiter) {\n tokens.postDelimiter = ' ';\n }\n\n return {\n ...line,\n tokens,\n };\n }\n\n const postHyphenSpacing = customSpacings?.postHyphen ?? 1;\n const hyphenSpacing = /^\\s*-\\s*/u;\n tokens.description = tokens.description.replace(\n hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '),\n );\n\n // Not align.\n if (!shouldAlign(tags, index, source)) {\n return {\n ...line,\n tokens,\n };\n }\n\n return {\n ...line,\n tokens: alignTokens(tokens, typelessInfo),\n };\n };\n\n return ({\n source,\n ...fields\n }) => {\n width = source.reduce(getWidth(tags), {\n ...zeroWidth,\n });\n\n const typelessInfo = getTypelessInfo(fields);\n\n return rewireSource({\n ...fields,\n source: source.map((line, index) => {\n return update(line, index, source, typelessInfo);\n }),\n });\n };\n};\n\nexport default alignTransform;\n"],"mappings":";;;;;;AAMA;AANA;AACA;AACA;AACA;AACA;;AASA,MAAM;EACJA;AACF,CAAC,GAAGC,mBAAI;AAER,MAAMC,SAAS,GAAG;EAChBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,GAAG,EAAE,CAAC;EACNC,IAAI,EAAE;AACR,CAAC;AAED,MAAMC,WAAW,GAAG,CAACC,IAAI,EAAEC,KAAK,EAAEC,MAAM,KAAK;EAC3C,MAAML,GAAG,GAAGK,MAAM,CAACD,KAAK,CAAC,CAACE,MAAM,CAACN,GAAG,CAACO,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;EACrD,MAAMC,WAAW,GAAGL,IAAI,CAACM,QAAQ,CAACT,GAAG,CAAC;EAEtC,IAAIQ,WAAW,EAAE;IACf,OAAO,IAAI;EACb;EAEA,IAAIR,GAAG,KAAK,EAAE,EAAE;IACd,OAAO,KAAK;EACd;EAEA,KAAK,IAAIU,QAAQ,GAAGN,KAAK,EAAEM,QAAQ,IAAI,CAAC,EAAEA,QAAQ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Ac,CAAEqB,UAAU,KAAI,CAAC;IACzD,MAAMC,aAAa,GAAG,WAAW;IACjC/C,MAAM,CAACiC,WAAW,GAAGjC,MAAM,CAACiC,WAAW,CAAChC,OAAO,CAC7C8C,aAAa,EAAE,GAAG,GAAG,EAAE,CAACxB,QAAQ,CAACsB,iBAAiB,EAAE,GAAG,CAAC,CACzD;;IAED;IACA,IAAI,CAACjD,WAAW,CAACC,IAAI,EAAEC,KAAK,EAAEC,MAAM,CAAC,EAAE;MACrC,OAAO;QACL,GAAG2C,IAAI;QACP1C;MACF,CAAC;IACH;IAEA,OAAO;MACL,GAAG0C,IAAI;MACP1C,MAAM,EAAE6B,WAAW,CAAC7B,MAAM,EAAE8B,YAAY;IAC1C,CAAC;EACH,CAAC;EAED,OAAO,CAAC;IACN/B,MAAM;IACN,GAAGe;EACL,CAAC,KAAK;IACJP,KAAK,GAAGR,MAAM,CAACiD,MAAM,CAAC1C,QAAQ,CAACT,IAAI,CAAC,EAAE;MACpC,GAAGN;IACL,CAAC,CAAC;IAEF,MAAMuC,YAAY,GAAGjB,eAAe,CAACC,MAAM,CAAC;IAE5C,OAAOzB,YAAY,CAAC;MAClB,GAAGyB,MAAM;MACTf,MAAM,EAAEA,MAAM,CAACmB,GAAG,CAAC,CAACwB,IAAI,EAAE5C,KAAK,KAAK;QAClC,OAAO2C,MAAM,CAACC,IAAI,EAAE5C,KAAK,EAAEC,MAAM,EAAE+B,YAAY,CAAC;MAClD,CAAC;IACH,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAAC,eAEaN,cAAc;AAAA;AAAA"}
1
+ {"version":3,"file":"alignTransform.js","names":["rewireSource","util","zeroWidth","name","start","tag","type","shouldAlign","tags","index","source","tokens","replace","includesTag","includes","iterator","previousTag","getWidth","width","Math","max","length","delimiter","Markers","getTypelessInfo","fields","hasNoTypes","every","maxNamedTagLength","map","filter","maxUnnamedTagLength","space","len","padStart","alignTransform","customSpacings","indent","preserveMainDescriptionPostDelimiter","wrapIndent","intoTags","alignTokens","typelessInfo","nothingAfter","delim","description","postName","postType","postTag","untypedNameAdjustment","untypedTypeAdjustment","spacings","postDelimiter","update","line","indentTag","isEmpty","end","postHyphenSpacing","postHyphen","hyphenSpacing","reduce","tagIndentMode","ret"],"sources":["../src/alignTransform.js"],"sourcesContent":["/**\n * Transform based on https://github.com/syavorsky/comment-parser/blob/master/src/transforms/align.ts\n *\n * It contains some customizations to align based on the tags, and some custom options.\n */\n\nimport {\n\n // `comment-parser/primitives` export\n Markers,\n util,\n} from 'comment-parser';\n\nconst {\n rewireSource,\n} = util;\n\nconst zeroWidth = {\n name: 0,\n start: 0,\n tag: 0,\n type: 0,\n};\n\nconst shouldAlign = (tags, index, source) => {\n const tag = source[index].tokens.tag.replace('@', '');\n const includesTag = tags.includes(tag);\n\n if (includesTag) {\n return true;\n }\n\n if (tag !== '') {\n return false;\n }\n\n for (let iterator = index; iterator >= 0; iterator--) {\n const previousTag = source[iterator].tokens.tag.replace('@', '');\n\n if (previousTag !== '') {\n if (tags.includes(previousTag)) {\n return true;\n }\n\n return false;\n }\n }\n\n return true;\n};\n\nconst getWidth = (tags) => {\n return (width, {\n tokens,\n }, index, source) => {\n if (!shouldAlign(tags, index, source)) {\n return width;\n }\n\n return {\n name: Math.max(width.name, tokens.name.length),\n start: tokens.delimiter === Markers.start ? tokens.start.length : width.start,\n tag: Math.max(width.tag, tokens.tag.length),\n type: Math.max(width.type, tokens.type.length),\n };\n };\n};\n\nconst getTypelessInfo = (fields) => {\n const hasNoTypes = fields.tags.every(({\n type,\n }) => {\n return !type;\n });\n const maxNamedTagLength = Math.max(...fields.tags.map(({\n tag,\n name,\n }) => {\n return name.length === 0 ? -1 : tag.length;\n }).filter((length) => {\n return length !== -1;\n })) + 1;\n const maxUnnamedTagLength = Math.max(...fields.tags.map(({\n tag,\n name,\n }) => {\n return name.length === 0 ? tag.length : -1;\n }).filter((length) => {\n return length !== -1;\n })) + 1;\n return {\n hasNoTypes,\n maxNamedTagLength,\n maxUnnamedTagLength,\n };\n};\n\nconst space = (len) => {\n return ''.padStart(len, ' ');\n};\n\nconst alignTransform = ({\n customSpacings,\n tags,\n indent,\n preserveMainDescriptionPostDelimiter,\n wrapIndent,\n}) => {\n let intoTags = false;\n let width;\n\n const alignTokens = (tokens, typelessInfo) => {\n const nothingAfter = {\n delim: false,\n name: false,\n tag: false,\n type: false,\n };\n\n if (tokens.description === '') {\n nothingAfter.name = true;\n tokens.postName = '';\n\n if (tokens.name === '') {\n nothingAfter.type = true;\n tokens.postType = '';\n\n if (tokens.type === '') {\n nothingAfter.tag = true;\n tokens.postTag = '';\n\n /* istanbul ignore next: Never happens because the !intoTags return. But it's here for consistency with the original align transform */\n if (tokens.tag === '') {\n nothingAfter.delim = true;\n }\n }\n }\n }\n\n let untypedNameAdjustment = 0;\n let untypedTypeAdjustment = 0;\n if (typelessInfo.hasNoTypes) {\n nothingAfter.tag = true;\n tokens.postTag = '';\n if (tokens.name === '') {\n untypedNameAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;\n } else {\n untypedNameAdjustment = typelessInfo.maxNamedTagLength > typelessInfo.maxUnnamedTagLength ? 0 :\n Math.max(0, typelessInfo.maxUnnamedTagLength - (tokens.tag.length + tokens.name.length + 1));\n untypedTypeAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;\n }\n }\n\n // Todo: Avoid fixing alignment of blocks with multiline wrapping of type\n if (tokens.tag === '' && tokens.type) {\n return tokens;\n }\n\n const spacings = {\n postDelimiter: customSpacings?.postDelimiter || 1,\n postName: customSpacings?.postName || 1,\n postTag: customSpacings?.postTag || 1,\n postType: customSpacings?.postType || 1,\n };\n\n tokens.postDelimiter = nothingAfter.delim ? '' : space(spacings.postDelimiter);\n\n if (!nothingAfter.tag) {\n tokens.postTag = space(width.tag - tokens.tag.length + spacings.postTag);\n }\n\n if (!nothingAfter.type) {\n tokens.postType = space(width.type - tokens.type.length + spacings.postType + untypedTypeAdjustment);\n }\n\n if (!nothingAfter.name) {\n // If post name is empty for all lines (name width 0), don't add post name spacing.\n tokens.postName = width.name === 0 ? '' : space(width.name - tokens.name.length + spacings.postName + untypedNameAdjustment);\n }\n\n return tokens;\n };\n\n const update = (line, index, source, typelessInfo, indentTag) => {\n const tokens = {\n ...line.tokens,\n };\n\n if (tokens.tag !== '') {\n intoTags = true;\n }\n\n const isEmpty =\n tokens.tag === '' &&\n tokens.name === '' &&\n tokens.type === '' &&\n tokens.description === '';\n\n // dangling '*/'\n if (tokens.end === Markers.end && isEmpty) {\n tokens.start = indent + ' ';\n\n return {\n ...line,\n tokens,\n };\n }\n\n switch (tokens.delimiter) {\n case Markers.start:\n tokens.start = indent;\n break;\n case Markers.delim:\n tokens.start = indent + ' ';\n break;\n default:\n tokens.delimiter = '';\n\n // compensate delimiter\n tokens.start = indent + ' ';\n }\n\n if (!intoTags) {\n if (tokens.description === '') {\n tokens.postDelimiter = '';\n } else if (!preserveMainDescriptionPostDelimiter) {\n tokens.postDelimiter = ' ';\n }\n\n return {\n ...line,\n tokens,\n };\n }\n\n const postHyphenSpacing = customSpacings?.postHyphen ?? 1;\n const hyphenSpacing = /^\\s*-\\s*/u;\n tokens.description = tokens.description.replace(\n hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '),\n );\n\n // Not align.\n if (shouldAlign(tags, index, source)) {\n alignTokens(tokens, typelessInfo);\n if (indentTag) {\n tokens.postDelimiter += wrapIndent;\n }\n }\n\n return {\n ...line,\n tokens,\n };\n };\n\n return ({\n source,\n ...fields\n }) => {\n width = source.reduce(getWidth(tags), {\n ...zeroWidth,\n });\n\n const typelessInfo = getTypelessInfo(fields);\n\n let tagIndentMode = false;\n\n return rewireSource({\n ...fields,\n source: source.map((line, index) => {\n const indentTag = tagIndentMode && !line.tokens.tag && line.tokens.description;\n const ret = update(line, index, source, typelessInfo, indentTag);\n\n if (line.tokens.tag) {\n tagIndentMode = true;\n }\n\n return ret;\n }),\n });\n };\n};\n\nexport default alignTransform;\n"],"mappings":";;;;;;AAM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MAAM,CAAC5C,QAAQ,CAACT,IAAI,CAAC,EAAE;MACpC,GAAGN;IACL,CAAC,CAAC;IAEF,MAAMwC,YAAY,GAAGlB,eAAe,CAACC,MAAM,CAAC;IAE5C,IAAIqC,aAAa,GAAG,KAAK;IAEzB,OAAO9D,YAAY,CAAC;MAClB,GAAGyB,MAAM;MACTf,MAAM,EAAEA,MAAM,CAACmB,GAAG,CAAC,CAACyB,IAAI,EAAE7C,KAAK,KAAK;QAClC,MAAM8C,SAAS,GAAGO,aAAa,IAAI,CAACR,IAAI,CAAC3C,MAAM,CAACN,GAAG,IAAIiD,IAAI,CAAC3C,MAAM,CAACkC,WAAW;QAC9E,MAAMkB,GAAG,GAAGV,MAAM,CAACC,IAAI,EAAE7C,KAAK,EAAEC,MAAM,EAAEgC,YAAY,EAAEa,SAAS,CAAC;QAEhE,IAAID,IAAI,CAAC3C,MAAM,CAACN,GAAG,EAAE;UACnByD,aAAa,GAAG,IAAI;QACtB;QAEA,OAAOC,GAAG;MACZ,CAAC;IACH,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAAC,eAEa5B,cAAc;AAAA;AAAA"}
@@ -109,13 +109,15 @@ const checkAlignment = ({
109
109
  preserveMainDescriptionPostDelimiter,
110
110
  report,
111
111
  tags,
112
- utils
112
+ utils,
113
+ wrapIndent
113
114
  }) => {
114
115
  const transform = commentFlow((0, _alignTransform.default)({
115
116
  customSpacings,
116
117
  indent,
117
118
  preserveMainDescriptionPostDelimiter,
118
- tags
119
+ tags,
120
+ wrapIndent
119
121
  }));
120
122
  const transformedJsdoc = transform(jsdoc);
121
123
  const comment = '/*' + jsdocNode.value + '*/';
@@ -137,7 +139,8 @@ var _default = (0, _iterateJsdoc.default)(({
137
139
  const {
138
140
  tags: applicableTags = ['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return'],
139
141
  preserveMainDescriptionPostDelimiter,
140
- customSpacings
142
+ customSpacings,
143
+ wrapIndent = ''
141
144
  } = context.options[1] || {};
142
145
  if (context.options[0] === 'always') {
143
146
  // Skip if it contains only a single line.
@@ -152,13 +155,42 @@ var _default = (0, _iterateJsdoc.default)(({
152
155
  preserveMainDescriptionPostDelimiter,
153
156
  report,
154
157
  tags: applicableTags,
155
- utils
158
+ utils,
159
+ wrapIndent
156
160
  });
157
161
  return;
158
162
  }
159
163
  const foundTags = utils.getPresentTags(applicableTags);
164
+ if (context.options[0] !== 'any') {
165
+ for (const tag of foundTags) {
166
+ checkNotAlignedPerTag(utils, tag, customSpacings);
167
+ }
168
+ }
160
169
  for (const tag of foundTags) {
161
- checkNotAlignedPerTag(utils, tag, customSpacings);
170
+ if (tag.source.length > 1) {
171
+ let idx = 0;
172
+ for (const {
173
+ tokens
174
+ // Avoid the tag line
175
+ } of tag.source.slice(1)) {
176
+ idx++;
177
+ if (!tokens.description ||
178
+ // Avoid first lines after multiline type
179
+ tokens.type || tokens.name) {
180
+ continue;
181
+ }
182
+
183
+ // Don't include a single separating space/tab
184
+ if (tokens.postDelimiter.slice(1) !== wrapIndent) {
185
+ utils.reportJSDoc('Expected wrap indent', {
186
+ line: tag.source[0].number + idx
187
+ }, () => {
188
+ tokens.postDelimiter = tokens.postDelimiter.charAt() + wrapIndent;
189
+ });
190
+ return;
191
+ }
192
+ }
193
+ }
162
194
  }
163
195
  }, {
164
196
  iterateAllJsdocs: true,
@@ -169,7 +201,7 @@ var _default = (0, _iterateJsdoc.default)(({
169
201
  },
170
202
  fixable: 'whitespace',
171
203
  schema: [{
172
- enum: ['always', 'never'],
204
+ enum: ['always', 'never', 'any'],
173
205
  type: 'string'
174
206
  }, {
175
207
  additionalProperties: false,
@@ -203,6 +235,9 @@ var _default = (0, _iterateJsdoc.default)(({
203
235
  type: 'string'
204
236
  },
205
237
  type: 'array'
238
+ },
239
+ wrapIndent: {
240
+ type: 'string'
206
241
  }
207
242
  },
208
243
  type: 'object'
@@ -1 +1 @@
1
- {"version":3,"file":"checkLineAlignment.js","names":["flow","commentFlow","transforms","checkNotAlignedPerTag","utils","tag","customSpacings","spacerProps","contentProps","mightHaveNamepath","tagMightHaveNamepath","tokens","source","followedBySpace","idx","callbck","nextIndex","slice","some","spacerProp","innerIdx","contentProp","spacePropVal","ret","postHyphenSpacing","postHyphen","exactHyphenSpacing","RegExp","hasNoHyphen","test","description","hasExactHyphenSpacing","ok","contentPropVal","spacerPropVal","spacing","length","fix","entries","padStart","hasSpace","contentPrp","hyphenSpacing","replace","setTag","reportJSDoc","checkAlignment","indent","jsdoc","jsdocNode","preserveMainDescriptionPostDelimiter","report","tags","transform","alignTransform","transformedJsdoc","comment","value","formatted","stringify","trimStart","fixer","replaceText","iterateJsdoc","context","applicableTags","options","includes","foundTags","getPresentTags","iterateAllJsdocs","meta","docs","url","fixable","schema","enum","type","additionalProperties","properties","postDelimiter","postName","postTag","postType","default","items"],"sources":["../../src/rules/checkLineAlignment.js"],"sourcesContent":["import {\n transforms,\n} from 'comment-parser';\nimport alignTransform from '../alignTransform';\nimport iterateJsdoc from '../iterateJsdoc';\n\nconst {\n flow: commentFlow,\n} = transforms;\n\nconst checkNotAlignedPerTag = (utils, tag, customSpacings) => {\n /*\n start +\n delimiter +\n postDelimiter +\n tag +\n postTag +\n type +\n postType +\n name +\n postName +\n description +\n end +\n lineEnd\n */\n let spacerProps;\n let contentProps;\n const mightHaveNamepath = utils.tagMightHaveNamepath(tag.tag);\n if (mightHaveNamepath) {\n spacerProps = [\n 'postDelimiter', 'postTag', 'postType', 'postName',\n ];\n contentProps = [\n 'tag', 'type', 'name', 'description',\n ];\n } else {\n spacerProps = [\n 'postDelimiter', 'postTag', 'postType',\n ];\n contentProps = [\n 'tag', 'type', 'description',\n ];\n }\n\n const {\n tokens,\n } = tag.source[0];\n\n const followedBySpace = (idx, callbck) => {\n const nextIndex = idx + 1;\n\n return spacerProps.slice(nextIndex).some((spacerProp, innerIdx) => {\n const contentProp = contentProps[nextIndex + innerIdx];\n\n const spacePropVal = tokens[spacerProp];\n\n const ret = spacePropVal;\n\n if (callbck) {\n callbck(!ret, contentProp);\n }\n\n return ret && (callbck || !contentProp);\n });\n };\n\n const postHyphenSpacing = customSpacings?.postHyphen ?? 1;\n const exactHyphenSpacing = new RegExp(`^\\\\s*-\\\\s{${postHyphenSpacing},${postHyphenSpacing}}(?!\\\\s)`, 'u');\n const hasNoHyphen = !(/^\\s*-(?!$)/u).test(tokens.description);\n const hasExactHyphenSpacing = exactHyphenSpacing.test(\n tokens.description,\n );\n\n // If checking alignment on multiple lines, need to check other `source`\n // items\n // Go through `post*` spacing properties and exit to indicate problem if\n // extra spacing detected\n const ok = !spacerProps.some((spacerProp, idx) => {\n const contentProp = contentProps[idx];\n const contentPropVal = tokens[contentProp];\n const spacerPropVal = tokens[spacerProp];\n const spacing = customSpacings?.[spacerProp] || 1;\n\n // There will be extra alignment if...\n\n // 1. The spaces don't match the space it should have (1 or custom spacing) OR\n return spacerPropVal.length !== spacing && spacerPropVal.length !== 0 ||\n\n // 2. There is a (single) space, no immediate content, and yet another\n // space is found subsequently (not separated by intervening content)\n spacerPropVal && !contentPropVal && followedBySpace(idx);\n }) && (hasNoHyphen || hasExactHyphenSpacing);\n if (ok) {\n return;\n }\n\n const fix = () => {\n for (const [\n idx,\n spacerProp,\n ] of spacerProps.entries()) {\n const contentProp = contentProps[idx];\n const contentPropVal = tokens[contentProp];\n\n if (contentPropVal) {\n const spacing = customSpacings?.[spacerProp] || 1;\n tokens[spacerProp] = ''.padStart(spacing, ' ');\n followedBySpace(idx, (hasSpace, contentPrp) => {\n if (hasSpace) {\n tokens[contentPrp] = '';\n }\n });\n } else {\n tokens[spacerProp] = '';\n }\n }\n\n if (!hasExactHyphenSpacing) {\n const hyphenSpacing = /^\\s*-\\s*/u;\n tokens.description = tokens.description.replace(\n hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '),\n );\n }\n\n utils.setTag(tag, tokens);\n };\n\n utils.reportJSDoc('Expected JSDoc block lines to not be aligned.', tag, fix, true);\n};\n\nconst checkAlignment = ({\n customSpacings,\n indent,\n jsdoc,\n jsdocNode,\n preserveMainDescriptionPostDelimiter,\n report,\n tags,\n utils,\n}) => {\n const transform = commentFlow(\n alignTransform({\n customSpacings,\n indent,\n preserveMainDescriptionPostDelimiter,\n tags,\n }),\n );\n const transformedJsdoc = transform(jsdoc);\n\n const comment = '/*' + jsdocNode.value + '*/';\n const formatted = utils.stringify(transformedJsdoc)\n .trimStart();\n\n if (comment !== formatted) {\n report(\n 'Expected JSDoc block lines to be aligned.',\n (fixer) => {\n return fixer.replaceText(jsdocNode, formatted);\n },\n );\n }\n};\n\nexport default iterateJsdoc(({\n indent,\n jsdoc,\n jsdocNode,\n report,\n context,\n utils,\n}) => {\n const {\n tags: applicableTags = [\n 'param', 'arg', 'argument', 'property', 'prop', 'returns', 'return',\n ],\n preserveMainDescriptionPostDelimiter,\n customSpacings,\n } = context.options[1] || {};\n\n if (context.options[0] === 'always') {\n // Skip if it contains only a single line.\n if (!jsdocNode.value.includes('\\n')) {\n return;\n }\n\n checkAlignment({\n customSpacings,\n indent,\n jsdoc,\n jsdocNode,\n preserveMainDescriptionPostDelimiter,\n report,\n tags: applicableTags,\n utils,\n });\n\n return;\n }\n\n const foundTags = utils.getPresentTags(applicableTags);\n for (const tag of foundTags) {\n checkNotAlignedPerTag(utils, tag, customSpacings);\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports invalid alignment of JSDoc block lines.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-line-alignment',\n },\n fixable: 'whitespace',\n schema: [\n {\n enum: [\n 'always', 'never',\n ],\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n customSpacings: {\n additionalProperties: false,\n properties: {\n postDelimiter: {\n type: 'integer',\n },\n postHyphen: {\n type: 'integer',\n },\n postName: {\n type: 'integer',\n },\n postTag: {\n type: 'integer',\n },\n postType: {\n type: 'integer',\n },\n },\n },\n preserveMainDescriptionPostDelimiter: {\n default: false,\n type: 'boolean',\n },\n tags: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"mappings":";;;;;;AAAA;AAGA;AACA;AAA2C;AAE3C,MAAM;EACJA,IAAI,EAAEC;AACR,CAAC,GAAGC,yBAAU;AAEd,MAAMC,qBAAqB,GAAG,CAACC,KAAK,EAAEC,GAAG,EAAEC,cAAc,KAAK;EAC5D;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,WAAW;EACf,IAAIC,YAAY;EAChB,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,oBAAoB,CAACL,GAAG,CAACA,GAAG,CAAC;EAC7D,IAAII,iBAAiB,EAAE;IACrBF,WAAW,GAAG,CACZ,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CACnD;IACDC,YAAY,GAAG,CACb,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CACrC;EACH,CAAC,MAAM;IACLD,WAAW,GAAG,CACZ,eAAe,EAAE,SAAS,EAAE,UAAU,CACvC;IACDC,YAAY,GAAG,CACb,KAAK,EAAE,MAAM,EAAE,aAAa,CAC7B;EACH;EAEA,MAAM;IACJG;EACF,CAAC,GAAGN,GAAG,CAACO,MAAM,CAAC,CAAC,CAAC;EAEjB,MAAMC,eAAe,GAAG,CAACC,GAAG,EAAEC,OAAO,KAAK;IACxC,MAAMC,SAAS,GAAGF,GAAG,GAAG,CAAC;IAEzB,OAAOP,WAAW,CAACU,KAAK,CAACD,SAAS,CAAC,CAACE,IAAI,CAAC,CAACC,UAAU,EAAEC,QAAQ,KAAK;MACjE,MAAMC,WAAW,GAAGb,YAAY,CAACQ,SAAS,GAAGI,QAAQ,CAAC;MAEtD,MAAME,YAAY,GAAGX,MAAM,CAACQ,UAAU,CAAC;MAEvC,MAAMI,GAAG,GAAGD,YAAY;MAExB,IAAIP,OAAO,EAAE;QACXA,OAAO,CAAC,CAACQ,GAAG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AAc,CAAC;EACnD;AACF,CAAC,EAAE;EACDgE,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJ1C,WAAW,EAAE,iDAAiD;MAC9D2C,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,YAAY;IACrBC,MAAM,EAAE,CACN;MACEC,IAAI,EAAE,CACJ,QAAQ,EAAE,OAAO,CAClB;MACDC,IAAI,EAAE;IACR,CAAC,EACD;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVzE,cAAc,EAAE;UACdwE,oBAAoB,EAAE,KAAK;UAC3BC,UAAU,EAAE;YACVC,aAAa,EAAE;cACbH,IAAI,EAAE;YACR,CAAC;YACDpD,UAAU,EAAE;cACVoD,IAAI,EAAE;YACR,CAAC;YACDI,QAAQ,EAAE;cACRJ,IAAI,EAAE;YACR,CAAC;YACDK,OAAO,EAAE;cACPL,IAAI,EAAE;YACR,CAAC;YACDM,QAAQ,EAAE;cACRN,IAAI,EAAE;YACR;UACF;QACF,CAAC;QACD3B,oCAAoC,EAAE;UACpCkC,OAAO,EAAE,KAAK;UACdP,IAAI,EAAE;QACR,CAAC;QACDzB,IAAI,EAAE;UACJiC,KAAK,EAAE;YACLR,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA;AAAA"}
1
+ {"version":3,"file":"checkLineAlignment.js","names":["flow","commentFlow","transforms","checkNotAlignedPerTag","utils","tag","customSpacings","spacerProps","contentProps","mightHaveNamepath","tagMightHaveNamepath","tokens","source","followedBySpace","idx","callbck","nextIndex","slice","some","spacerProp","innerIdx","contentProp","spacePropVal","ret","postHyphenSpacing","postHyphen","exactHyphenSpacing","RegExp","hasNoHyphen","test","description","hasExactHyphenSpacing","ok","contentPropVal","spacerPropVal","spacing","length","fix","entries","padStart","hasSpace","contentPrp","hyphenSpacing","replace","setTag","reportJSDoc","checkAlignment","indent","jsdoc","jsdocNode","preserveMainDescriptionPostDelimiter","report","tags","wrapIndent","transform","alignTransform","transformedJsdoc","comment","value","formatted","stringify","trimStart","fixer","replaceText","iterateJsdoc","context","applicableTags","options","includes","foundTags","getPresentTags","type","name","postDelimiter","line","number","charAt","iterateAllJsdocs","meta","docs","url","fixable","schema","enum","additionalProperties","properties","postName","postTag","postType","default","items"],"sources":["../../src/rules/checkLineAlignment.js"],"sourcesContent":["import {\n transforms,\n} from 'comment-parser';\nimport alignTransform from '../alignTransform';\nimport iterateJsdoc from '../iterateJsdoc';\n\nconst {\n flow: commentFlow,\n} = transforms;\n\nconst checkNotAlignedPerTag = (utils, tag, customSpacings) => {\n /*\n start +\n delimiter +\n postDelimiter +\n tag +\n postTag +\n type +\n postType +\n name +\n postName +\n description +\n end +\n lineEnd\n */\n let spacerProps;\n let contentProps;\n const mightHaveNamepath = utils.tagMightHaveNamepath(tag.tag);\n if (mightHaveNamepath) {\n spacerProps = [\n 'postDelimiter', 'postTag', 'postType', 'postName',\n ];\n contentProps = [\n 'tag', 'type', 'name', 'description',\n ];\n } else {\n spacerProps = [\n 'postDelimiter', 'postTag', 'postType',\n ];\n contentProps = [\n 'tag', 'type', 'description',\n ];\n }\n\n const {\n tokens,\n } = tag.source[0];\n\n const followedBySpace = (idx, callbck) => {\n const nextIndex = idx + 1;\n\n return spacerProps.slice(nextIndex).some((spacerProp, innerIdx) => {\n const contentProp = contentProps[nextIndex + innerIdx];\n\n const spacePropVal = tokens[spacerProp];\n\n const ret = spacePropVal;\n\n if (callbck) {\n callbck(!ret, contentProp);\n }\n\n return ret && (callbck || !contentProp);\n });\n };\n\n const postHyphenSpacing = customSpacings?.postHyphen ?? 1;\n const exactHyphenSpacing = new RegExp(`^\\\\s*-\\\\s{${postHyphenSpacing},${postHyphenSpacing}}(?!\\\\s)`, 'u');\n const hasNoHyphen = !(/^\\s*-(?!$)/u).test(tokens.description);\n const hasExactHyphenSpacing = exactHyphenSpacing.test(\n tokens.description,\n );\n\n // If checking alignment on multiple lines, need to check other `source`\n // items\n // Go through `post*` spacing properties and exit to indicate problem if\n // extra spacing detected\n const ok = !spacerProps.some((spacerProp, idx) => {\n const contentProp = contentProps[idx];\n const contentPropVal = tokens[contentProp];\n const spacerPropVal = tokens[spacerProp];\n const spacing = customSpacings?.[spacerProp] || 1;\n\n // There will be extra alignment if...\n\n // 1. The spaces don't match the space it should have (1 or custom spacing) OR\n return spacerPropVal.length !== spacing && spacerPropVal.length !== 0 ||\n\n // 2. There is a (single) space, no immediate content, and yet another\n // space is found subsequently (not separated by intervening content)\n spacerPropVal && !contentPropVal && followedBySpace(idx);\n }) && (hasNoHyphen || hasExactHyphenSpacing);\n if (ok) {\n return;\n }\n\n const fix = () => {\n for (const [\n idx,\n spacerProp,\n ] of spacerProps.entries()) {\n const contentProp = contentProps[idx];\n const contentPropVal = tokens[contentProp];\n\n if (contentPropVal) {\n const spacing = customSpacings?.[spacerProp] || 1;\n tokens[spacerProp] = ''.padStart(spacing, ' ');\n followedBySpace(idx, (hasSpace, contentPrp) => {\n if (hasSpace) {\n tokens[contentPrp] = '';\n }\n });\n } else {\n tokens[spacerProp] = '';\n }\n }\n\n if (!hasExactHyphenSpacing) {\n const hyphenSpacing = /^\\s*-\\s*/u;\n tokens.description = tokens.description.replace(\n hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '),\n );\n }\n\n utils.setTag(tag, tokens);\n };\n\n utils.reportJSDoc('Expected JSDoc block lines to not be aligned.', tag, fix, true);\n};\n\nconst checkAlignment = ({\n customSpacings,\n indent,\n jsdoc,\n jsdocNode,\n preserveMainDescriptionPostDelimiter,\n report,\n tags,\n utils,\n wrapIndent,\n}) => {\n const transform = commentFlow(\n alignTransform({\n customSpacings,\n indent,\n preserveMainDescriptionPostDelimiter,\n tags,\n wrapIndent,\n }),\n );\n const transformedJsdoc = transform(jsdoc);\n\n const comment = '/*' + jsdocNode.value + '*/';\n const formatted = utils.stringify(transformedJsdoc)\n .trimStart();\n\n if (comment !== formatted) {\n report(\n 'Expected JSDoc block lines to be aligned.',\n (fixer) => {\n return fixer.replaceText(jsdocNode, formatted);\n },\n );\n }\n};\n\nexport default iterateJsdoc(({\n indent,\n jsdoc,\n jsdocNode,\n report,\n context,\n utils,\n}) => {\n const {\n tags: applicableTags = [\n 'param', 'arg', 'argument', 'property', 'prop', 'returns', 'return',\n ],\n preserveMainDescriptionPostDelimiter,\n customSpacings,\n wrapIndent = '',\n } = context.options[1] || {};\n\n if (context.options[0] === 'always') {\n // Skip if it contains only a single line.\n if (!jsdocNode.value.includes('\\n')) {\n return;\n }\n\n checkAlignment({\n customSpacings,\n indent,\n jsdoc,\n jsdocNode,\n preserveMainDescriptionPostDelimiter,\n report,\n tags: applicableTags,\n utils,\n wrapIndent,\n });\n\n return;\n }\n\n const foundTags = utils.getPresentTags(applicableTags);\n if (context.options[0] !== 'any') {\n for (const tag of foundTags) {\n checkNotAlignedPerTag(utils, tag, customSpacings);\n }\n }\n\n for (const tag of foundTags) {\n if (tag.source.length > 1) {\n let idx = 0;\n for (const {\n tokens,\n // Avoid the tag line\n } of tag.source.slice(1)) {\n idx++;\n\n if (\n !tokens.description ||\n // Avoid first lines after multiline type\n tokens.type ||\n tokens.name\n ) {\n continue;\n }\n\n // Don't include a single separating space/tab\n if (tokens.postDelimiter.slice(1) !== wrapIndent) {\n utils.reportJSDoc('Expected wrap indent', {\n line: tag.source[0].number + idx,\n }, () => {\n tokens.postDelimiter = tokens.postDelimiter.charAt() + wrapIndent;\n });\n return;\n }\n }\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports invalid alignment of JSDoc block lines.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-line-alignment',\n },\n fixable: 'whitespace',\n schema: [\n {\n enum: [\n 'always', 'never', 'any',\n ],\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n customSpacings: {\n additionalProperties: false,\n properties: {\n postDelimiter: {\n type: 'integer',\n },\n postHyphen: {\n type: 'integer',\n },\n postName: {\n type: 'integer',\n },\n postTag: {\n type: 'integer',\n },\n postType: {\n type: 'integer',\n },\n },\n },\n preserveMainDescriptionPostDelimiter: {\n default: false,\n type: 'boolean',\n },\n tags: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n wrapIndent: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"mappings":";;;;;;AAAA;AAGA;AACA;AAA2C;AAE3C,MAAM;EACJA,IAAI,EAAEC;AACR,CAAC,GAAGC,yBAAU;AAEd,MAAMC,qBAAqB,GAAG,CAACC,KAAK,EAAEC,GAAG,EAAEC,cAAc,KAAK;EAC5D;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,IAAIC,WAAW;EACf,IAAIC,YAAY;EAChB,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,oBAAoB,CAACL,GAAG,CAACA,GAAG,CAAC;EAC7D,IAAII,iBAAiB,EAAE;IACrBF,WAAW,GAAG,CACZ,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CACnD;IACDC,YAAY,GAAG,CACb,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CACrC;EACH,CAAC,MAAM;IACLD,WAAW,GAAG,CACZ,eAAe,EAAE,SAAS,EAAE,UAAU,CACvC;IACDC,YAAY,GAAG,CACb,KAAK,EAAE,MAAM,EAAE,aAAa,CAC7B;EACH;EAEA,MAAM;IACJG;EACF,CAAC,GAAGN,GAAG,CAACO,MAAM,CAAC,CAAC,CAAC;EAEjB,MAAMC,eAAe,GAAG,CAACC,GAAG,EAAEC,OAAO,KAAK;IACxC,MAAMC,SAAS,GAAGF,GAAG,GAAG,CAAC;IAEzB,OAAOP,WAAW,CAACU,KAAK,CAACD,SAAS,CAAC,CAACE,IAAI,CAAC,CAACC,UAAU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AiD;MAC9DkD,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,YAAY;IACrBC,MAAM,EAAE,CACN;MACEC,IAAI,EAAE,CACJ,QAAQ,EAAE,OAAO,EAAE,KAAK,CACzB;MACDZ,IAAI,EAAE;IACR,CAAC,EACD;MACEa,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACV/E,cAAc,EAAE;UACd8E,oBAAoB,EAAE,KAAK;UAC3BC,UAAU,EAAE;YACVZ,aAAa,EAAE;cACbF,IAAI,EAAE;YACR,CAAC;YACD9C,UAAU,EAAE;cACV8C,IAAI,EAAE;YACR,CAAC;YACDe,QAAQ,EAAE;cACRf,IAAI,EAAE;YACR,CAAC;YACDgB,OAAO,EAAE;cACPhB,IAAI,EAAE;YACR,CAAC;YACDiB,QAAQ,EAAE;cACRjB,IAAI,EAAE;YACR;UACF;QACF,CAAC;QACDrB,oCAAoC,EAAE;UACpCuC,OAAO,EAAE,KAAK;UACdlB,IAAI,EAAE;QACR,CAAC;QACDnB,IAAI,EAAE;UACJsC,KAAK,EAAE;YACLnB,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDlB,UAAU,EAAE;UACVkB,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA;AAAA"}
package/package.json CHANGED
@@ -120,5 +120,5 @@
120
120
  "test-cov": "cross-env TIMING=1 nyc --reporter text npm run test-no-cov",
121
121
  "test-index": "npm run test-no-cov -- test/rules/index.js"
122
122
  },
123
- "version": "39.9.1"
123
+ "version": "40.0.0"
124
124
  }