mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Ignore unit tests when verifying localized messages (#10449)
The `verify-locale-strings` script now ignores unit tests. This ensures the use of a string literal in a unit test won't mistakenly make this script believe that a message is used in the extension. This came up recently in #10396, where the deletion of unit tests for dead code triggered an unused message lint failure. This was then fixed in #10395.
This commit is contained in:
parent
8a76dcc18a
commit
b885cd1b40
@ -173,10 +173,13 @@ async function verifyEnglishLocale() {
|
|||||||
const globsToStrictSearch = [
|
const globsToStrictSearch = [
|
||||||
'ui/app/components/app/metamask-translation/*.js',
|
'ui/app/components/app/metamask-translation/*.js',
|
||||||
];
|
];
|
||||||
|
const testGlob = '**/*.test.js';
|
||||||
const javascriptFiles = await glob(['ui/**/*.js', 'shared/**/*.js'], {
|
const javascriptFiles = await glob(['ui/**/*.js', 'shared/**/*.js'], {
|
||||||
ignore: globsToStrictSearch,
|
ignore: [...globsToStrictSearch, testGlob],
|
||||||
|
});
|
||||||
|
const javascriptFilesToStrictSearch = await glob(globsToStrictSearch, {
|
||||||
|
ignore: [testGlob],
|
||||||
});
|
});
|
||||||
const javascriptFilesToStrictSearch = await glob(globsToStrictSearch);
|
|
||||||
|
|
||||||
const strictSearchRegex = /\bt\(\s*'(\w+)'\s*\)|\btranslationKey:\s*'(\w+)'/gu;
|
const strictSearchRegex = /\bt\(\s*'(\w+)'\s*\)|\btranslationKey:\s*'(\w+)'/gu;
|
||||||
// match "t(`...`)" because constructing message keys from template strings
|
// match "t(`...`)" because constructing message keys from template strings
|
||||||
|
Loading…
Reference in New Issue
Block a user