Remove unused messagePatternToGlob and patternHasSubdirectories

These two internal functions in cli-module-translations were never
imported by any production code. Remove them along with their tests.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-04-13 16:50:16 +02:00
parent 722b35e1a4
commit 0c4d91cbef
2 changed files with 0 additions and 34 deletions
@@ -17,8 +17,6 @@
import {
formatMessagePath,
createMessagePathParser,
messagePatternToGlob,
patternHasSubdirectories,
DEFAULT_MESSAGE_PATTERN,
} from './messageFilePath';
@@ -97,26 +95,4 @@ describe('messageFilePath', () => {
);
});
});
describe('messagePatternToGlob', () => {
it('converts the default pattern', () => {
expect(messagePatternToGlob(DEFAULT_MESSAGE_PATTERN)).toBe(
'messages/*.*.json',
);
});
it('converts a language-directory pattern', () => {
expect(messagePatternToGlob('{lang}/{id}.json')).toBe('*/*.json');
});
});
describe('patternHasSubdirectories', () => {
it('returns true for the default pattern', () => {
expect(patternHasSubdirectories(DEFAULT_MESSAGE_PATTERN)).toBe(true);
});
it('returns true for patterns with directories', () => {
expect(patternHasSubdirectories('{lang}/{id}.json')).toBe(true);
});
});
});
@@ -54,16 +54,6 @@ export function createMessagePathParser(
};
}
/** Converts a message pattern into a glob string for discovering files. */
export function messagePatternToGlob(pattern: string): string {
return pattern.replace(/\{id\}/g, '*').replace(/\{lang\}/g, '*');
}
/** Returns whether the pattern produces paths with subdirectories. */
export function patternHasSubdirectories(pattern: string): boolean {
return pattern.includes('/');
}
export function validatePattern(pattern: string) {
if (!pattern.includes('{id}')) {
throw new Error(