File tree 3 files changed +42
-1
lines changed
3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -5438,6 +5438,15 @@ function b () {}
5438
5438
*/
5439
5439
// Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["otherType","anotherType"]}}}}
5440
5440
// Message: Invalid JSDoc @aCustomTag "foo" type "Number"; prefer: ["otherType","anotherType"].
5441
+
5442
+ /**
5443
+ * @param {Object[]} foo
5444
+ */
5445
+ function quux (foo ) {
5446
+
5447
+ }
5448
+ // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object"}}}
5449
+ // Message: Invalid JSDoc @param "foo" type "Object"; prefer: "object".
5441
5450
````
5442
5451
5443
5452
The following patterns are not considered problems:
Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ export default iterateJsdoc(({
221
221
] ) ;
222
222
} else if ( ! noDefaults && type === 'JsdocTypeName' ) {
223
223
for ( const strictNativeType of strictNativeTypes ) {
224
- if ( strictNativeType === 'object' && mode === 'typescript' ) {
224
+ if ( strictNativeType === 'object' && mode === 'typescript' && ! preferredTypes ?. [ nodeName ] ) {
225
225
continue ;
226
226
}
227
227
Original file line number Diff line number Diff line change @@ -2129,6 +2129,38 @@ export default {
2129
2129
} ,
2130
2130
} ,
2131
2131
} ,
2132
+ {
2133
+ code : `
2134
+ /**
2135
+ * @param {Object[]} foo
2136
+ */
2137
+ function quux (foo) {
2138
+
2139
+ }
2140
+ ` ,
2141
+ errors : [
2142
+ {
2143
+ line : 3 ,
2144
+ message : 'Invalid JSDoc @param "foo" type "Object"; prefer: "object".' ,
2145
+ } ,
2146
+ ] ,
2147
+ output : `
2148
+ /**
2149
+ * @param {object[]} foo
2150
+ */
2151
+ function quux (foo) {
2152
+
2153
+ }
2154
+ ` ,
2155
+ settings : {
2156
+ jsdoc : {
2157
+ mode : 'typescript' ,
2158
+ preferredTypes : {
2159
+ Object : 'object' ,
2160
+ } ,
2161
+ } ,
2162
+ } ,
2163
+ } ,
2132
2164
] ,
2133
2165
valid : [
2134
2166
{
You can’t perform that action at this time.
0 commit comments