Skip to content

Commit a74fd9e

Browse files
pascalduezgajus
authored andcommitted
feat: add type re-export support to no-types-missing-file-annotation (gajus#228)
1 parent bb444db commit a74fd9e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/rules/noTypesMissingFileAnnotation.js

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ export default (context) => {
2020
};
2121

2222
return {
23+
ExportNamedDeclaration (node) {
24+
if (node.exportKind === 'type') {
25+
reporter(node, 'exports');
26+
}
27+
},
2328
ImportDeclaration (node) {
2429
if (node.importKind === 'type') {
2530
reporter(node, 'imports');

tests/rules/assertions/noTypesMissingFileAnnotation.js

+9
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ export default {
3030
message: 'Type imports require valid Flow declaration.'
3131
}]
3232
},
33+
{
34+
code: 'export type {A} from "a"',
35+
errors: [{
36+
message: 'Type exports require valid Flow declaration.'
37+
}]
38+
},
3339
{
3440
code: 'function t<T>(): T{}',
3541
errors: [{
@@ -52,6 +58,9 @@ export default {
5258
},
5359
{
5460
code: '/* @noflow */\nimport {type A} from "a"'
61+
},
62+
{
63+
code: '/* @noflow */\nexport type {A} from "a"'
5564
}
5665
]
5766
};

0 commit comments

Comments
 (0)