Skip to content

Commit

Permalink
fix(.codefendrc): fix regex not generating on init
Browse files Browse the repository at this point in the history
  • Loading branch information
Z-n-o-M committed Jan 5, 2023
1 parent a2b6c7c commit 3c97457
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/cli/CodefendCLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,15 @@ export class CodefendCLI implements ICodefendCLI {
async executeInitCommand() {
console.log("Creating .codefendrc.json...");
await this.delay(500);
const options = { ...codefendDefaultOptions };
if (options.regexList?.length) {
options.regexList.forEach((regex) => {
regex.value = regex.value.toString();
});
}
await fileSystem.fileWriter.writeFile(
"./.codefendrc.json",
JSON.stringify(codefendDefaultOptions, null, 4)
JSON.stringify(options, null, 4)
);
console.log(
"Initialization completed. .codefendrc.json has been generated."
Expand Down
2 changes: 1 addition & 1 deletion src/core/options/ICodefendOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface ICodefendPredefinedWordOption {
}

export interface ICodefendRegexListOption {
value: RegExp;
value: RegExp | string;
name: string;
}

Expand Down

0 comments on commit 3c97457

Please sign in to comment.