gilbsgilbs / babel-plugin-i18next-extract

Babel plugin that statically extracts i18next and react-i18next translation keys.
https://i18next-extract.netlify.com
MIT License
160 stars 37 forks source link

Add an option to fail when extraction errors are present #131

Open zozoens31 opened 4 years ago

zozoens31 commented 4 years ago

Is your feature request related to a problem? Please describe.

I run the plugin in my build to make sure I haven't forgotten any translation. I would like my CI to fail when there are extraction errors, to avoid publishing changes with unexpected behaviour in the translations.

Describe the solution you'd like

I believe a boolean option failOnExtractionError or equivalent would allow to have this feature, with default behaviour as it is today.

Describe alternatives you've considered

We could set failing as the only possible behaviour, since an extraction error probably means there's something amiss in the code. I discarded this idea, because most errors I actually end up with are because I'm translating a dynamic value, for which I should have added a skip comment i18next-extract-disable.

Additional context

This is somehow related to https://github.com/gilbsgilbs/babel-plugin-i18next-extract/issues/87, because we will have to consider whether we want to aggregate all the ExtractionError, or just fail on the first one.