Skip to content

Commit

Permalink
fix(require-jsdoc): ensure children of TS type reference and parame…
Browse files Browse the repository at this point in the history
…ter instantiation can be exports; fixes #1186
  • Loading branch information
brettz9 committed Jan 13, 2024
1 parent b9939fc commit 55d9f25
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/exportParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,8 @@ const canExportChildrenType = new Set([
'TSInterfaceDeclaration',
'TSTypeLiteral',
'TSTypeAliasDeclaration',
'TSTypeParameterInstantiation',
'TSTypeReference',
'ClassDeclaration',
'ClassBody',
'ClassDefinition',
Expand Down
52 changes: 52 additions & 0 deletions test/rules/assertions/requireJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4191,6 +4191,58 @@ function quux (foo) {
}
},
},
{
code: `
/**
* Command options for the login command
*/
export type LoginOptions = CmdOptions<{
username?: string;
password?: string;
}>;
`,
errors: [
{
line: 6,
message: 'Missing JSDoc comment.',
},
{
line: 7,
message: 'Missing JSDoc comment.',
},
],
options: [
{
publicOnly: {
ancestorsOnly: true,
},
contexts: [
'TSTypeAliasDeclaration',
'TSInterfaceDeclaration',
'TSMethodSignature',
'TSPropertySignature',
],
},
],
output: `
/**
* Command options for the login command
*/
export type LoginOptions = CmdOptions<{
/**
*
*/
username?: string;
/**
*
*/
password?: string;
}>;
`,
languageOptions: {
parser: typescriptEslintParser,
},
},
],
valid: [
{
Expand Down

0 comments on commit 55d9f25

Please sign in to comment.