Open jooola opened 3 years ago
Hey @jooola, this would be great! I'll leave this issue open for someone to submit a PR. Would you be interested in submitting one?
The types that we would want to validate can be seen here: https://github.com/angeloashmore/gatsby-plugin-local-search/blob/cb2ecab03f388dd2fa9a9359728a464d53dac9d4/src/types.ts#L32-L41
For the normalizer
function, I don't think there's much we could do to validate besides checking that we're receiving a function of arity one. Calling the function to check its output wouldn't be ideal since the function could have side-effects (e.g. logging).
Hey, I propose to setup the Gatsby plugin options validation tool in this plugin.
This will bring few things:
See an example in the gatsby wordpress plugin https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/src/steps/declare-plugin-options-schema.ts