🚨(i18n) add linter to i18n package

We need to add a linter to the i18n package, we are mainly
interested by the jest linting rules so we create
a jest eslint config pluggable our other configs and to the
i18n eslint config.
This commit is contained in:
Anthony LC
2024-01-24 15:27:11 +01:00
committed by Anthony LC
parent 801cb98e15
commit 8043d12315
20 changed files with 272 additions and 189 deletions

View File

@@ -1,15 +1,15 @@
import fs from "fs";
import path from "path";
import fs from 'fs';
import path from 'path';
import { hideBin } from "yargs/helpers";
import yargs from "yargs/yargs";
import { hideBin } from 'yargs/helpers';
import yargs from 'yargs/yargs';
// Get our args
const argv = yargs(hideBin(process.argv)).argv;
const { app, output } = argv;
const folderPath = "./locales/" + app;
const namefile = "translations.json";
const folderPath = './locales/' + app;
const namefile = 'translations.json';
const jsonI18n = {};
// Fetch the files in the locales folder
@@ -31,7 +31,7 @@ fs.readdirSync(folderPath).map((language) => {
throw new Error(`File ${pathTranslateFile} not found!`);
}
const json = JSON.parse(fs.readFileSync(pathTranslateFile, "utf8"));
const json = JSON.parse(fs.readFileSync(pathTranslateFile, 'utf8'));
// Transform the json file to the format expected by i18next
const jsonKeyMessage = {};
@@ -48,6 +48,6 @@ if (!Object.keys(jsonI18n).length) {
}
// Write the file to the output
fs.writeFileSync(output, JSON.stringify(jsonI18n), "utf8");
fs.writeFileSync(output, JSON.stringify(jsonI18n), 'utf8');
console.log(`${app} translations deployed!`);