Skip to content

Commit 4c65cbe

Browse files
authored
feat(check-line-alignment): add template to default tags (#1427)
* feat(`check-line-alignment`): add `template` to default tags The `@template` tag annotates TypeScript type arguments. It make sense to treat it the same as `@param`. * docs(`check-line-alignment`): document template tag * docs(`check-line-alignment`): add `template` tag
1 parent c51ee4f commit 4c65cbe

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

.README/rules/check-line-alignment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ After the string, an options object is allowed with the following properties.
2525
### `tags`
2626

2727
Use this to change the tags which are sought for alignment changes. Defaults to an array of
28-
`['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return']`.
28+
`['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return', 'template']`.
2929

3030
### `customSpacings`
3131

docs/rules/check-line-alignment.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ After the string, an options object is allowed with the following properties.
4343
### <code>tags</code>
4444

4545
Use this to change the tags which are sought for alignment changes. Defaults to an array of
46-
`['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return']`.
46+
`['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return', 'template']`.
4747

4848
<a name="user-content-check-line-alignment-options-customspacings"></a>
4949
<a name="check-line-alignment-options-customspacings"></a>
@@ -1014,4 +1014,3 @@ function quux () {
10141014
const fn = ( lorem ) => {}
10151015
// "jsdoc/check-line-alignment": ["error"|"warn", "any",{"disableWrapIndent":true,"wrapIndent":" "}]
10161016
````
1017-

src/rules/checkLineAlignment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export default iterateJsdoc(({
229229
disableWrapIndent = false,
230230
preserveMainDescriptionPostDelimiter,
231231
tags: applicableTags = [
232-
'param', 'arg', 'argument', 'property', 'prop', 'returns', 'return',
232+
'param', 'arg', 'argument', 'property', 'prop', 'returns', 'return', 'template',
233233
],
234234
wrapIndent = '',
235235
} = context.options[1] || {};

test/rules/assertions/checkLineAlignment.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,36 @@ export default /** @type {import('../index.js').TestCases} */ ({
182182
const fn = ( lorem, sit ) => {}
183183
`,
184184
},
185+
{
186+
code: `
187+
/**
188+
* Function description.
189+
*
190+
* @template {string} Arg Description.
191+
* @param {Arg} arg Description
192+
*/
193+
function hello(arg) {}
194+
`,
195+
errors: [
196+
{
197+
line: 2,
198+
message: 'Expected JSDoc block lines to be aligned.',
199+
type: 'Block',
200+
},
201+
],
202+
options: [
203+
'always',
204+
],
205+
output: `
206+
/**
207+
* Function description.
208+
*
209+
* @template {string} Arg Description.
210+
* @param {Arg} arg Description
211+
*/
212+
function hello(arg) {}
213+
`,
214+
},
185215
{
186216
code: `
187217
/**

0 commit comments

Comments
 (0)