eslint-plugin-jsdoc 39.7.5 → 39.8.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
@@ -2047,6 +2047,7 @@ An object with any of the following keys set to an integer. Affects spacing:
2047
2047
  - `postTag` - after the tag (e.g., `* @param `)
2048
2048
  - `postType` - after the type (e.g., `* @param {someType} `)
2049
2049
  - `postName` - after the name (e.g., `* @param {someType} name `)
2050
+ - `postHyphens` - after any hyphens in the description (e.g., `* @param {someType} name - A description`)
2050
2051
 
2051
2052
  If a spacing is not defined, it defaults to one.
2052
2053
 
@@ -2438,6 +2439,66 @@ const fn = ( lorem, sit ) => {}
2438
2439
  const fn = ( lorem, sit ) => {}
2439
2440
  // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
2440
2441
  // Message: Expected JSDoc block lines to be aligned.
2442
+
2443
+ /**
2444
+ * Function description.
2445
+ *
2446
+ * @param {string} lorem - Description.
2447
+ * @param {int} sit - Description multi words.
2448
+ */
2449
+ const fn = ( lorem, sit ) => {}
2450
+ // "jsdoc/check-line-alignment": ["error"|"warn", "never"]
2451
+ // Message: Expected JSDoc block lines to not be aligned.
2452
+
2453
+ /**
2454
+ * Function description.
2455
+ *
2456
+ * @param {string} lorem - Description.
2457
+ * @param {int} sit - Description multi words.
2458
+ */
2459
+ const fn = ( lorem, sit ) => {}
2460
+ // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"customSpacings":{"postHyphen":2}}]
2461
+ // Message: Expected JSDoc block lines to not be aligned.
2462
+
2463
+ /**
2464
+ * Function description.
2465
+ *
2466
+ * @param {string} lorem - Description.
2467
+ * @param {int} sit - Description multi words.
2468
+ */
2469
+ const fn = ( lorem, sit ) => {}
2470
+ // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"customSpacings":{"postHyphen":2}}]
2471
+ // Message: Expected JSDoc block lines to not be aligned.
2472
+
2473
+ /**
2474
+ * Function description.
2475
+ *
2476
+ * @param {string} lorem - Description.
2477
+ * @param {int} sit - Description multi words.
2478
+ */
2479
+ const fn = ( lorem, sit ) => {}
2480
+ // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"customSpacings":{"postHyphen":2}}]
2481
+ // Message: Expected JSDoc block lines to be aligned.
2482
+
2483
+ /**
2484
+ * Function description.
2485
+ *
2486
+ * @param {string} lorem - Description.
2487
+ * @param {int} sit - Description multi words.
2488
+ */
2489
+ const fn = ( lorem, sit ) => {}
2490
+ // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"customSpacings":{"postHyphen":2}}]
2491
+ // Message: Expected JSDoc block lines to be aligned.
2492
+
2493
+ /**
2494
+ * Function description.
2495
+ *
2496
+ * @param {string} lorem - Description.
2497
+ * @param {int} sit - Description multi words.
2498
+ */
2499
+ const fn = ( lorem, sit ) => {}
2500
+ // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"customSpacings":{"postHyphen":2}}]
2501
+ // Message: Expected JSDoc block lines to not be aligned.
2441
2502
  ````
2442
2503
 
2443
2504
  The following patterns are not considered problems:
