Skip to content

Commit d34f332

Browse files
committed
fix lint errors in gulp file
1 parent ff6e902 commit d34f332

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

gulpfile.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function lang2data(lang) {
2929
let str ='{\n';
3030
let count = 0;
3131
for (const w in lang) {
32-
if (lang.hasOwnProperty(w)) {
32+
if (Object.prototype.hasOwnProperty.call(lang, w)) {
3333
count++;
3434
const key = ' "' + w.replace(/"/g, '\\"') + '": ';
3535
str += key + '"' + lang[w].replace(/"/g, '\\"') + '",\n';
@@ -71,11 +71,11 @@ function writeWordJs(data, src) {
7171
text += "'use strict';\n\n";
7272
text += 'systemDictionary = {\n';
7373
for (const word in data) {
74-
if (data.hasOwnProperty(word)) {
74+
if (Object.prototype.hasOwnProperty.call(data, word)) {
7575
text += ' ' + padRight('"' + word.replace(/"/g, '\\"') + '": {', 50);
7676
let line = '';
7777
for (const lang in data[word]) {
78-
if (data[word].hasOwnProperty(lang)) {
78+
if (Object.prototype.hasOwnProperty.call(data[word], lang)) {
7979
line += '"' + lang + '": "' + padRight(data[word][lang].replace(/"/g, '\\"') + '",', 50) + ' ';
8080
}
8181
}
@@ -99,13 +99,13 @@ function words2languages(src) {
9999
const data = readWordJs(src);
100100
if (data) {
101101
for (const word in data) {
102-
if (data.hasOwnProperty(word)) {
102+
if (Object.prototype.hasOwnProperty.call(data, word)) {
103103
for (const lang in data[word]) {
104-
if (data[word].hasOwnProperty(lang)) {
104+
if (Object.prototype.hasOwnProperty.call(data[word], lang)) {
105105
langs[lang][word] = data[word][lang];
106106
// pre-fill all other languages
107107
for (const j in langs) {
108-
if (langs.hasOwnProperty(j)) {
108+
if (Object.prototype.hasOwnProperty.call(langs, j)) {
109109
langs[j][word] = langs[j][word] || EMPTY;
110110
}
111111
}
@@ -117,7 +117,7 @@ function words2languages(src) {
117117
fs.mkdirSync(src + 'i18n/');
118118
}
119119
for (const l in langs) {
120-
if (!langs.hasOwnProperty(l))
120+
if (!Object.prototype.hasOwnProperty.call(langs, l))
121121
continue;
122122
const keys = Object.keys(langs[l]);
123123
keys.sort();
@@ -169,7 +169,7 @@ function languages2words(src) {
169169
langs[lang] = JSON.parse(langs[lang]);
170170
const words = langs[lang];
171171
for (const word in words) {
172-
if (words.hasOwnProperty(word)) {
172+
if (Object.prototype.hasOwnProperty.call(words, word)) {
173173
bigOne[word] = bigOne[word] || {};
174174
if (words[word] !== EMPTY) {
175175
bigOne[word][lang] = words[word];
@@ -184,7 +184,7 @@ function languages2words(src) {
184184
if (aWords) {
185185
// Merge words together
186186
for (const w in aWords) {
187-
if (aWords.hasOwnProperty(w)) {
187+
if (Object.prototype.hasOwnProperty.call(aWords, w)) {
188188
if (!bigOne[w]) {
189189
console.warn('Take from actual words.js: ' + w);
190190
bigOne[w] = aWords[w];
@@ -211,7 +211,7 @@ async function translateNotExisting(obj, baseText, yandex) {
211211
}
212212

213213
if (t) {
214-
for (let l in languages) {
214+
for (const l in languages) {
215215
if (!obj[l]) {
216216
const time = new Date().getTime();
217217
obj[l] = await translate(t, l, yandex);
@@ -282,7 +282,7 @@ gulp.task('updateReadme', function (done) {
282282
done();
283283
});
284284

285-
gulp.task('translate', async function (done) {
285+
gulp.task('translate', async function (_done) {
286286

287287
let yandex;
288288
const i = process.argv.indexOf('--yandex');
@@ -293,9 +293,9 @@ gulp.task('translate', async function (done) {
293293
if (iopackage && iopackage.common) {
294294
if (iopackage.common.news) {
295295
console.log('Translate News');
296-
for (let k in iopackage.common.news) {
296+
for (const k in iopackage.common.news) {
297297
console.log('News: ' + k);
298-
let nw = iopackage.common.news[k];
298+
const nw = iopackage.common.news[k];
299299
await translateNotExisting(nw, null, yandex);
300300
}
301301
}
@@ -309,14 +309,14 @@ gulp.task('translate', async function (done) {
309309
}
310310

311311
if (fs.existsSync('./admin/i18n/en/translations.json')) {
312-
let enTranslations = require('./admin/i18n/en/translations.json');
313-
for (let l in languages) {
312+
const enTranslations = require('./admin/i18n/en/translations.json');
313+
for (const l in languages) {
314314
console.log('Translate Text: ' + l);
315315
let existing = {};
316316
if (fs.existsSync('./admin/i18n/' + l + '/translations.json')) {
317317
existing = require('./admin/i18n/' + l + '/translations.json');
318318
}
319-
for (let t in enTranslations) {
319+
for (const t in enTranslations) {
320320
if (!existing[t]) {
321321
existing[t] = await translate(enTranslations[t], l, yandex);
322322
}

0 commit comments

Comments
 (0)