React-styleguidist: Print to terminal when using a defaultProp that is not listed in props?

Created on 10 May 2017  路  2Comments  路  Source: styleguidist/react-styleguidist

While fixing #437 I realized that the styleguidist would be able to print an info message when the user uses a defaultProp that is not listed in propTypes

In getProps.js line 73 it could look something like this:

let documentation = '';
if (prop.description === undefined) {
  console.log(`[react-styleguidist props analyzation] The prop ${propName} in ${doc.displayName} is listed in defaultProps but not in propTypes.`);
}
else {
  documentation = doctrine.parse(prop.description);
}

What do you think? Is it an helpful addition or not the task of the styleguidist to analyze the users code in this way?

question

Most helpful comment

I鈥檓 sure eslint-plugin-react can do that as well as many other things. I think it鈥檚 way out of scope of Styleguidist and other tools already exist that do that much better.

All 2 comments

I鈥檓 sure eslint-plugin-react can do that as well as many other things. I think it鈥檚 way out of scope of Styleguidist and other tools already exist that do that much better.

Closing since eslint-plugin-react is clearly the better way to approach this kind of thing

Was this page helpful?
0 / 5 - 0 ratings