File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed
Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,16 @@ class Test {
6060 * @namespace {Object} SomeName
6161 */
6262// Message: Missing JSDoc @property.
63+
64+ /**
65+ * @typedef {{id: string}} Something
66+ *
67+ * @return {{xyz: Something[]}}
68+ */
69+ function foo( abc ) {
70+ }
71+ // Settings: {"jsdoc":{"tagNamePreference":{"property":false}}}
72+ // Message: Cannot prohibit `@property` in the `tagNamePreference` setting while using the `require-property` rule.
6373````
6474
6575
Original file line number Diff line number Diff line change 11import iterateJsdoc from '../iterateJsdoc.js' ;
22
33export default iterateJsdoc ( ( {
4+ context,
45 utils,
56} ) => {
67 const propertyAssociatedTags = utils . filterTags ( ( {
@@ -18,6 +19,23 @@ export default iterateJsdoc(({
1819 tagName : 'property' ,
1920 } ) ) ;
2021
22+ if ( ! targetTagName ) {
23+ context . report ( {
24+ loc : {
25+ end : {
26+ column : 1 ,
27+ line : 1 ,
28+ } ,
29+ start : {
30+ column : 1 ,
31+ line : 1 ,
32+ } ,
33+ } ,
34+ message : 'Cannot prohibit `@property` in the `tagNamePreference` setting while using the `require-property` rule.' ,
35+ } ) ;
36+ return ;
37+ }
38+
2139 if ( utils . hasATag ( [
2240 targetTagName ,
2341 ] ) ) {
Original file line number Diff line number Diff line change @@ -89,6 +89,30 @@ export default /** @type {import('../index.js').TestCases} */ ({
8989 */
9090 ` ,
9191 } ,
92+ {
93+ code : `
94+ /**
95+ * @typedef {{id: string}} Something
96+ *
97+ * @return {{xyz: Something[]}}
98+ */
99+ function foo( abc ) {
100+ }
101+ ` ,
102+ errors : [
103+ {
104+ line : 1 ,
105+ message : 'Cannot prohibit `@property` in the `tagNamePreference` setting while using the `require-property` rule.' ,
106+ } ,
107+ ] ,
108+ settings : {
109+ jsdoc : {
110+ tagNamePreference : {
111+ property : false ,
112+ } ,
113+ } ,
114+ } ,
115+ } ,
92116 ] ,
93117 valid : [
94118 {
You can’t perform that action at this time.
0 commit comments