@@ -4,6 +4,39 @@ import React from 'react';
4
4
import convert , { getKind , reduceToObj } from 'kind2string' ;
5
5
import allComponents from '../components' ;
6
6
7
+ const IGNORE_COMMENTS_STARTING_WITH = [ 'eslint-disable' , '@ts-' ] ;
8
+ const HIDE_PROPS_THAT_CONTAIN = [ '@internal' , '@access private' ] ;
9
+
10
+ const shouldIgnoreComment = comment => {
11
+ if ( ! comment ) {
12
+ return false ;
13
+ }
14
+
15
+ for ( let i = 0 ; i < IGNORE_COMMENTS_STARTING_WITH . length ; i ++ ) {
16
+ const value = IGNORE_COMMENTS_STARTING_WITH [ i ] ;
17
+ if ( comment . startsWith ( value ) ) {
18
+ return true ;
19
+ }
20
+ }
21
+
22
+ return false ;
23
+ } ;
24
+
25
+ const shouldHideProp = comment => {
26
+ if ( ! comment ) {
27
+ return false ;
28
+ }
29
+
30
+ for ( let i = 0 ; i < HIDE_PROPS_THAT_CONTAIN . length ; i ++ ) {
31
+ const value = HIDE_PROPS_THAT_CONTAIN [ i ] ;
32
+ if ( comment . includes ( value ) ) {
33
+ return true ;
34
+ }
35
+ }
36
+
37
+ return false ;
38
+ } ;
39
+
7
40
const renderPropType = (
8
41
propType : any ,
9
42
{ overrides = { } , shouldCollapseProps, components } : any ,
@@ -28,7 +61,9 @@ const renderPropType = (
28
61
29
62
let description ;
30
63
if ( propType . leadingComments ) {
31
- description = propType . leadingComments . reduce ( ( acc , { value } ) => acc . concat ( `\n${ value } ` ) , '' ) ;
64
+ description = propType . leadingComments
65
+ . filter ( ( { value } ) => ! shouldIgnoreComment ( value ) )
66
+ . reduce ( ( acc , { value } ) => acc . concat ( `\n${ value } ` ) , '' ) ;
32
67
}
33
68
34
69
if ( ! propType . value ) {
@@ -41,6 +76,10 @@ const renderPropType = (
41
76
return null ;
42
77
}
43
78
79
+ if ( shouldHideProp ( description ) ) {
80
+ return null ;
81
+ }
82
+
44
83
const name = propType . kind === 'spread' ? '...' : convert ( propType . key ) ;
45
84
const OverrideComponent = overrides [ name ] ;
46
85
const commonProps = {
0 commit comments