CLI to find unused/missing translations #503
Replies: 3 comments
-
Hey @simonlovesyou, thank you so much for starting this discussion! There's no CLI or ESLint plugin planned at this point, but I'm absolutely open to discussing this! Would you like to implement and provide this under your own GitHub user or in this repo? Both is totally fine IMO, we can link to it from the workflows & integrations page in the docs. I like your idea about having an ESLint plugin, mostly because many developers already use ESLint and therefore it's easy to integrate with their toolchain. In regard to other rules, a But starting with an ESLint plugin with a single rule could still be useful IMO. Do you have experience with building something like this? I'm wondering how this would impact editor performance or, more generally, ESLint runtime performance. When are messages files checked? Are there parts of the linting process that can be cached? A CLI might be less performance-sensitive since a user would explicitly call the CLI e.g. on CI (see also #398 (comment)). What's your opinion? /cc @kieranm |
Beta Was this translation helpful? Give feedback.
-
I tried to write an ESlint rule for this and failed miserably. ESLint seems to analyse files independently and so there doesn't appear to be a way of determining whether something is used or unused globally across the whole codebase. I could be missing something big though as my ESLint knowledge is very limited |
Beta Was this translation helpful? Give feedback.
-
I just noticed i18n Ally has a usage report, this could be helpful in this context: It currently reports a few false positives for me though, due to pending support for |
Beta Was this translation helpful? Give feedback.
-
Hey!
At my previous engagement we developed a CLI to find unused or missing translations with static code analysis. It was closed source unfortunately, but would there be any interest in integrating it to
next-intl
if I were to rebuild it, but open source? :) If so, any thoughts on what the features set should be? There are also some different choices we can make in terms of user configuration, preferred libraries to use etc.This is relevant to Linting unused strings · amannn/next-intl · Discussion #398
EDIT: On second thought it could even be integrated as an eslint rule instead of a separate CLI if we would prefer that.
Beta Was this translation helpful? Give feedback.
All reactions