Skip to content

Commit

Permalink
test(check-types): add cases for #709
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jan 21, 2022
1 parent 6524c31 commit 904e02f
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Expand Up @@ -5447,6 +5447,15 @@ function quux (foo) {
}
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object"}}}
// Message: Invalid JSDoc @param "foo" type "Object"; prefer: "object".

/**
* @param {object.<string>} foo
*/
function quux (foo) {

}
// Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"object.<>":"Object"}}}
// Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object".
````

The following patterns are not considered problems:
Expand Down Expand Up @@ -5734,6 +5743,14 @@ function b () {}
function quux (foo) {

}

/**
* @param {Object.<string>} foo
*/
function quux (foo) {

}
// Settings: {"jsdoc":{"mode":"typescript"}}
````


Expand Down
47 changes: 47 additions & 0 deletions test/rules/assertions/checkTypes.js
Expand Up @@ -2161,6 +2161,38 @@ export default {
},
},
},
{
code: `
/**
* @param {object.<string>} foo
*/
function quux (foo) {
}
`,
errors: [
{
line: 3,
message: 'Invalid JSDoc @param "foo" type "object"; prefer: "Object".',
},
],
output: `
/**
* @param {Object.<string>} foo
*/
function quux (foo) {
}
`,
settings: {
jsdoc: {
mode: 'typescript',
preferredTypes: {
'object.<>': 'Object',
},
},
},
},
],
valid: [
{
Expand Down Expand Up @@ -2757,5 +2789,20 @@ export default {
}
`,
},
{
code: `
/**
* @param {Object.<string>} foo
*/
function quux (foo) {
}
`,
settings: {
jsdoc: {
mode: 'typescript',
},
},
},
],
};

0 comments on commit 904e02f

Please sign in to comment.