UNPKG

eslint-plugin-i18n-guard

Version:

ESLint plugin designed to help ensure that every key in your JSON i18n translation files has a corresponding translation. This can help avoid missing translations and ensure consistency across languages.

22 lines (18 loc) 453 B
const fs = require("fs"); const path = require("path"); function getJsonFiles(dir) { let files = []; fs.readdirSync(dir).forEach((file) => { const fullPath = path.join(dir, file); const stats = fs.lstatSync(fullPath); if (stats.isDirectory()) { files = files.concat(getJsonFiles(fullPath)); } else if (file.endsWith(".json")) { files.push(fullPath); } }); return files; } module.exports = { getJsonFiles, };