fix: lint (#7433)
* chore: fix lint * fix: constants check:lint command * chore(lint): permit unused vars which begin w/ _ * chore: rm dead code * fix(lint): more lint fixes to constants pkg * fix(lint): lint the live server - fix lint issues * chore: improve clean script * fix(lint): more lint * chore: set live server process title * chore(deps): update to turbo@2.5.5 * chore(live): target node22 * fix(dev): add missing ui pkg dependency * fix(dev): lint decorators * fix(dev): lint space app * fix(dev): address lint issues in types pkg * fix(dev): lint editor pkg * chore(dev): moar lint * fix(dev): live server exit code * chore: address PR feedback * fix(lint): better TPageExtended type * chore: refactor * chore: revert most live server changes * fix: few more lint issues * chore: enable ci checks Ensure we can build + confirm that lint is not getting worse. * chore: address PR feedback * fix: web lint warning added to package.json * fix: ci:lint command --------- Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
parent
514686d9d5
commit
57479f4554
95 changed files with 348 additions and 460 deletions
|
|
@ -5,7 +5,7 @@ import { TranslationContext } from "../context";
|
|||
import { ILanguageOption, TLanguage } from "../types";
|
||||
|
||||
export type TTranslationStore = {
|
||||
t: (key: string, params?: Record<string, any>) => string;
|
||||
t: (key: string, params?: Record<string, unknown>) => string;
|
||||
currentLocale: TLanguage;
|
||||
changeLanguage: (lng: TLanguage) => void;
|
||||
languages: ILanguageOption[];
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ export class TranslationStore {
|
|||
* @param files - Array of file names to import (without .json extension)
|
||||
* @returns Promise that resolves to merged translations
|
||||
*/
|
||||
private async importAndMergeFiles(language: TLanguage, files: string[]): Promise<any> {
|
||||
private async importAndMergeFiles(language: TLanguage, files: string[]) {
|
||||
try {
|
||||
const importPromises = files.map((file) => import(`../locales/${language}/${file}.json`));
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ export class TranslationStore {
|
|||
* @param language - The language to import the translations for
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
private async importLanguageFile(language: TLanguage): Promise<any> {
|
||||
private async importLanguageFile(language: TLanguage) {
|
||||
const files = Object.values(ETranslationFiles);
|
||||
return this.importAndMergeFiles(language, files);
|
||||
}
|
||||
|
|
@ -176,7 +176,6 @@ export class TranslationStore {
|
|||
/**
|
||||
* Gets the IntlMessageFormat instance for the given key and locale
|
||||
* Returns cached instance if available
|
||||
* Throws an error if the key is not found in the translations
|
||||
*/
|
||||
private getMessageInstance(key: string, locale: TLanguage): IntlMessageFormat | null {
|
||||
const cacheKey = this.getCacheKey(key, locale);
|
||||
|
|
@ -188,10 +187,10 @@ export class TranslationStore {
|
|||
|
||||
// Get the message from the translations
|
||||
const message = get(this.translations[locale], key);
|
||||
if (!message) return null;
|
||||
if (typeof message !== "string") return null;
|
||||
|
||||
try {
|
||||
const formatter = new IntlMessageFormat(message as any, locale);
|
||||
const formatter = new IntlMessageFormat(message, locale);
|
||||
this.messageCache.set(cacheKey, formatter);
|
||||
return formatter;
|
||||
} catch (error) {
|
||||
|
|
@ -208,7 +207,7 @@ export class TranslationStore {
|
|||
* @param params - The params to format the translation with
|
||||
* @returns The translated string
|
||||
*/
|
||||
t(key: string, params?: Record<string, any>): string {
|
||||
t(key: string, params?: Record<string, unknown>): string {
|
||||
try {
|
||||
// Try current locale
|
||||
let formatter = this.getMessageInstance(key, this.currentLocale);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue