blueberryapps / react-bluekit

Automatically generating a component library from your React components (ES5, ES6, Typescript)
http://bluekit.blueberry.io
MIT License
646 stars 33 forks source link

Sharing proptypes between components #111

Open andyearnshaw opened 7 years ago

andyearnshaw commented 7 years ago

I have some common proptypes that I want to maintain in a single place as a constant:

export default const PROPTYPE_THEME = PropTypes.oneOf([
    'default', 'primary', 'white', 'blue', 'purple', 'pink', 'orange', 'green', 'red'
]);

If I add more themes, I only need to edit this one file and not every component. However, I can no longer change it in BlueKit, because it's detected as a "custom" property. It would be handy if BlueKit could either:

andyearnshaw commented 7 years ago

Option 1 requires an improvement in react-docgen: https://github.com/reactjs/react-docgen/issues/33. Option 2 may still be doable.

alexcastillo commented 7 years ago

+1

pasupuletics commented 7 years ago

:+1:

chris-allnutt commented 6 years ago

+1 just got surprised this, was sad it doesn't work since you can get similar enforcement with typescript