Skip to content

Commit d76f3da

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 d76f3da

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/sync-i18n-files.ts

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

38
const commander = require('commander');
49
const fs = require('node:fs');
510
const JSON5 = require('json5');
611
const _cliProgress = require('cli-progress');
7-
const _ = require('lodash');
812

913
const program = new commander.Command();
1014
program.version('1.0.0', '-v, --version');
@@ -201,13 +205,13 @@ function createNewChunkComparingSourceAndTarget(correspondingTargetChunk, source
201205
if (oldKeyValueInTargetComments != null) {
202206
const oldKeyValueUncommented = getSubStringWithRegex(oldKeyValueInTargetComments[0], '".*')[0];
203207

204-
if (!(_.isEmpty(correspondingTargetChunk) && _.isEmpty(commentSource)) && !removeWhiteLines(correspondingTargetChunk).includes(removeWhiteLines(commentSource.trim()))) {
208+
if (!(isEmpty(correspondingTargetChunk) && isEmpty(commentSource)) && !removeWhiteLines(correspondingTargetChunk).includes(removeWhiteLines(commentSource.trim()))) {
205209
commentsOfSourceHaveChanged = true;
206210
newChunk.push(COMMENTS_CHANGED_TODO);
207211
}
208212
const parsedOldKey = JSON5.stringify('{' + oldKeyValueUncommented + '}');
209213
const parsedSourceKey = JSON5.stringify('{' + keyValueSource + '}');
210-
if (!_.isEqual(parsedOldKey, parsedSourceKey)) {
214+
if (!isEqual(parsedOldKey, parsedSourceKey)) {
211215
messageOfSourceHasChanged = true;
212216
newChunk.push(MESSAGE_CHANGED_TODO);
213217
}

0 commit comments

Comments
 (0)