Skip to content

Commit

Permalink
prevent-abbreviations: Do not rename exported TypeScript types (#1103)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vages committed Feb 17, 2021
1 parent 3cabd84 commit 5c08932
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions rules/prevent-abbreviations.js
Expand Up @@ -424,6 +424,13 @@ const isExportedIdentifier = identifier => {
return identifier.parent.parent.type === 'ExportNamedDeclaration';
}

if (
identifier.parent.type === 'TSTypeAliasDeclaration' &&
identifier.parent.id === identifier
) {
return identifier.parent.parent.type === 'ExportNamedDeclaration';
}

return false;
};

Expand Down
8 changes: 7 additions & 1 deletion test/prevent-abbreviations.js
Expand Up @@ -1827,6 +1827,12 @@ runTest.typescript({
errors: 1
},

// #1102
noFixingTestCase({
code: 'export type Props = string',
errors: createErrors()
}),

// #347
{
code: outdent`
Expand Down Expand Up @@ -1858,7 +1864,7 @@ runTest.typescript({
export type PreloadProps<TExtraProps = null> = {}
`,
output: outdent`
export type PreloadProperties<TExtraProperties = null> = {}
export type PreloadProps<TExtraProperties = null> = {}
`,
errors: [...createErrors(), ...createErrors()]
}
Expand Down

0 comments on commit 5c08932

Please sign in to comment.