Skip to content

Commit bfa237b

Browse files
committed
fix(check-tag-names): ensure that the fenced block content of @example tags are not treated as jsdoc tags; fixes #395
Avoids decorators being treated as jsdoc tags
1 parent 3a97cff commit bfa237b

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,21 @@ function quux () {
21252125

21262126
}
21272127
// Settings: {"jsdoc":{"tagNamePreference":{"augments":{"message":"@extends is to be used over @augments.","replacement":"extends"}}}}
2128+
2129+
/**
2130+
* Registers the `target` class as a transient dependency; each time the dependency is resolved a new instance will be created.
2131+
*
2132+
* @param target - The class / constructor function to register as transient.
2133+
*
2134+
* @example ```ts
2135+
@transient()
2136+
class Foo { }
2137+
```
2138+
* @param Time for a new tag
2139+
*/
2140+
export function transient<T>(target?: T): T {
2141+
// ...
2142+
}
21282143
````
21292144

21302145

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-
"comment-parser": "^0.6.2",
8+
"comment-parser": "^0.7.0",
99
"debug": "^4.1.1",
1010
"jsdoctypeparser": "^5.1.1",
1111
"lodash": "^4.17.15",

test/rules/assertions/checkTagNames.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,5 +591,27 @@ export default {
591591
},
592592
},
593593
},
594+
{
595+
code: `
596+
/**
597+
* Registers the \`target\` class as a transient dependency; each time the dependency is resolved a new instance will be created.
598+
*
599+
* @param target - The class / constructor function to register as transient.
600+
*
601+
* @example \`\`\`ts
602+
@transient()
603+
class Foo { }
604+
\`\`\`
605+
* @param Time for a new tag
606+
*/
607+
export function transient<T>(target?: T): T {
608+
// ...
609+
}
610+
`,
611+
parser: require.resolve('@typescript-eslint/parser'),
612+
parserOptions: {
613+
sourceType: 'module',
614+
},
615+
},
594616
],
595617
};

0 commit comments

Comments
 (0)