i18next-parser icon indicating copy to clipboard operation
i18next-parser copied to clipboard

Detect reused keys

Open andrewRichardson opened this issue 2 years ago • 8 comments

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

andrewRichardson avatar Apr 06 '22 16:04 andrewRichardson

@karellm

andrewRichardson avatar Apr 06 '22 20:04 andrewRichardson

@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.

andrewRichardson avatar Apr 12 '22 14:04 andrewRichardson

@karellm bump

andrewRichardson avatar May 11 '22 16:05 andrewRichardson

This feature seems really cool! Can we get to merge on it?

amandapouget avatar May 16 '22 14:05 amandapouget

@karellm bump x2

andrewRichardson avatar May 25 '22 14:05 andrewRichardson

rebase from main to run all tests instead of a single test + coverage

Laityned avatar Jun 07 '22 14:06 Laityned

@karellm bump x3

andrewRichardson avatar Jun 14 '22 20:06 andrewRichardson

@karellm bump x4?

andrewRichardson avatar Aug 04 '22 17:08 andrewRichardson