React-styleguidist: Support `@ignore` to prevent cataloging "private" component files

Created on 8 Jan 2019  路  2Comments  路  Source: styleguidist/react-styleguidist

We use a modular project structure which is an adaptation of that which is described in this article. For any given component directory, there are some files that are "public" and others that are considered private implementation details. By convention, only those components exported by the index.js file are considered "public":

// file: Foo/index.js
import Foo from './Foo'
import Bar from './Bar'

export default Foo

export {
  Bar
}
// file:  Foo/Foo.jsx

import Bar from './Bar'
import BazIsPrivate from './BazIsPrivate'

export default function Foo() {
  return (
    <div>
      <Bar />
      <BazIsPrivate />
    </div>
  )
}

Proposed solution

I would like to propose that either @private and/or @ignore will work on components the same way it currently does for properties:

/**
 * @ignore
 */
export default BazIsPrivate(props) {
}
/**
 * @private
 */
export default BazIsPrivate(props) {
}

Alternative solutions

I've considered adopting a file naming convention to leverage the existing "blacklisting" functionality, e.g.:

Foo/
  _BazIsPrivate.jsx

But this feels suboptimal for a few reasons:

  1. It's aesthetically..."icky" (highly subjective, I know);
  2. If we decide to make a private file "public" (i.e., export it from the index.js), then we have to rename the file, even though no code changes in the file itself; and
  3. It involves adopting a non-standard file-naming convention solely for the purpose of supporting a feature (or lack thereof) in a third-party tool.
wontfix

All 2 comments

skipComponentsWithoutExample option could be another alternative:

https://react-styleguidist.js.org/docs/configuration#skipcomponentswithoutexample

馃槾 This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week without any further activity. Consider opening a pull request if you still have this issue or want this feature.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mheathcote1977 picture mheathcote1977  路  3Comments

vchoisk picture vchoisk  路  3Comments

stcherenkov picture stcherenkov  路  3Comments

XOP picture XOP  路  3Comments

dzimmerman902 picture dzimmerman902  路  3Comments