use parens for arrow funcs always

This commit is contained in:
Pavel Mineev
2021-01-29 03:17:10 -06:00
committed by Umputun
parent be2f6d0a20
commit e1e8da4b2a
40 changed files with 121 additions and 126 deletions
+2 -2
View File
@@ -5,10 +5,10 @@ const { keys } = require('./getTranslationKeys');
const errors = [];
locales.forEach(locale => {
locales.forEach((locale) => {
const dict = require(getLocalePath({ locale }));
const keysFromDict = Object.keys(dict);
keysFromDict.forEach(key => {
keysFromDict.forEach((key) => {
if (!keys.includes(key)) {
errors.push(
`"${key}" key not found in "${locale}" locale dict. Please run "npm run translation:generate" and commit changes.`
+2 -2
View File
@@ -19,7 +19,7 @@ function sortDict(dict) {
);
}
locales.forEach(locale => {
locales.forEach((locale) => {
let currentDict = {};
const pathToDict = getLocalePath({ locale });
if (fs.existsSync(pathToDict)) {
@@ -35,6 +35,6 @@ locales.forEach(locale => {
fs.writeFileSync(pathToDict, `${JSON.stringify(currentDict, null, 2)}\n`);
fs.writeFileSync(
path.resolve(__dirname, `../app/utils/loadLocale.ts`),
renderLoadLocale(locales.filter(locale => locale !== 'en'))
renderLoadLocale(locales.filter((locale) => locale !== 'en'))
);
});
+1 -1
View File
@@ -6,7 +6,7 @@ const enMessages = {};
export async function loadLocale(locale: string): Promise<Record<string, string>> {
${locales
.map(
locale => ` if (locale === '${locale}') {
(locale) => ` if (locale === '${locale}') {
return import(/* webpackChunkName: "${locale}" */ '../locales/${locale}.json').then((res) => res.default).catch(() => enMessages);
}
`