1 | import fse from 'fs-extra' |
||
2 | import extend from 'extend' |
||
3 | import path from 'path' |
||
4 | |||
5 | import { |
||
6 | config |
||
7 | } from '../../cli' |
||
8 | |||
9 | var result = {} |
||
10 | |||
11 | var pathToLocale = path.join(__dirname, '../' + config.localeFolder, config.intlData.locales) |
||
12 | var files = fse.readdirSync(pathToLocale) |
||
13 | |||
14 | Array.prototype.forEach.call(files, (file) => { |
||
15 | var json = fse.readJsonSync(pathToLocale + '/' + file) |
||
16 | result = extend(true, result, json) |
||
17 | }) |
||
18 | |||
19 | if(config.siteLocaleFolder != null){ |
||
20 | var pathToSiteLocale = path.join(config.root, config.siteLocaleFolder, config.intlData.locales) |
||
21 | var files = fse.readdirSync(pathToSiteLocale) |
||
0 ignored issues
–
show
|
|||
22 | Array.prototype.forEach.call(files, (file) => { |
||
23 | var json = fse.readJsonSync(pathToSiteLocale + '/' + file) |
||
24 | result = extend(true, result, json) |
||
25 | }) |
||
26 | } |
||
27 | |||
28 | export default result |
This check looks for variables that are declared in multiple lines. There may be several reasons for this.
In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.
If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.