Skip to content

Commit

Permalink
fix(check-types): for jsdoc mode, avoid objecting to upper-case; f…
Browse files Browse the repository at this point in the history
…ixes #860
  • Loading branch information
brettz9 committed Mar 28, 2022
1 parent 0f27282 commit d11d271
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -5883,6 +5883,17 @@ function a () {}
*/
function a () {}
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","object<>":"Object<>"}}}

/**
* Does something.
*
* @param {Object<string,string>} spec - Foo.
*/
function foo(spec) {
return spec;
}

foo()
````


Expand Down
3 changes: 1 addition & 2 deletions src/rules/checkTypes.js
Expand Up @@ -196,8 +196,7 @@ export default iterateJsdoc(({
let changedPreferred = preferred;
for (const strictNativeType of strictNativeTypes) {
if (
// Todo: Avoid typescript condition if moving to default typescript
strictNativeType === 'object' && mode === 'typescript' &&
strictNativeType === 'object' &&
(
// This is not set to remap with exact type match (e.g.,
// `object: 'Object'`), so can ignore (including if circular)
Expand Down
14 changes: 14 additions & 0 deletions test/rules/assertions/checkTypes.js
Expand Up @@ -3003,5 +3003,19 @@ export default {
},
},
},
{
code: `
/**
* Does something.
*
* @param {Object<string,string>} spec - Foo.
*/
function foo(spec) {
return spec;
}
foo()
`,
},
],
};

0 comments on commit d11d271

Please sign in to comment.