diff --git a/rules/prevent-abbreviations.js b/rules/prevent-abbreviations.js index 44f60dfe06..12ec976abb 100644 --- a/rules/prevent-abbreviations.js +++ b/rules/prevent-abbreviations.js @@ -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; }; diff --git a/test/prevent-abbreviations.js b/test/prevent-abbreviations.js index 74dc7f3ff3..49ced01284 100644 --- a/test/prevent-abbreviations.js +++ b/test/prevent-abbreviations.js @@ -1827,6 +1827,12 @@ runTest.typescript({ errors: 1 }, + // #1102 + noFixingTestCase({ + code: 'export type Props = string', + errors: createErrors() + }), + // #347 { code: outdent` @@ -1858,7 +1864,7 @@ runTest.typescript({ export type PreloadProps = {} `, output: outdent` - export type PreloadProperties = {} + export type PreloadProps = {} `, errors: [...createErrors(), ...createErrors()] }