Skip to content

Commit 40d5ee0

Browse files
committed
feat: update @es-joy/jsdoccomment
Also: - test: demo use of `inlineTags`
1 parent aeaae4f commit 40d5ee0

File tree

5 files changed

+85
-3
lines changed

5 files changed

+85
-3
lines changed

docs/rules/no-restricted-syntax.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,24 @@ class Test {
243243
}
244244
// "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"}]}]
245245
// Message: methods with non-void return types must have a @returns tag
246+
247+
/**
248+
* This has an inline {@link http://example.com}
249+
*/
250+
function quux () {
251+
252+
}
253+
// "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocInlineTag)","context":"FunctionDeclaration"}]}]
254+
// Message: Syntax is restricted: FunctionDeclaration with JsdocBlock:has(JsdocInlineTag)
255+
256+
/**
257+
* @see This has an inline {@link http://example.com}
258+
*/
259+
function quux () {
260+
261+
}
262+
// "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag:has(JsdocInlineTag[format=\"plain\"]))","context":"FunctionDeclaration"}]}]
263+
// Message: Syntax is restricted: FunctionDeclaration with JsdocBlock:has(JsdocTag:has(JsdocInlineTag[format="plain"]))
246264
````
247265

248266

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"url": "http://gajus.com"
66
},
77
"dependencies": {
8-
"@es-joy/jsdoccomment": "~0.37.1",
8+
"@es-joy/jsdoccomment": "~0.38.0",
99
"are-docs-informative": "^0.0.2",
1010
"comment-parser": "1.3.1",
1111
"debug": "^4.3.4",

pnpm-lock.yaml

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/iterateJsdoc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ describe('iterateJsdoc', () => {
122122
`,
123123
}, '')).to.deep.equal({
124124
description: 'SomeDescription',
125+
inlineTags: [],
125126
problems: [],
126127
source: [
127128
{
@@ -147,6 +148,7 @@ describe('iterateJsdoc', () => {
147148
tags: [
148149
{
149150
description: ' desc',
151+
inlineTags: [],
150152
name: 'name',
151153
optional: false,
152154
problems: [],

test/rules/assertions/noRestrictedSyntax.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,58 @@ export default {
652652
],
653653
parser: require.resolve('@typescript-eslint/parser'),
654654
},
655+
{
656+
code: `
657+
/**
658+
* This has an inline {@link http://example.com}
659+
*/
660+
function quux () {
661+
662+
}
663+
`,
664+
errors: [
665+
{
666+
line: 2,
667+
message: 'Syntax is restricted: FunctionDeclaration with JsdocBlock:has(JsdocInlineTag)',
668+
},
669+
],
670+
options: [
671+
{
672+
contexts: [
673+
{
674+
comment: 'JsdocBlock:has(JsdocInlineTag)',
675+
context: 'FunctionDeclaration',
676+
},
677+
],
678+
},
679+
],
680+
},
681+
{
682+
code: `
683+
/**
684+
* @see This has an inline {@link http://example.com}
685+
*/
686+
function quux () {
687+
688+
}
689+
`,
690+
errors: [
691+
{
692+
line: 2,
693+
message: 'Syntax is restricted: FunctionDeclaration with JsdocBlock:has(JsdocTag:has(JsdocInlineTag[format="plain"]))',
694+
},
695+
],
696+
options: [
697+
{
698+
contexts: [
699+
{
700+
comment: 'JsdocBlock:has(JsdocTag:has(JsdocInlineTag[format="plain"]))',
701+
context: 'FunctionDeclaration',
702+
},
703+
],
704+
},
705+
],
706+
},
655707
],
656708
valid: [
657709
{

0 commit comments

Comments
 (0)