Skip to content

Commit

Permalink
Fix ignoreKeys parameter in compareWithBaseFile function and optimize…
Browse files Browse the repository at this point in the history
… handleHotUpdate function
  • Loading branch information
activeguild committed Feb 19, 2024
1 parent 4cc703a commit ce83035
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const compareWithBaseFile = (
prohibitedKeys?: string[],
prohibitedValues?: string[],
ignoreKeysFilter?: (id: unknown) => boolean,
ignoreKeys: RegExp | RegExp[] | undefined
ignoreKeys?: RegExp | RegExp[] | undefined
) => {
const errors: string[] = [];
for (let i = 0; i < cachedBaseFile.length; i++) {
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ export default async function Plugin(
}
},
async handleHotUpdate(context) {
const text = await context.read();
const json = JSON.parse(text);

let json: any = null;
for (let i = 0; i < finalOptions.length; i++) {
const finalOption = finalOptions[i];
if (!finalOption.cachedBaseFile) {
Expand All @@ -170,6 +168,8 @@ export default async function Plugin(
}

if (context.file === finalOption.baseLocaleFilePath) {
const text = await context.read();
json = JSON.parse(text);
finalOption.cachedBaseFile = traverse(json);
}

Expand Down

0 comments on commit ce83035

Please sign in to comment.