Skip to content

Commit 9a91a3d

Browse files
authored
prevent-abbreviations: Do not rename exported types when using @babel/eslint-parser (#1104)
1 parent 5c08932 commit 9a91a3d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

rules/prevent-abbreviations.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,13 @@ const isExportedIdentifier = identifier => {
431431
return identifier.parent.parent.type === 'ExportNamedDeclaration';
432432
}
433433

434+
if (
435+
identifier.parent.type === 'TypeAlias' &&
436+
identifier.parent.id === identifier
437+
) {
438+
return identifier.parent.parent.type === 'ExportNamedDeclaration';
439+
}
440+
434441
return false;
435442
};
436443

test/prevent-abbreviations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,7 @@ runTest.babelLegacy({
18801880
export type PreloadProps<TExtraProps = null> = {};
18811881
`,
18821882
output: outdent`
1883-
export type PreloadProperties<TExtraProperties = null> = {};
1883+
export type PreloadProps<TExtraProperties = null> = {};
18841884
`,
18851885
errors: [...createErrors(), ...createErrors()]
18861886
}

0 commit comments

Comments
 (0)