Skip to content

Commit 0f1295b

Browse files
committed
scripts/sync-i18n-files.ts: scope import of lodash
Now that we are properly linting the scripts directory there are a few issues we missed before. This imports the specific modules we need from lodash instead of the entire package.
1 parent 758bad6 commit 0f1295b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/sync-i18n-files.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import isEmpty from 'lodash/isEmpty';
2+
import isEqual from 'lodash/isEqual';
3+
14
import { projectRoot } from '../webpack/helpers';
25

36
const commander = require('commander');
47
const fs = require('node:fs');
58
const JSON5 = require('json5');
69
const _cliProgress = require('cli-progress');
7-
const _ = require('lodash');
810

911
const program = new commander.Command();
1012
program.version('1.0.0', '-v, --version');
@@ -201,13 +203,13 @@ function createNewChunkComparingSourceAndTarget(correspondingTargetChunk, source
201203
if (oldKeyValueInTargetComments != null) {
202204
const oldKeyValueUncommented = getSubStringWithRegex(oldKeyValueInTargetComments[0], '".*')[0];
203205

204-
if (!(_.isEmpty(correspondingTargetChunk) && _.isEmpty(commentSource)) && !removeWhiteLines(correspondingTargetChunk).includes(removeWhiteLines(commentSource.trim()))) {
206+
if (!(isEmpty(correspondingTargetChunk) && isEmpty(commentSource)) && !removeWhiteLines(correspondingTargetChunk).includes(removeWhiteLines(commentSource.trim()))) {
205207
commentsOfSourceHaveChanged = true;
206208
newChunk.push(COMMENTS_CHANGED_TODO);
207209
}
208210
const parsedOldKey = JSON5.stringify('{' + oldKeyValueUncommented + '}');
209211
const parsedSourceKey = JSON5.stringify('{' + keyValueSource + '}');
210-
if (!_.isEqual(parsedOldKey, parsedSourceKey)) {
212+
if (!isEqual(parsedOldKey, parsedSourceKey)) {
211213
messageOfSourceHasChanged = true;
212214
newChunk.push(MESSAGE_CHANGED_TODO);
213215
}

0 commit comments

Comments
 (0)