mirror of
https://github.com/yldio/copilot.git
synced 2024-11-10 21:30:06 +02:00
fix issues raised by eslint
This commit is contained in:
parent
06f7b29fc3
commit
7ffaba66a5
@ -5,7 +5,6 @@ const Ncp = require('ncp');
|
|||||||
|
|
||||||
const readdir = thenify(fs.readdir);
|
const readdir = thenify(fs.readdir);
|
||||||
const writeFile = thenify(fs.writeFile);
|
const writeFile = thenify(fs.writeFile);
|
||||||
const readFile = thenify(fs.readFile);
|
|
||||||
const ncp = thenify(Ncp.ncp);
|
const ncp = thenify(Ncp.ncp);
|
||||||
|
|
||||||
const root = path.join(__dirname, '../locales');
|
const root = path.join(__dirname, '../locales');
|
||||||
@ -27,7 +26,7 @@ const compile = async () => {
|
|||||||
const files = await readdir(root);
|
const files = await readdir(root);
|
||||||
const jsons = files.filter(filename => path.extname(filename) === '.json');
|
const jsons = files.filter(filename => path.extname(filename) === '.json');
|
||||||
|
|
||||||
const locales = files.reduce((res, filename) => {
|
const locales = jsons.reduce((res, filename) => {
|
||||||
const name = path.parse(filename).name;
|
const name = path.parse(filename).name;
|
||||||
const json = JSON.stringify(require(path.join(root, filename)));
|
const json = JSON.stringify(require(path.join(root, filename)));
|
||||||
const lang = name.split(/\-/)[0];
|
const lang = name.split(/\-/)[0];
|
||||||
@ -52,8 +51,6 @@ const compile = async () => {
|
|||||||
return ncp(source, destination);
|
return ncp(source, destination);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return await Promise.all(Object.keys(locales).map((name) => {
|
return await Promise.all(Object.keys(locales).map((name) => {
|
||||||
console.log(`Writing ${name}.js`);
|
console.log(`Writing ${name}.js`);
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@ module.exports = (({
|
|||||||
).toLowerCase();
|
).toLowerCase();
|
||||||
|
|
||||||
const lang = detectedLocale.split(/\-/)[0];
|
const lang = detectedLocale.split(/\-/)[0];
|
||||||
const locale = ReactIntlLocaleData[lang] ?
|
const locale = ReactIntlLocaleData[lang]
|
||||||
(Locales[detectedLocale] ? detectedLocale : 'en-us') : 'en-us';
|
? (Locales[detectedLocale] ? detectedLocale : 'en-us')
|
||||||
|
: 'en-us';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
locale,
|
locale,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
const qs = require('querystring');
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const ReactIntlRedux = require('react-intl-redux');
|
const ReactIntlRedux = require('react-intl-redux');
|
||||||
const ReactHotLoader = require('react-hot-loader');
|
const ReactHotLoader = require('react-hot-loader');
|
||||||
|
Loading…
Reference in New Issue
Block a user