fix(tools): Validate server-side keys (#40643)
Adds the `api-server` code to the key validation script to include keys that are specifically used on the server-side only. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
c7fc86c7bc
commit
b0aaff19dc
@ -54,9 +54,12 @@ const readComponentCode = filePath => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const clientCodebase = readComponentCode(path.join(process.cwd() + '/src'));
|
const clientCodebase = readComponentCode(path.join(process.cwd() + '/src'));
|
||||||
|
const serverCodebase = readComponentCode(
|
||||||
|
path.join(process.cwd() + '/../api-server/server')
|
||||||
|
);
|
||||||
|
|
||||||
for (const key of keyStrings) {
|
for (const key of keyStrings) {
|
||||||
if (!clientCodebase.includes(key)) {
|
if (!clientCodebase.includes(key) && !serverCodebase.includes(key)) {
|
||||||
console.warn(`The translation key '${key}' appears to be unused.`);
|
console.warn(`The translation key '${key}' appears to be unused.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user