@@ -28,8 +28,8 @@ export interface GitCommit extends RawGitCommit {
2828}
2929
3030export interface RevertPair {
31- shortRevertingHash : string
32- revertedHash : string
31+ shortRevertingHash : string ;
32+ revertedHash : string ;
3333}
3434
3535export async function getLastGitTag ( ) {
@@ -99,7 +99,7 @@ const ConventionalCommitRegex =
9999const CoAuthoredByRegex = / c o - a u t h o r e d - b y : \s * (?< name > .+ ) ( < (?< email > .+ ) > ) / gim;
100100const PullRequestRE = / \( [ a - z ] * ( # \d + ) \s * \) / gm;
101101const IssueRE = / ( # \d + ) / gm;
102- const RevertHashRE = / T h i s r e v e r t s c o m m i t (?< hash > [ a - f 0 - 9 ] { 40 } ) ./ gm;
102+ const RevertHashRE = / T h i s r e v e r t s c o m m i t (?< hash > [ \d a - f ] { 40 } ) ./ gm;
103103
104104export function parseGitCommit (
105105 commit : RawGitCommit ,
@@ -134,10 +134,10 @@ export function parseGitCommit(
134134 description = description . replace ( PullRequestRE , "" ) . trim ( ) ;
135135
136136 // Extract the reverted hashes.
137- const revertedHashes = [ ]
138- const matchedHashes = commit . body . matchAll ( RevertHashRE )
137+ const revertedHashes = [ ] ;
138+ const matchedHashes = commit . body . matchAll ( RevertHashRE ) ;
139139 for ( const matchedHash of matchedHashes ) {
140- revertedHashes . push ( matchedHash . groups . hash )
140+ revertedHashes . push ( matchedHash . groups . hash ) ;
141141 }
142142
143143 // Find all authors
@@ -161,46 +161,56 @@ export function parseGitCommit(
161161 } ;
162162}
163163
164- export function filterCommits ( commits : GitCommit [ ] , config : ChangelogConfig ) : GitCommit [ ] {
164+ export function filterCommits (
165+ commits : GitCommit [ ] ,
166+ config : ChangelogConfig
167+ ) : GitCommit [ ] {
165168 const commitsWithNoDeps = commits . filter (
166169 ( c ) =>
167- config . types [ c . type ] &&
168- ! ( c . type === "chore" && c . scope === "deps" && ! c . isBreaking )
170+ config . types [ c . type ] &&
171+ ! ( c . type === "chore" && c . scope === "deps" && ! c . isBreaking )
169172 ) ;
170173
171- let resolvedCommits : GitCommit [ ] = [ ]
172- let revertWatchList : RevertPair [ ] = [ ]
174+ let resolvedCommits : GitCommit [ ] = [ ] ;
175+ let revertWatchList : RevertPair [ ] = [ ] ;
173176 for ( const commit of commitsWithNoDeps ) {
174177 // Include the reverted hashes in the watch list
175178 if ( commit . revertedHashes . length > 0 ) {
176- revertWatchList . push ( ...commit . revertedHashes . map ( revertedHash => ( {
177- revertedHash,
178- shortRevertingHash : commit . shortHash
179- } as RevertPair ) ) )
179+ revertWatchList . push (
180+ ...commit . revertedHashes . map (
181+ ( revertedHash ) =>
182+ ( {
183+ revertedHash,
184+ shortRevertingHash : commit . shortHash ,
185+ } as RevertPair )
186+ )
187+ ) ;
180188 }
181189
182190 // Find the commits which revert the current commit being evaluated
183- const shortRevertingHashes = revertWatchList . filter (
184- pair => pair . revertedHash . startsWith ( commit . shortHash )
185- ) . map ( pair => pair . shortRevertingHash )
191+ const shortRevertingHashes = revertWatchList
192+ . filter ( ( pair ) => pair . revertedHash . startsWith ( commit . shortHash ) )
193+ . map ( ( pair ) => pair . shortRevertingHash ) ;
186194
187195 if ( shortRevertingHashes . length > 0 ) {
188196 // Remove commits that reverts this current commit
189197 resolvedCommits = resolvedCommits . filter (
190- resolvedCommit => ! shortRevertingHashes . includes ( resolvedCommit . shortHash )
191- )
198+ ( resolvedCommit ) =>
199+ ! shortRevertingHashes . includes ( resolvedCommit . shortHash )
200+ ) ;
192201
193202 // Unwatch reverting hashes that has been resolved
194203 revertWatchList = revertWatchList . filter (
195- watchedRevert => ! shortRevertingHashes . includes ( watchedRevert . shortRevertingHash )
196- )
204+ ( watchedRevert ) =>
205+ ! shortRevertingHashes . includes ( watchedRevert . shortRevertingHash )
206+ ) ;
197207 } else {
198208 // If the current commit is known not to have been reverted, put it to resolved commits.
199- resolvedCommits = [ ...resolvedCommits , commit ]
209+ resolvedCommits = [ ...resolvedCommits , commit ] ;
200210 }
201211 }
202212
203- return resolvedCommits
213+ return resolvedCommits ;
204214}
205215
206216async function execCommand ( cmd : string , args : string [ ] ) {
0 commit comments