i18next-parser
i18next-parser copied to clipboard
Detect reused keys
Why am I submitting this PR
Allow detect key reuse and option to warn or fail on reuse.
Example: dev writes t('foobar')
in two different files ultimately writing translations to the same JSON.
With config warnOnDuplicates: true
, parser now warns appropriately, and counts the number of warnings like so: . Warnings: XXX warnings encountered
to give a general idea of the number of reused keys.
With config failOnWarnings
, this situation would cause an exit 1.
Does it fix an existing ticket?
Yes #495
Checklist
- [x] only relevant code is changed (make a diff before you submit the PR)
- [x] tests are included and pass:
yarn test
(see details here) - [x] documentation is changed or added
@karellm
@karellm Thanks for the PR, it looks good! I've added couple comments. My main concern is that tests are a bit light.
I addressed your concerns including adding stronger tests. Let me know if you have any other concerns! Thanks.
@karellm bump
This feature seems really cool! Can we get to merge on it?
@karellm bump x2
rebase from main to run all tests instead of a single test + coverage
@karellm bump x3
@karellm bump x4?