@@ -7845,6 +7906,12 @@ name will actually be part of the description (e.g., for
7845
7906
  `structuredTags` setting (if `name: false`, this rule will not apply to
7846
7907
  that tag).
7847
7908
 
7909
+ <a name="user-content-eslint-plugin-jsdoc-rules-match-name-fixer"></a>
7910
+ <a name="eslint-plugin-jsdoc-rules-match-name-fixer"></a>
7911
+ #### Fixer
7912
+
7913
+ Will replace `disallowName` with `replacement` if these are provided.
7914
+
7848
7915
  <a name="user-content-eslint-plugin-jsdoc-rules-match-name-options-12"></a>
7849
7916
  <a name="eslint-plugin-jsdoc-rules-match-name-options-12"></a>
7850
7917
  #### Options
@@ -9692,6 +9759,36 @@ const MyComponent = ({ children }) => {
9692
9759
  */
9693
9760
  // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[tag=type][parsedType.type!=JsdocTypeStringValue][parsedType.type!=JsdocTypeNumber][parsedType.type!=JsdocTypeName])","context":"any","message":"@type should be limited to numeric or string literals and names"},{"comment":"JsdocBlock:has(JsdocTag[tag=type][parsedType.type=JsdocTypeName]:not(*[parsedType.value=/^(true|false|null|undefined|boolean|number|string)$/]))","context":"any","message":"@type names should only be recognized primitive types or literals"}]}]
9694
9761
  // Message: @type names should only be recognized primitive types or literals
9762
+
9763
+ /**
9764
+ *
9765
+ */
9766
+ function test(): string { }
9767
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(*:has(JsdocTag[tag=/returns/]))","context":"FunctionDeclaration[returnType.typeAnnotation.type!=/TSVoidKeyword|TSUndefinedKeyword/]","message":"Functions with non-void return types must have a @returns tag"}]}]
9768
+ // Message: Functions with non-void return types must have a @returns tag
9769
+
9770
+ /**
9771
+ *
9772
+ */
9773
+ let test = (): string => { };
9774
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(*:has(JsdocTag[tag=/returns/]))","context":"ArrowFunctionExpression[returnType.typeAnnotation.type!=/TSVoidKeyword|TSUndefinedKeyword/]","message":"Functions with non-void return types must have a @returns tag"}]}]
9775
+ // Message: Functions with non-void return types must have a @returns tag
9776
+
9777
+ /**
9778
+ * @returns
9779
+ */
9780
+ let test: () => string;
9781
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(*:has(JsdocTag[tag=/returns/]:has(JsdocDescriptionLine)))","context":"VariableDeclaration:has(*[typeAnnotation.typeAnnotation.type=/TSFunctionType/][typeAnnotation.typeAnnotation.returnType.typeAnnotation.type!=/TSVoidKeyword|TSUndefinedKeyword/])","message":"FunctionType's with non-void return types must have a @returns tag with a description"}]}]
9782
+ // Message: FunctionType's with non-void return types must have a @returns tag with a description
9783
+
9784
+ /**
9785
+ *
9786
+ */
9787
+ class Test {
9788
+ abstract Test(): string;
9789
+ }
9790
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(*:has(JsdocTag[tag=/returns/]))","context":"TSEmptyBodyFunctionExpression[returnType.typeAnnotation.type!=/TSVoidKeyword|TSUndefinedKeyword/]","message":"methods with non-void return types must have a @returns tag"}]}]
9791
+ // Message: methods with non-void return types must have a @returns tag
9695
9792
  ````
9696
9793
 
9697
9794
  The following patterns are not considered problems:
@@ -9772,6 +9869,32 @@ function foo(): string;
9772
9869
  * @type {boolean}
9773
9870
  */
9774
9871
  // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[tag=type][parsedType.type!=JsdocTypeStringValue][parsedType.type!=JsdocTypeNumber][parsedType.type!=JsdocTypeName])","context":"any","message":"@type should be limited to numeric or string literals and names"},{"comment":"JsdocBlock:has(JsdocTag[tag=type][parsedType.type=JsdocTypeName]:not(*[parsedType.value=/^(true|false|null|undefined|boolean|number|string)$/]))","context":"any","message":"@type names should only be recognized primitive types or literals"}]}]
9872
+
9873
+ /**
9874
+ *
9875
+ */
9876
+ function test(): void { }
9877
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(*:has(JsdocTag[tag=/returns/]))","context":"FunctionDeclaration[returnType.typeAnnotation.type!=/TSVoidKeyword|TSUndefinedKeyword/]","message":"Functions with return types must have a @returns tag"}]}]
9878
+
9879
+ /**
9880
+ *
9881
+ */
9882
+ let test = (): undefined => { };
9883
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(*:has(JsdocTag[tag=/returns/]))","context":"ArrowFunctionExpression[returnType.typeAnnotation.type!=/TSVoidKeyword|TSUndefinedKeyword/]","message":"Functions with non-void return types must have a @returns tag"}]}]
9884
+
9885
+ /**
9886
+ * @returns A description
9887
+ */
9888
+ let test: () => string;
9889
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(*:has(JsdocTag[tag=/returns/]:has(JsdocDescriptionLine)))","context":"VariableDeclaration:has(*[typeAnnotation.typeAnnotation.type=/TSFunctionType/])","message":"FunctionType's with non-void return types must have a @returns tag"}]}]
9890
+
9891
+ /**
9892
+ *
9893
+ */
9894
+ class Test {
9895
+ abstract Test(): void;
9896
+ }
9897
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(*:has(JsdocTag[tag=/returns/]))","context":"TSEmptyBodyFunctionExpression[returnType.typeAnnotation.type!=/TSVoidKeyword|TSUndefinedKeyword/]","message":"methods with non-void return types must have a @returns tag"}]}]
9775
9898
  ````
9776
9899
 
9777
9900
 
@@ -10911,15 +11034,24 @@ Requires that block description, explicit `@description`, and
10911
11034
 
10912
11035
  * Description must start with an uppercase alphabetical character.
10913
11036
  * Paragraphs must start with an uppercase alphabetical character.
10914
- * Sentences must end with a period.
11037
+ * Sentences must end with a period, question mark, exclamation mark, or triple backticks.
10915
11038
  * Every line in a paragraph (except the first) which starts with an uppercase
10916
11039
  character must be preceded by a line ending with a period.
10917
11040
  * A colon or semi-colon followed by two line breaks is still part of the
10918
11041
  containing paragraph (unlike normal dual line breaks).
10919
- * Text within inline tags `{...}` are not checked for sentence divisions.
11042
+ * Text within inline tags `{...}` or within triple backticks are not checked for sentence divisions.
10920
11043
  * Periods after items within the `abbreviations` option array are not treated
10921
11044
  as sentence endings.
10922
11045
 
11046
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-description-complete-sentence-fixer-1"></a>
11047
+ <a name="eslint-plugin-jsdoc-rules-require-description-complete-sentence-fixer-1"></a>
11048
+ #### Fixer
11049
+
11050
+ If sentences do not end with terminal punctuation, a period will be added.
11051
+
11052
+ If sentences do not start with an uppercase character, the initial
11053
+ letter will be capitalized.
11054
+
10923
11055
  <a name="user-content-eslint-plugin-jsdoc-rules-require-description-complete-sentence-options-23"></a>
10924
11056
  <a name="eslint-plugin-jsdoc-rules-require-description-complete-sentence-options-23"></a>
10925
11057
  #### Options
@@ -12313,8 +12445,8 @@ A value indicating whether setters should be checked. Defaults to `false`.
12313
12445
  A boolean on whether to enable the fixer (which adds an empty `@example` block).
12314
12446
  Defaults to `true`.
12315
12447
 
12316
- <a name="user-content-eslint-plugin-jsdoc-rules-require-example-fixer"></a>
12317
- <a name="eslint-plugin-jsdoc-rules-require-example-fixer"></a>
12448
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-example-fixer-2"></a>
12449
+ <a name="eslint-plugin-jsdoc-rules-require-example-fixer-2"></a>
12318
12450
  #### Fixer
12319
12451
 
12320
12452
  The fixer for `require-example` will add an empty `@example`, but it will still
@@ -15497,16 +15629,16 @@ function quux (foo, {bar: {baz}}) {
15497
15629
 
15498
15630
  Requires that all function parameters are documented.
15499
15631
 
15500
- <a name="user-content-eslint-plugin-jsdoc-rules-require-param-fixer-1"></a>
15501
- <a name="eslint-plugin-jsdoc-rules-require-param-fixer-1"></a>
15632
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-param-fixer-3"></a>
15633
+ <a name="eslint-plugin-jsdoc-rules-require-param-fixer-3"></a>
15502
15634
  #### Fixer
15503
15635
 
15504
15636
  Adds `@param <name>` for each tag present in the function signature but
15505
15637
  missing in the jsdoc. Can be disabled by setting the `enableFixer`
15506
15638
  option to `false`.
15507
15639
 
15508
- <a name="user-content-eslint-plugin-jsdoc-rules-require-param-fixer-1-destructured-object-and-array-naming"></a>
15509
- <a name="eslint-plugin-jsdoc-rules-require-param-fixer-1-destructured-object-and-array-naming"></a>
15640
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-param-fixer-3-destructured-object-and-array-naming"></a>
15641
+ <a name="eslint-plugin-jsdoc-rules-require-param-fixer-3-destructured-object-and-array-naming"></a>
15510
15642
  ##### Destructured object and array naming
15511
15643
 
15512
15644
  When the fixer is applied to destructured objects, only the input name is
@@ -15558,8 +15690,8 @@ function quux ([foo, bar]) {
15558
15690
  */
15559
15691
  ```
15560
15692
 
15561
- <a name="user-content-eslint-plugin-jsdoc-rules-require-param-fixer-1-missing-root-fixing"></a>
15562
- <a name="eslint-plugin-jsdoc-rules-require-param-fixer-1-missing-root-fixing"></a>
15693
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-param-fixer-3-missing-root-fixing"></a>
15694
+ <a name="eslint-plugin-jsdoc-rules-require-param-fixer-3-missing-root-fixing"></a>
15563
15695
  ##### Missing root fixing
15564
15696
 
15565
15697
  Note that unless `enableRootFixer` (or `enableFixer`) is set to `false`,
@@ -15594,8 +15726,8 @@ numeric component).
15594
15726
  And one can have the count begin at another number (e.g., `1`) by changing
15595
15727
  `autoIncrementBase` from the default of `0`.
15596
15728
 
15597
- <a name="user-content-eslint-plugin-jsdoc-rules-require-param-fixer-1-rest-element-restelement-insertions"></a>
15598
- <a name="eslint-plugin-jsdoc-rules-require-param-fixer-1-rest-element-restelement-insertions"></a>
15729
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-param-fixer-3-rest-element-restelement-insertions"></a>
15730
+ <a name="eslint-plugin-jsdoc-rules-require-param-fixer-3-rest-element-restelement-insertions"></a>
15599
15731
  ##### Rest Element (<code>RestElement</code>) insertions
15600
15732
 
15601
15733
  The fixer will automatically report/insert
@@ -15647,8 +15779,8 @@ function baar ([a, ...extra]) {
15647
15779
 
15648
15780
  ...because it does not use the `...` syntax in the type.
15649
15781
 
15650
- <a name="user-content-eslint-plugin-jsdoc-rules-require-param-fixer-1-object-rest-property-insertions"></a>
15651
- <a name="eslint-plugin-jsdoc-rules-require-param-fixer-1-object-rest-property-insertions"></a>
15782
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-param-fixer-3-object-rest-property-insertions"></a>
15783
+ <a name="eslint-plugin-jsdoc-rules-require-param-fixer-3-object-rest-property-insertions"></a>
15652
15784
  ##### Object Rest Property insertions
15653
15785
 
15654
15786
  If the `checkRestProperty` option is set to `true` (`false` by default),
@@ -17278,8 +17410,8 @@ when their type is a plain `object`, `Object`, or `PlainObject`.
17278
17410
  Note that any other type, including a subtype of object such as
17279
17411
  `object<string, string>`, will not be reported.
17280
17412
 
17281
- <a name="user-content-eslint-plugin-jsdoc-rules-require-property-fixer-2"></a>
17282
- <a name="eslint-plugin-jsdoc-rules-require-property-fixer-2"></a>
17413
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-property-fixer-4"></a>
17414
+ <a name="eslint-plugin-jsdoc-rules-require-property-fixer-4"></a>
17283
17415
  #### Fixer
17284
17416
 
17285
17417
  The fixer for `require-property` will add an empty `@property`.
@@ -22564,7 +22696,8 @@ The following tags have their name/namepath portion (the non-whitespace
22564
22696
  text after the tag name) checked:
22565
22697
 
22566
22698
  1. Name(path)-defining tags requiring namepath: `@event`, `@callback`,
22567
- `@external`, `@host`, `@name`, `@typedef`, and `@template`
22699
+ `@exports` (JSDoc only),
22700
+ `@external`, `@host`, `@name`, `@typedef` (JSDoc only), and `@template`
22568
22701
  (TypeScript/Closure only); `@param` (`@arg`, `@argument`) and `@property`
22569
22702
  (`@prop`) also fall into this category, but while this rule will check
22570
22703
  their namepath validity, we leave the requiring of the name portion
@@ -22573,11 +22706,11 @@ text after the tag name) checked:
22573
22706
  1. Name(path)-defining tags (which may have value without namepath or their
22574
22707
  namepath can be expressed elsewhere on the block):
22575
22708
  `@class`, `@constructor`, `@constant`, `@const`, `@function`, `@func`,
22576
- `@method`, `@interface` (TypeScript tag only), `@member`, `@var`,
22709
+ `@method`, `@interface` (non-Closure only), `@member`, `@var`,
22577
22710
  `@mixin`, `@namespace`, `@module` (module paths are not planned for
22578
22711
  TypeScript)
22579
22712
  1. Name(path)-pointing tags requiring namepath: `@alias`, `@augments`,
22580
- `@extends`, `@lends`, `@memberof`, `@memberof!`, `@mixes`, `@this`
22713
+ `@extends` (JSDoc only), `@lends`, `@memberof`, `@memberof!`, `@mixes`, `@requires`, `@this`
22581
22714
  (jsdoc only)
22582
22715
  1. Name(path)-pointing tags (which may have value without namepath or their
22583
22716
  namepath can be expressed elsewhere on the block): `@listens`, `@fires`,
@@ -199,6 +199,9 @@ const alignTransform = ({
199
199
  tokens
200
200
  };
201
201
  }
202
+ const postHyphenSpacing = (customSpacings === null || customSpacings === void 0 ? void 0 : customSpacings.postHyphen) ?? 1;
203
+ const hyphenSpacing = /^\s*-\s*/u;
204
+ tokens.description = tokens.description.replace(hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '));
202
205
 
203
206
  // Not align.
204
207
  if (!shouldAlign(tags, index, source)) {
@@ -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","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 // 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,EAAE,EAAE;IACpD,MAAMC,WAAW,GAAGN,MAAM,CAACK,QAAQ,CAAC,CAACJ,MAAM,CAACN,GAAG,CAACO,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;IAEhE,IAAII,WAAW,KAAK,EAAE,EAAE;MACtB,IAAIR,IAAI,CAACM,QAAQ,CAACE,WAAW,CAAC,EAAE;QAC9B,OAAO,IAAI;MACb;MAEA,OAAO,KAAK;IACd;EACF;EAEA,OAAO,IAAI;AACb,CAAC;AAED,MAAMC,QAAQ,GAAIT,IAAI,IAAK;EACzB,OAAO,CAACU,KAAK,EAAE;IACbP;EACF,CAAC,EAAEF,KAAK,EAAEC,MAAM,KAAK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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","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,EAAE,EAAE;IACpD,MAAMC,WAAW,GAAGN,MAAM,CAACK,QAAQ,CAAC,CAACJ,MAAM,CAACN,GAAG,CAACO,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;IAEhE,IAAII,WAAW,KAAK,EAAE,EAAE;MACtB,IAAIR,IAAI,CAACM,QAAQ,CAACE,WAAW,CAAC,EAAE;QAC9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ACA,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"}
@@ -51,6 +51,10 @@ const checkNotAlignedPerTag = (utils, tag, customSpacings) => {
51
51
  return ret && (callbck || !contentProp);
52
52
  });
53
53
  };
54
+ const postHyphenSpacing = (customSpacings === null || customSpacings === void 0 ? void 0 : customSpacings.postHyphen) ?? 1;
55
+ const exactHyphenSpacing = new RegExp(`^\\s*-\\s{${postHyphenSpacing},${postHyphenSpacing}}(?!\\s)`, 'u');
56
+ const hasNoHyphen = !/^\s*-/u.test(tokens.description);
57
+ const hasExactHyphenSpacing = exactHyphenSpacing.test(tokens.description);
54
58
 
55
59
  // If checking alignment on multiple lines, need to check other `source`
56
60
  // items
@@ -69,7 +73,7 @@ const checkNotAlignedPerTag = (utils, tag, customSpacings) => {
69
73
  // 2. There is a (single) space, no immediate content, and yet another
70
74
  // space is found subsequently (not separated by intervening content)
71
75
  spacerPropVal && !contentPropVal && followedBySpace(idx);
72
- });
76
+ }) && (hasNoHyphen || hasExactHyphenSpacing);
73
77
  if (ok) {
74
78
  return;
75
79
  }
@@ -89,6 +93,10 @@ const checkNotAlignedPerTag = (utils, tag, customSpacings) => {
89
93
  tokens[spacerProp] = '';
90
94
  }
91
95
  }
96
+ if (!hasExactHyphenSpacing) {
97
+ const hyphenSpacing = /^\s*-\s*/u;
98
+ tokens.description = tokens.description.replace(hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '));
99
+ }
92
100
  utils.setTag(tag, tokens);
93
101
  };
94
102
  utils.reportJSDoc('Expected JSDoc block lines to not be aligned.', tag, fix, true);
@@ -172,6 +180,9 @@ var _default = (0, _iterateJsdoc.default)(({
172
180
  postDelimiter: {
173
181
  type: 'integer'
174
182
  },
183
+ postHyphen: {
184
+ type: 'integer'
185
+ },
175
186
  postName: {
176
187
  type: 'integer'
177
188
  },
@@ -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","ok","contentPropVal","spacerPropVal","spacing","length","fix","entries","padStart","hasSpace","contentPrp","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","description","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 // 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 });\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 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 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;M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E;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;QACD5B,oCAAoC,EAAE;UACpCmC,OAAO,EAAE,KAAK;UACdP,IAAI,EAAE;QACR,CAAC;QACD1B,IAAI,EAAE;UACJkC,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","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,C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,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"}
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.7.5"
123
+ "version": "39.8.0"
124
124
  }