Fix lint issues

And disable eslint when building in prod mode

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-11-30 10:24:11 +01:00
parent da42522073
commit 2d541f2e32
161 changed files with 3869 additions and 1236 deletions

View File

@@ -8,10 +8,14 @@ import langs from "../i18n/langs.json";
const DEFAULT_LOCALE = "en_US";
let language =
localStorage.getItem(USER_LOCALE) || (document.documentElement.getAttribute("lang") as string);
localStorage.getItem(USER_LOCALE) ||
(document.documentElement.getAttribute("lang") as string);
language =
language ||
((window.navigator as any).userLanguage || window.navigator.language).replace(/-/, "_");
((window.navigator as any).userLanguage || window.navigator.language).replace(
/-/,
"_"
);
export const locale =
language && Object.prototype.hasOwnProperty.call(langs, language)
? language
@@ -71,7 +75,9 @@ export async function loadLanguageAsync(lang: string): Promise<string> {
}
// If the language hasn't been loaded yet
const newMessages = await import(
/* webpackChunkName: "lang-[request]" */ `@/i18n/${vueI18NfileForLanguage(lang)}.json`
/* webpackChunkName: "lang-[request]" */ `@/i18n/${vueI18NfileForLanguage(
lang
)}.json`
);
i18n.setLocaleMessage(lang, newMessages.default);
loadedLanguages.push(lang);
@@ -82,7 +88,10 @@ loadLanguageAsync(locale);
export function formatList(list: string[]): string {
if (window.Intl && Intl.ListFormat) {
const formatter = new Intl.ListFormat(undefined, { style: "long", type: "conjunction" });
const formatter = new Intl.ListFormat(undefined, {
style: "long",
type: "conjunction",
});
return formatter.format(list);
}
return list.join(",");