Skip to content

Commit

Permalink
feat: add type re-export support to no-types-missing-file-annotation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalduez authored and gajus committed May 14, 2017
1 parent bb444db commit a74fd9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rules/noTypesMissingFileAnnotation.js
Expand Up @@ -20,6 +20,11 @@ export default (context) => {
};

return {
ExportNamedDeclaration (node) {
if (node.exportKind === 'type') {
reporter(node, 'exports');
}
},
ImportDeclaration (node) {
if (node.importKind === 'type') {
reporter(node, 'imports');
Expand Down
9 changes: 9 additions & 0 deletions tests/rules/assertions/noTypesMissingFileAnnotation.js
Expand Up @@ -30,6 +30,12 @@ export default {
message: 'Type imports require valid Flow declaration.'
}]
},
{
code: 'export type {A} from "a"',
errors: [{
message: 'Type exports require valid Flow declaration.'
}]
},
{
code: 'function t<T>(): T{}',
errors: [{
Expand All @@ -52,6 +58,9 @@ export default {
},
{
code: '/* @noflow */\nimport {type A} from "a"'
},
{
code: '/* @noflow */\nexport type {A} from "a"'
}
]
};

0 comments on commit a74fd9e

Please sign in to comment.