🚨(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:
@@ -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!`);
|
||||
|
||||
Reference in New Issue
Block a user