Skip to content

Commit

Permalink
fix(docz-core): always use custom prop filter if it's provided… (#1415)
Browse files Browse the repository at this point in the history
  • Loading branch information
tripphamm authored Mar 31, 2020
1 parent 31ebd08 commit 53063ff
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions core/docz-core/src/utils/docgen/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,20 @@ function createServiceHost(
}
}

const defaultPropFilter = (prop: any): boolean => {
return prop.parent == null || !prop.parent.fileName.includes('node_modules')
}

const parseFiles = (files: string[], config: Config, tsconfig: string) => {
const opts = {
propFilter(prop: any): any {
if (prop.parent == null) return true
const propFilter = config.docgenConfig.propFilter
const val = propFilter && _.isFunction(propFilter) && propFilter(prop)
return !prop.parent.fileName.includes('node_modules') || Boolean(val)
propFilter(prop: any): boolean {
const customPropFilter = config.docgenConfig.propFilter
const propFilter =
customPropFilter && _.isFunction(customPropFilter)
? customPropFilter
: defaultPropFilter

return Boolean(propFilter(prop))
},
componentNameResolver(exp: ts.Symbol, source: ts.SourceFile): any {
const componentNameResolver = config.docgenConfig.resolver
Expand Down

0 comments on commit 53063ff

Please sign in to comment.