mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 07:04:05 +08:00
[Docs] Don't show copyright/flow on APIs without docblock
This commit is contained in:
@@ -105,10 +105,20 @@ function getFileDocBlock(commentsForFile) {
|
||||
commentsForFile.some(function(comment, i) {
|
||||
if (comment.loc.start.line === 1) {
|
||||
var lines = comment.value.split('\n');
|
||||
var inCopyrightBlock = false;
|
||||
var filteredLines = lines.filter(function(line) {
|
||||
var hasCopyright = !!line.match(/^\s*\*\s+Copyright/);
|
||||
if (!!line.match(/^\s*\*\s+Copyright \(c\)/)) {
|
||||
inCopyrightBlock = true;
|
||||
}
|
||||
|
||||
var hasProvides = !!line.match(/^\s*\*\s+@provides/);
|
||||
return !hasCopyright && !hasProvides;
|
||||
var hasFlow = !!line.match(/^\s*\*\s+@flow/);
|
||||
|
||||
if (hasFlow || hasProvides) {
|
||||
inCopyrightBlock = false;
|
||||
}
|
||||
|
||||
return !inCopyrightBlock && !hasFlow && !hasProvides;
|
||||
});
|
||||
docblock = filteredLines.join('\n');
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user