Skip to content

Commit

Permalink
fix: @flow flag does not need to be first comment (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-silver authored and gajus committed Jun 28, 2017
1 parent 42328cd commit 996acd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/utilities/isFlowFile.js
Expand Up @@ -14,7 +14,10 @@ export default (context, strict = true) => {
return false;
}

const firstComment = comments[0];

return isFlowFileAnnotation(firstComment.value) && !(strict && /no/.test(firstComment.value));
return comments.some((comment) => {
return (
isFlowFileAnnotation(comment.value) &&
!(strict && /no/.test(comment.value))
);
});
};
3 changes: 3 additions & 0 deletions tests/rules/assertions/noTypesMissingFileAnnotation.js
Expand Up @@ -61,6 +61,9 @@ export default {
},
{
code: '/* @noflow */\nexport type {A} from "a"'
},
{
code: '// an unrelated comment\n// @flow\nexport type {A} from "a"'
}
]
};

0 comments on commit 996acd3

Please sign in to comment.