Skip to content

Commit

Permalink
chore: apply automated lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Oct 22, 2023
1 parent dfbb895 commit bc9b77d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
6 changes: 5 additions & 1 deletion src/commands/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ export default async function defaultMain(args: Argv) {
to: args.to,
output: args.output,
exclude:
typeof args.exclude === "string" ? args.exclude.split(",") : (args.exclude === 0 ? [""] : undefined),
typeof args.exclude === "string"
? args.exclude.split(",")
: args.exclude === 0
? [""]
: undefined,
newVersion: typeof args.r === "string" ? args.r : undefined,
});

Expand Down
26 changes: 15 additions & 11 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,21 @@ export function filterParsedCommits(
): GitCommit[] {
// parsing the exclude parameter ('chore(deps)' => ['chore(deps)','chore','(deps)','deps'])
const excludes: RegExpMatchArray[] = config.exclude
? config.exclude.map((excludeString) =>
excludeString.match(/(\*|[a-z]+)(\((.+)\))?/)
)
: [];
console.log(excludes)
return commits.filter((c) =>
config.types[c.type] && !excludes.some((e) =>
e &&
(e[1] === "*" || c.type === e[1]) &&
(c.scope === e[3] || !e[3]) &&
!c.isBreaking)
? config.exclude.map((excludeString) =>
excludeString.match(/(\*|[a-z]+)(\((.+)\))?/)
)
: [];
console.log(excludes);
return commits.filter(
(c) =>
config.types[c.type] &&
!excludes.some(
(e) =>
e &&
(e[1] === "*" || c.type === e[1]) &&
(c.scope === e[3] || !e[3]) &&
!c.isBreaking
)
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ describe("git", () => {
const config = await loadChangelogConfig(process.cwd(), {
from: COMMIT_FROM,
to: COMMIT_TO,
exclude: ["fix","chore(deps)"],
exclude: ["fix", "chore(deps)"],
});
const parsed = filterParsedCommits(parseCommits(commits, config), config);

Expand Down

0 comments on commit bc9b77d

Please sign in to comment.